Sign in to follow this  
danromeo

Static Imposter Pixel Shader?

Recommended Posts

danromeo    238

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this