I want to find a way how to make instanced tesselation displacement with multiple textures and dynamic level of detail.
It’s still a way to go and right now I am stuck with the instancing.
Basically the grid geometry is instanced. I am not sure if the instancing index gets through the tesselation gfx, maybe that is the issue why it shows only one tile of the water that I use for this test patch.
If anyone has an idea whats wrong or a direction how i could use multipe textures for the displacement, thanks!
Tesselation Instanced Displacement (104.9 kB)
okey I got the instancing to work… it is possible to make large amount of displaced meshes - pretty cool.
Everything happens in the tesselation gfx now.
Now im stuck on the next step:
Displacing every instance with a seperate texture from an texture array.
I created the texture array which is sampling from one single texture.
There is simply a test texture array right now with n numbers.
Have a look in the domain shader - I think there is the twist
float vHeight = tex.SampleLevel(linearSampler,float3(Tc.xy,slice), 0) * cAmb;
p += n * (vHeight * DisplacementFactor);
Instanced Tesselation Texture Array WaterExample.rar (108.5 kB)
Okey it seems like the sampling of the texturearray just doesnt work in the domain shader as expected.
Does someone know how it could be possible to sample textures from a 2d texture array?
float vHeight = tex.SampleLevel(linearSampler,float3(Tc.xy,SLICE), 0)
According to this it should work like this http://msdn.microsoft.com/de-de/library/windows/desktop/bb509699(v=vs.85).aspx
I can not use the function SAMPLE in the domain shader. So I can not just copy the way how it is done in the TextureArray helppatch.
If I use a manual array (Texture2D texN) I can not use dynamic indexes for the sampling - So only the TextureArray is an option.
Also I can not bring the Instance ID in the domainshader … SV_InstanceID gives error - no ds5.0 supported semantic
Check it out guys it is only this line of code left for infinite terrain generation.
well u can pass it as variable from vs
float4 col = texture2d.Sample(linearSampler,float3(input.uv.xy,index));
and u need type uint i think