Jump to content
  • Advertisement
Sign in to follow this  
danromeo

Static Imposter Pixel Shader?

This topic is 2083 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to implement Static Imposters and am having a hard time finding info or samples on how to create a pixel shader....can anybody point me to any resources?  I'm finding lots of theoretical discussions but no solid code, and I'm thinking my math isn't strong enough to write an efficient shader.  

 

Specifically, I have spherical billboards that will draw images from texture atlases of different angles based on the camera angle to the object, always lerping between two images that describe the nearest angle, with images for every 45 degrees, including top-down angles.  Everything works except the final mechanism to decide which images to use.  So I THINK I need a pixel shader that determines the camera angle to the object on the Y axis and picks the two closest images to the angle, lerping between them as the camera angle changes, and determines the camera angle to the object on the X axis to decide if top-down images should be used.  IE if I have 24 images in my atlas, the first have a 0 degree rotation on the X axis with 45 degree intervals on the Y axis, the next 8 have a 45 degree rotation on the X axis with 45 degree intervals on the Y axis, and the final 8 have a 90 degree rotation on the X axis (straight down) at 45 degree intervals on the Y axis.  SO if the camera is above the object add 8 to the image index to get a down-angle image and add 16 to the index to get a straight-down angle.  Hope this makes sense.  

 

I'm trying to add trees to my world that will allow for a top-down view, using deferred rendering to create lighting, shadows, and reflections.  This will be my final step if it works!

 

THANKS 

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!