Sign in to follow this  
mattm

HLSL and arrays

Recommended Posts

mattm    165
Hi, I need to pass in an array of data to a HLSL. This array is my heightmap and will then be used to manipulate the Y values of my terrain stream, allowing me to keep the vertex stream in static memory and not have to write to it everytime i want to alter the height (avoiding a lock unlock call). I realise i can declare an array type within the vertex shader and then adjust this with a call to the ConstantTable but is there a way to make this array inside the shader a dynamic size, not decided until runtime? All the examples i have seen put a constant in there which means i loose my flexibilty of the code deciding the terrain size and results in me having to hardcode it. Does anyone have any ideas on this or how to achieve it differently? Thanks, Matt

Share this post


Link to post
Share on other sites
Mezz    571
Passing an array of data to a HLSL shader, where that data is a heightmap, implies texturing in a vertex shader. This is actually supported in Shader 3.0 on the most recent cards, and it's the only way I know of doing what you describe.

-Mezz

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