Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When using this effect file:

float4x4 World; 
float4x4 View; 
float4x4 Projection; 

float4 ClipPlane0; 

void vs(inout float4 position : POSITION0, out float4 clipDistances : TEXCOORD0) 
    clipDistances.x = dot(position, ClipPlane0); 
    clipDistances.y = 0; 
    clipDistances.z = 0; 
    clipDistances.w = 0; 

    position = mul(mul(mul(position, World), View), Projection); 

float4 ps(float4 clipDistances : TEXCOORD0) : COLOR0 

    return float4(0, 0, 0, 0);

        VertexShader = compile vs_2_0 vs(); 
        PixelShader = compile ps_2_0 ps(); 

all models using this are rendered black. Is it possible to render them correctly?

share|improve this question
that TODO is a huge hint that you need to learn more about HLSL – indeed005 Apr 6 '13 at 15:11
up vote 1 down vote accepted

Your models are being rendered black because of the line return float4(0, 0, 0, 0) in the pixel shader; the return value for this method is the colour (in RBGA) that is being displayed (in your case, black). You are returning the same value irrespective of the model, which is causing your problem.

You need to write some code for your pixel shader to calculate the right colour values for your models. I suggest taking a look at a few tutorials such as this one so that you get the hang of how to write shader code.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.