Sign in to follow this  
thedodgeruk

array of texture2d in hlsl, wont work ?

Recommended Posts

in a shader of mine , i am doing shadow mapping ,
and i know its bad to use for loops in shaders , but all my lights are sent in via arrays and looped through , this is because tyhe shader is done so it can expand if need be
for shadow mapping i need to send in Texture2D for the information , hls lwill not allow an array of these.

is there another way around this ?

Share this post


Link to post
Share on other sites
Support for indexing samplers using arrays only came in at Shader Model 4 (D3D10.0). In SM3/D3D9.0c you will have to manually simulate array access using dynamic branches, or move the branching out to CPU side by performing extra passes of the geometry. One other solution is to pack the shadow maps inside a single larger texture and use an indirection map to look up to the proper subrectangle in the atlas (I think nVidia had a demo about this, but I failed to google it now).

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