I know that in the vertex shader you do it like this:
PixelInputType TextureVertexShader(VertexInputType input)
{
PixelInputType output;
// Change the position vector to be 4 units for proper matrix calculations.
input.position.w = 1.0f;
// Update the position of the vertices based on the data for this particular instance.
input.position.x += input.instancePosition.x;
input.position.y += input.instancePosition.y;
input.position.z += input.instancePosition.z;
// Calculate the position of the vertex against the world, view, and projection matrices.
output.position = mul(input.position, worldMatrix);
output.position = mul(output.position, viewMatrix);
output.position = mul(output.position, projectionMatrix);
// Store the texture coordinates for the pixel shader.
output.tex = input.tex;
return output;
}
What would be the equivalent for using instancedPosition in a geometry shader?Like when I wanna instance a model made of 1 vertex and for each instance to make a quad in the geometry shader and set the quad's position to be that of the instancePosition of the corresponding instance in the instance buffer.
In order to pass the data in your geometry shader, you can simply pass in through from the VS to the GS, so your VS output structure would be like:
then in your vertex shader, pass trough the data directly in your geometry shader (untransformed)
After depending on your input primitive topology your geometry shader will receive the data either as point, line or full triangle, since you mention you want to convert point to quad, prototype would look like this