Here's a youtube video of my problem.
Look at how the hideous cube kinda slides into the terrain and rotates weirdly with the world and from above its vanished into the terrain. None of the other models (not instanced) have that problem.
I'm having trouble getting hardware instancing to work as I need it to. For some reason my instanced models appear to vanish from above.
I thought I was doing something wrong with the instance transforms (which maybe I am). So i ripped out all but the scale and translation for those... same problem.
I thought it might be a depth problem so I just set the depth at 0 and STILL i have the same problem.
I made the simplest model I could with 1 bone and 1 texture. Same problem.
Maybe i'm missing something obvious.
Here's the vertex shader:
VertexShaderOutput VertexShaderCommon(VertexShaderInput input, float4x4 instanceTransform)
{
VertexShaderOutput output;
// Apply the world and camera matrices to compute the output position.
float4 worldPosition = mul(input.Position, instanceTransform);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);
// Compute lighting, using a simple Lambert model.
float3 worldNormal = mul(input.Normal, instanceTransform);
float diffuseAmount = max(-dot(worldNormal, LightDirection), 0);
float3 lightingResult = saturate(diffuseAmount * DiffuseLight + AmbientLight);
output.Color = float4(lightingResult, 1);
// Copy across the input texture coordinate.
output.TextureCoordinate = input.TextureCoordinate;
return output;
}
Please help. I've been stuck on this for a day or two now annoyingly.
If you need an more code you might think relevant let me know.
Thanks in advance!