DirectX 11 Compute Shader terrain alphaMap

Started by
3 comments, last by Such1 11 years, 6 months ago
Hey guys, I`m creating some kind o infinite map, so far everything is okay but I do not know how should I compute the alpha map for the terrain.
I would like to compute every time there is movement, translating what was already generated to it correspond position and generate the new spaces.
I already have the algorimth done in CPU, but I want to use Compute Shaders with 2 textures (1 input 1 output) that keep switching between them. But I do not know how to pass those textures to the Shader, the input is easy but I do not know about the output.
If you have a better way to do it feel free to comment about it.
Advertisement
And I don't think I need the map on the CPU if that improves performance.
Use UnorderedAccessViews. These views are almost the same as your ShaderResourceViews, but they are writeable as well. In the shader you simply add "RW" as a prefix to your type (e.g. "RWTexture2D"). You might not even need 2 textures this way. You can read your input from and write your output to the same resource.
Yeah, I also thought about that, than I can translate the pixel texture coordinate on the pixelShader instead of coping every frame. I just update the pixels I need to
And also, is there a way to do this with Shader 4.0? Than I can support DIrectX 10 as well
Does anyone know any other way I can use ComputeShader to compute my Texture but using Shaders 4.0 instead?Cause than I can use DirectX 10 feature level.

This topic is closed to new replies.

Advertisement