Page 1 of 1

3D from 2D

Posted: Fri May 14, 2010 5:47 pm
by y offs et
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.

Posted: Fri May 14, 2010 8:01 pm
by Kjell
:)

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!

Posted: Sat May 15, 2010 4:04 am
by y offs et
Oh, Kjell ... yur makin' this old truckers head hurt again. :wink:

Posted: Sat May 15, 2010 1:08 pm
by jph_wacheski
I like that lighting setup Kjell, thought it was GLfog at first,. nice.