AGK 3D Sprites

Started by hosch, September 02, 2020, 21:44:35

Previous topic - Next topic

hosch

Hi,

I currently want to try out some 3D in AGK. I am familiar with Blitz3D which offered dedicated sprite commands (which could be improved upon by custom written functions, but that's another topic). I wasn't able to find any commands for 2D sprites in 3D in AGK. Aren't there any? I used a plane for now and textured it with the SetObjectImage command. But what about animation?

I can imagine 2 things:
- use the regular AGK 2D sprites and position them in the 3D world with the GetScreenXFrom3D commands (that can't be the right way)
- use a plane and write my own animation function (either shifting UV or via an atlas image)

How to do this? Or am I just blind :))

Thanks a lot!

blinkok

If you want to use a billboard approach then i use a two sided billboard, 2 sprite animations and shift the UV Offset.
I tried this with some kenney sprites and it worked out quite cool i think.



hosch

#2
Thank you for your reply and for kindly providing an example. That's pretty much the look that I've wanted to achieve with my sprites, so UV shifting is the way to go. Unfortunately the example doesn't want to work properly. I commented out a missing json file, but the animation of the sprites seem to be off (see gif). Anyway, I was pointed in the right direction and will figure something out. Thanks again!

EDIT:
I've modified it this way
inc wo
if wo = 6 then wo = 0
SetObjectUVOffset(wizard, 0, wo, 0)

Now the animation works. If I combine that with a timer how long the animation should take in a function, I am set.

hosch

#3
Oh, looking at your code I have another question. How did you achieve that the front of the wizard sprite shows the front image and the back the back image? Or did you do it in your 3D modeling program? I was originally planning on retexturing the image based on the camera angle towards it, but this clearly is a better solution than mine.

EDIT
Trying some stuff out with the code, you did it in your modeling program.

blinkok

The billboard is double sided. If you have a look at the texture the top row is for the front animation and the bottom row is for the back
In fact there is a horizontal plane for the swoosh as well.
I had planned to have a few planes make up the sprite. for swooshes, swords, bow and arrow etc.
Hopefully you've got enough to move forward. Feel free to use my models and the textures are obviously Kenney's and free aw well
Good luck with your project!

hosch

Quote from: blinkok on September 03, 2020, 11:22:15
The billboard is double sided. If you have a look at the texture the top row is for the front animation and the bottom row is for the back
In fact there is a horizontal plane for the swoosh as well.
I had planned to have a few planes make up the sprite. for swooshes, swords, bow and arrow etc.
Hopefully you've got enough to move forward. Feel free to use my models and the textures are obviously Kenney's and free aw well
Good luck with your project!
Yeah, that is more than I could've hoped for! Very generous of you, thanks so much!