Jump to content
  • Advertisement
Sign in to follow this  
mattm

HLSL and arrays

This topic is 4875 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

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!