I'm trying to scale instance data individually in the vertex shader with directX and hlsl. have an input layout that takes a bool and if this is true I want to scale the instance.
The bool goes across to the shader fine but the scaling seems to be wrong.
Basically, I have a model matrix that exists in the shader but before I do:
position = mul(input.position, model); position = mul(input.position, view); position = mul(input.position, projection);
I first ask if this bool is true, if so I do:
model = mul(model, scaleMatrix);
scaleMatrix is just a simple scale matrix where the scale values are 0.5.
My problem is that it doesn't seem to be scaling the instance at it's own origin (which is what I want), it is scaling it at some other origin but I don't know why this is the case.
I don't have much experience with instancing so any help would be greatly appreciated.