December 04, 2020, 02:17:37 PM

Author Topic: AGK 3D Sprites  (Read 422 times)

Offline hosch

  • Jr. Member
  • **
  • Posts: 83
AGK 3D Sprites
« on: September 02, 2020, 09:44:35 PM »
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!

Offline blinkok

  • Sr. Member
  • ****
  • Posts: 271
Re: AGK 3D Sprites
« Reply #1 on: September 03, 2020, 01:13:09 AM »
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.



Offline hosch

  • Jr. Member
  • **
  • Posts: 83
Re: AGK 3D Sprites
« Reply #2 on: September 03, 2020, 09:23:28 AM »
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
Code: [Select]
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.

Offline hosch

  • Jr. Member
  • **
  • Posts: 83
Re: AGK 3D Sprites
« Reply #3 on: September 03, 2020, 09:43:34 AM »
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.

Offline blinkok

  • Sr. Member
  • ****
  • Posts: 271
Re: AGK 3D Sprites
« Reply #4 on: September 03, 2020, 11:22:15 AM »
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!

Offline hosch

  • Jr. Member
  • **
  • Posts: 83
Re: AGK 3D Sprites
« Reply #5 on: September 03, 2020, 01:34:08 PM »
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!

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal