• ### What is your GameDev Story?

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

## 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

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634062
• Total Posts
3015303
×