3D from 2D

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

3D from 2D

Post by y offs et » Fri May 14, 2010 5:47 pm

This shows how to make a quasi 3D figure from 2D textures and have the correct texture from each angle.

It's kind of a hack, and I expect someone more trig comfortable will post an improvement.
Attachments
animSprite_1.zip
(12.63 KiB) Downloaded 383 times
"great expectations"

User avatar
Kjell
Posts: 1715
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell » Fri May 14, 2010 8:01 pm

:)

You've got the concept right*, but it can be done much simpler ( instead of a slew of if-statements ). Attached is a example .. that also includes "no-sorting-required" alpha testing ( without use of shaders ) :wink: Control with arrow keys.

And in case you want the frame selection to be rotation based instead of position, change the following line ..

Code: Select all

float A = atan2(CurrentModel.Position.X-App.CameraPosition.X,
                CurrentModel.Position.Z-App.CameraPosition.Z)+
                CurrentModel.Rotation.Y*PI*2;
.. of Monk.OnUpdate into ..

Code: Select all

float A = (CurrentModel.Rotation.Y-App.CameraRotation.Y)*PI*2;
K

*Don't use atan2 to "billboard" a sprite!
Attachments
Monks.jpg
Monks.jpg (28.98 KiB) Viewed 5482 times
Monks.zgeproj
(37.02 KiB) Downloaded 416 times

User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et » Sat May 15, 2010 4:04 am

Oh, Kjell ... yur makin' this old truckers head hurt again. :wink:
"great expectations"

User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski » Sat May 15, 2010 1:08 pm

I like that lighting setup Kjell, thought it was GLfog at first,. nice.
iterationGAMES.com

Post Reply