Jump to content

  • Log In with Google      Sign In   
  • Create Account


JBurnside

Member Since 23 Jan 2006
Offline Last Active Jul 19 2012 08:33 AM

Posts I've Made

In Topic: Beginner Question: 3D to 2D projection of a point in pixel shader

17 July 2012 - 08:28 AM

You can certainly do whatever math you want in a pixel shader, but you can't change what pixel is being defined at that point in the pipeline. The math I posted for the vertex shader would work in a pixel shader if you have the right data, but the pixel being processed has already been defined.

In Topic: Beginner Question: 3D to 2D projection of a point in pixel shader

13 July 2012 - 12:20 PM

If I understand you correctly, you are in a vertex shader that likely has a world space position as input and you are trying to output the appropriate position. To do this you will need to do something like the following:

float4 someVertexShaderFunc(float3 worldPos) : SV_POSITION
{

float4 outPos = mul(float4(worldPos, 1), m_WVP);

...

return outPos;

}

PARTNERS