Original Post
Hi, My scientifical software use Direct3D and Shaders for large heightmap rendering (512x512). It's working great, but I'd like to optimize memory footprint. X and Y coordinates can easily be computed from vertex position in VertexBuffer. So only Z coordinates are pertinant and should be stored in tables and buffers. My VS function should be like this: struct VertexToPixel { float4 Position : POSITION; float4 Color : COLOR0; }; VertexToPixel VS( float inZ : PSIZE ) { VertexToPixel Output = (VertexToPixel)0; float4x4 preMatrix = mul(xWorldMatrix,xViewProjectionMatrix); float4 inPos; inPos.x = VERTEX_POSITION % xWidth; inPos.y = VERTEX_POSITION / xWidth; inPos.z = inZ; Output.Position = mul(inPos, preMatrix); Output.Color.r = inPos.x / xWidth; Output.Color.g = inPos.y / xHeight; Output.Color.b = 1; return Output; } So there is a way to get vertex indice in the VertexBuffer ? Or someone haa any idea to improve ? Thanks, Mickael