Help! Rendering Depthmap shader?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
cooljayman
Posts: 22
Joined: Wed Mar 05, 2008 8:25 am

Help! Rendering Depthmap shader?

Post by cooljayman »

I'm trying to render a depth map based on code from the following site, p.s. They are implementing shadow map, but at this stage I'm just interested in rendering the depth map alone.

http://www.riemers.net/eng/Tutorials/XN ... ow_map.php

here is the shader code that Im using, the frame work I have works good with other shaders like blur ect, but if I do the code below just a black screen? Does any body have a shader example that renders a depth map for irrlicht?

depth.hlsl

Code: Select all

float4x4 mWorldViewProj;

struct VS_OUTPUT
{
   float4 Pos   : POSITION;
   float3 Pos2d : TEXCOORD0;
};


VS_OUTPUT vertexMain( in float4 Pos : POSITION)
{

   VS_OUTPUT Out;

   Out.Pos   = mul(Pos,mWorldViewProj);
   Out.Pos2d = Out.Pos;

   return Out;
}



struct PS_OUTPUT
{
    float4 RGBColor : COLOR0;  // Pixel color   
};



PS_OUTPUT pixelMain( VS_OUTPUT PSIn)
{
   PS_OUTPUT Output;

   Output.RGBColor = PSIn.Pos2d.z/40;

   //Even If I Do
   //Output.RGBColor = (1,1,1,1);
   //I Still get a black screen!! Shouldn't it be white?
	
   return Output;
}

Is there another way to render the depth map in Irrlicht

Please Help:)
Post Reply