Jump to content
  • Advertisement
Sign in to follow this  
JorenJoestar

Light in light-pre-pass/deferred renderer

This topic is 3386 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, finally I have the time to code my engine after a crunch time at work :P During the last days of october I found informations about light pre pass renderer, created by Wolfgang Engel. Tonight I've finally began to code the shaders but then I felt I've not understand something. 1) Is the normal/depth pass separate? 2) Am I writing only the perturbed maps to a render target and simultaniously updating the depth buffer? 3) How light buffer works? I think that I have to apply the same shader for every light, and every light is represented by a 3d mesh? How do you light inside this mesh? 4) Is it necessary to use stencil to cull some pixels? Thanks guys, I'm feeling really confused but I want to understand this great architecture :)

Share this post


Link to post
Share on other sites
Advertisement
Quote:
1) Is the normal/depth pass separate?
2) Am I writing only the perturbed maps to a render target and simultaniously updating the depth buffer?

That depends on your hardware platform and how you want to balance performance. You can write into a depth buffer and a normal buffer at the same time. You can do it one after the other.

Quote:
3) How light buffer works? I think that I have to apply the same shader for every light, and every light is represented by a 3d mesh? How do you light inside this mesh?
4) Is it necessary to use stencil to cull some pixels?

Filling the light buffer works very similar to a Deferred renderer. You can use the depth-fail stencil method to write a volume into the stencil and then set the stencil and blit the light into this volume. Instead you can use the scissor or the depth bound. Try what is best on your platform. There are numerous sources that show how this can be done. NVIVIDA's SDK for example shows a Deferred rendering example that you can use as a starting point for this.

Share this post


Link to post
Share on other sites
Hi wolf, thanks for your fast response :)

Currently my target platform is a PC, but I want to try different solutions.
Still I cannot understand why to separate depth and normal pass. Maybe doing only a depth pass with color write disabled and then the normal pass is faster than performing a normal pass lonely?

It seems like you use normals and depths packed along the first render target. Is it true? Are you using depth to select which pixel to be affected (like stencil and scissor techniques)? How do those techniques works?

I've begun reading your blog and using Fx Composer, so I've downloaded and seen the example as well...very helpful :)


Thank you very much!



Share this post


Link to post
Share on other sites
Hey,
you can use it either way. It finally depends on other features that your renderer supports. I would just implement it and see how you get along with it.

Regarding depth: you can use the new exposed depth buffer formats or pack depth into the fourth channel of your screen-space normal map buffer. While you pack it you have the chance to change it into whatever form you need it.

I would just start with the NVIDIA 9.5 SDK Deferred Renderer and change it to a Light Pre-Pass renderer. You can work your way from there.

Share this post


Link to post
Share on other sites
Okay...here again because of a problem (strange, eh? :P )
I've finally began the coding of the shader (I've had to prepare a new engine that supports shaders data-driven) for the light-pre-pass renderer, but I've come up to a problem: the output of the light buffer is black.
I'm working with FxComposer (2.5) as suggested by wolfgang, I'll past my code (it's the deferred shading sdk9.5 example modified:


#define LIGHT_COORDS "World"

float Script : STANDARDSGLOBAL <
string UIWidget = "none";
string ScriptClass = "scene";
string ScriptOrder = "standard";
string ScriptOutput = "color";
string Script = "Technique=Technique?Main:Main10;";
> = 0.8;

#include <include\\Quad.fxh>


float4 gClearColor <
string UIWidget = "Color";
string UIName = "Background";
> = {0,0,0,0};

float gClearDepth <string UIWidget = "none";> = 1.0;

float4x4 gWorldXf : World < string UIWidget="None"; >;
float4x4 gWorldITXf : WorldInverseTranspose < string UIWidget="None"; >;
float4x4 gWvpXf : WorldViewProjection < string UIWidget="None"; >;
float4x4 gViewIXf : ViewInverse < string UIWidget="None"; >;
float4x4 gWorldViewXf : WorldView < string UIWidget="None"; >;
float4x4 gInvProj : ProjectionInverse < string UIWidget="None"; >;
float4x4 gViewProjInv : ViewProjectionInverse < string UIWidget="None"; >;


// Directional Lamp 0 ///////////
// apps should expect this to be normalized
float3 gLamp0Dir : DIRECTION <
string Object = "DirectionalLight0";
string UIName = "Lamp 0 Direction";
string Space = (LIGHT_COORDS);
> = {0.7f,-0.7f,-0.7f};
float3 gLamp0Color : COLOR <
string UIName = "Lamp 0";
string Object = "DirectionalLight0";
string UIWidget = "Color";
> = {1.0f,1.0f,1.0f};

// Point light 0
float3 gPoint0Position : POSITION <
string Object = "PointLight0";
string UIName = "Point light 0 position";
string Space = (LIGHT_COORDS);
> = { 10.0f, 20.0f, 10.0f };

// Point light 1
float3 gPoint1Position : POSITION <
string Object = "PointLight1";
string UIName = "Point light 0 position";
string Space = (LIGHT_COORDS);
> = { -10.0f, 20.0f, -10.0f };


// surface color
float3 gSurfaceColor : DIFFUSE <
string UIName = "Surface";
string UIWidget = "Color";
> = {1,1,1};

// Ambient Light
float3 gAmbiColor : AMBIENT <
string UIName = "Ambient Light";
string UIWidget = "Color";
> = {0.07f,0.07f,0.07f};

float gKs <
string UIWidget = "slider";
float UIMin = 0.0;
float UIMax = 1.0;
float UIStep = 0.05;
string UIName = "Specular";
> = 0.4;

float gSpecExpon <
string UIWidget = "slider";
float UIMin = 1.0;
float UIMax = 128.0;
float UIStep = 1.0;
string UIName = "Specular Exponent";
> = 30.0;

/// texture ///////////////////////////////////

FILE_TEXTURE_2D(gDiffuseTexture, gDiffuseSampler , "rockwall.jpg")
FILE_TEXTURE_2D(gNormalTexture, gNormalSampler, "rockwall.tga")

DECLARE_QUAD_TEX(ColrTex,ColrSampler,"A16B16G16R16")
DECLARE_QUAD_TEX(NormTex,NormSampler,"A16B16G16R16")
DECLARE_QUAD_TEX(ViewTex,ViewSampler,"A16B16G16R16")
DECLARE_QUAD_DEPTH_BUFFER(DepthBuffer,"D24S8")
DECLARE_QUAD_TEX(LightTex, LightSampler, "A16B16G16R16")

/************* DATA STRUCTS **************/

struct appdata {
float3 Position : POSITION;
float4 UV : TEXCOORD0;
float4 Normal : NORMAL;
float4 Tangent : TANGENT0;
float4 Binormal : BINORMAL0;
};

struct vertexOutput {
float4 HPosition : POSITION;
float2 TexCoord0 : TEXCOORD0;
float2 TexCoord1 : TEXCOORD1;
float3 WorldNormal : TEXCOORD2;
float3 WorldTangent : TEXCOORD3;
float3 WorldBinormal : TEXCOORD4;
float4 Position2 : TEXCOORD5;
};

/*********** vertex shader ******/

vertexOutput unlitVS(appdata IN,
uniform float4x4 WorldITXf, // our four standard "untweakable" xforms
uniform float4x4 WorldXf,
uniform float4x4 ViewIXf,
uniform float4x4 WvpXf
) {
vertexOutput OUT = (vertexOutput)0;
// OUT.LightVec = 0;
OUT.WorldNormal = mul(IN.Normal,WorldITXf).xyz;
OUT.WorldTangent = mul(IN.Tangent,WorldITXf).xyz;
OUT.WorldBinormal = mul(IN.Binormal,WorldITXf).xyz;
float4 Po = float4(IN.Position.xyz,1);
float3 Pw = mul(Po,WorldXf).xyz;

OUT.TexCoord0 = IN.UV.xy;
OUT.TexCoord1 = IN.UV.xy;

OUT.Position2 = mul(Po, WvpXf);
OUT.HPosition = mul(Po,WvpXf);

return OUT;
}

/********* pixel shader ********/


float3 vector_to_texture(float3 v) { return ((v*0.5)+float3(0.5,0.5,0.5)); }
float3 texture_to_vector(float3 t) { return ((t-float3(0.5,0.5,0.5))*2.0); }


void prepMRTPS(vertexOutput IN,
out float4 ColorOutput : COLOR0,
out float4 NormalOutput : COLOR1)
{
half4 diffuseTex = tex2D( gDiffuseSampler, IN.TexCoord0);
half3 normalTex = tex2D( gNormalSampler, IN.TexCoord1);

//diffuseTex.xyz = diffuseTex.www;

float3x3 TangentToView;
TangentToView[0] = IN.WorldNormal;
TangentToView[1] = IN.WorldTangent;
TangentToView[2] = IN.WorldBinormal;
half3 normal = normalize(mul(normalTex, TangentToView));

//pack
normal = normal * 0.5f + 0.5f;

ColorOutput = float4(diffuseTex.xyz, 0.0f);
NormalOutput = float4(normalTex, IN.Position2.z / IN.Position2.w);
}

half4 lightBufferPS( vertexOutput IN ) : COLOR0
{
half4 gBuffer = tex2D(NormSampler, IN.TexCoord0);
half4 position = mul(half4(IN.Position2.x, IN.Position2.y, gBuffer.w, 1.0), gInvProj);
position.xyz = position.xyz/position.www;
position.w = 1.0;

half3 normal = gBuffer.xyz * 2 - 1;
normal = normalize(normal);


half3 lightPos0 = mul(half4(gPoint0Position, 1.0), gViewIXf);
half3 lightVec0 = (lightPos0 - position.xyz);
half length0 = length(lightVec0);
lightVec0 = lightVec0 / length0;
half atten0 = max(1.0f - (length0 / 10.0) ,0.0);

half NdotL0 = dot(normal, lightVec0);
half selfShadow0 = (NdotL0 > 0) ? 1 : 0;
half3 diffuse = NdotL0 * selfShadow0 * half3(0.7, 0.0, 0.0);

half3 eyeVec = normalize(-position.xyz);
half3 halfAngle0 = normalize(lightVec0 + eyeVec);
half3 specular0 = max(pow(dot(halfAngle0, normal), 50), 0) * selfShadow0;

return half4(NdotL0 * selfShadow0 * atten0 * specular0, 1.0);
}

float4 useMRTPS(QuadVertexOutput IN,
uniform float Ks,
uniform float SpecExpon,
uniform float3 LightDir,
uniform float3 LightColor,
uniform float3 AmbiColor) : COLOR
{
return tex2D(LightSampler, IN.UV);

float3 texC = tex2D(ColrSampler,IN.UV).rgb;
float3 Nn = texture_to_vector(tex2D(NormSampler,IN.UV).xyz);
float3 Vn = texture_to_vector(tex2D(ViewSampler,IN.UV).xyz);
float3 Ln = normalize(-LightDir); // normalize() potentially un-neccesary
float3 Hn = normalize(Vn + Ln);
float ldn = dot(Ln,Nn);
float hdn = dot(Hn,Nn);
float4 lv = lit(ldn,hdn,SpecExpon);
float3 specC = (Ks * lv.y * lv.z) * LightColor;
float3 diffC = ((lv.y * LightColor) + AmbiColor) * texC;
float3 result = diffC + specC;
return float4(result.rgb,1.0);
}

///////////////////////////////////////
/// TECHNIQUES ////////////////////////
///////////////////////////////////////

technique Main <
string Script =
"Pass=create_MRTs;"
"Pass=fillLightBuffer;"
"Pass=deferred_lighting;";
> {
pass create_MRTs <
string Script =
"RenderColorTarget0=ColrTex;"
"RenderColorTarget1=NormTex;"
"RenderDepthStencilTarget=DepthBuffer;"
"ClearSetColor=gClearColor;"
"ClearSetDepth=gClearDepth;"
"Clear=Color0;"
"Clear=Color1;"
"Clear=Depth;"
"Draw=Geometry;";
> {
VertexShader = compile vs_3_0 unlitVS(gWorldITXf,gWorldXf,
gViewIXf,gWvpXf);
ZEnable = true;
ZWriteEnable = true;
ZFunc = LessEqual;
AlphaBlendEnable = false;
CullMode = None;
PixelShader = compile ps_3_0 prepMRTPS();
}

pass fillLightBuffer <
string Script =
"RenderColorTarget0=LightTex;"
"RenderColorTarget1=;"
"RenderDepthStencilTarget=DepthBuffer;"
"ClearSetColor=gClearColor;"
"ClearSetDepth=gClearDepth;"
"Clear=Color0;"
"Clear=Color1;"
"Clear=Depth;"
"Draw=Geometry;";
> {
VertexShader = compile vs_3_0 unlitVS(gWorldITXf,gWorldXf,
gViewIXf,gWvpXf);
ZEnable = true;
ZWriteEnable = true;
ZFunc = LessEqual;
AlphaBlendEnable = false;
CullMode = None;
PixelShader = compile ps_3_0 lightBufferPS();
}

pass deferred_lighting <
string Script =
"RenderColorTarget0=;"
"RenderColorTarget1=;"
"RenderDepthStencilTarget=;"
"ClearSetColor=gClearColor;"
"ClearSetDepth=gClearDepth;"
"Clear=Color;"
"Clear=Depth;"
"Draw=Buffer;";
> {
VertexShader = compile vs_3_0 ScreenQuadVS2(QuadTexelOffsets);
ZEnable = false;
ZWriteEnable = false;
AlphaBlendEnable = false;
CullMode = None;
PixelShader = compile ps_3_0 useMRTPS(gKs,gSpecExpon,
gLamp0Dir,gLamp0Color,
gAmbiColor);
}
}

Thanks!

Share this post


Link to post
Share on other sites
Ah so you have reached the fun part ;)

First thing you will want to do is test your input data. I set up a shader to output differences between reconstructed position/actual position, depth, and normals. This will tell you if your position reconstruction, or G-buffer data is wrong.

Basically run your G-buffer pass, then run a debug pass which samples from the G-buffer, and computes the same data that the G-buffer stores, so that you can see precision errors, or packing errors (if you are packing/converting data). It's a very useful tool for debugging, and optimizing pre-pass renderer issues.

Share this post


Link to post
Share on other sites
You're right, actually the code is buggy. I've tried to bypass the light pass, letting the pixel shader of this pass to draw directly the contents of the normal buffer, but it turns out black.
If I remove the light pass, the normals are showed correctly.
Now I'm tracing what stupid error I've made :P

Share this post


Link to post
Share on other sites
Ok...this is my new code, it seems to work even if I'm not sure about the specular term...do you find some errors?



#define LIGHT_COORDS "World"

float Script : STANDARDSGLOBAL <
string UIWidget = "none";
string ScriptClass = "scene";
string ScriptOrder = "standard";
string ScriptOutput = "color";
string Script = "Technique=Technique?Main:Main10;";
> = 0.8;

#include <include\\Quad.fxh>


float4 gClearColor <
string UIWidget = "Color";
string UIName = "Background";
> = {0,0,0,0};

float gClearDepth <string UIWidget = "none";> = 1.0;


float4x4 gWorldXf : World < string UIWidget="None"; >;
float4x4 gWorldITXf : WorldInverseTranspose < string UIWidget="None"; >;
float4x4 gWvpXf : WorldViewProjection < string UIWidget="None"; >;
float4x4 gViewIXf : ViewInverse < string UIWidget="None"; >;
float4x4 gWorldViewXf : WorldView < string UIWidget="None"; >;
float4x4 gInvProj : ProjectionInverse < string UIWidget="None"; >;
float4x4 gViewProjInv : ViewProjectionInverse < string UIWidget="None"; >;


// Directional Lamp 0 ///////////
// apps should expect this to be normalized
float3 gLamp0Dir : DIRECTION <
string Object = "DirectionalLight0";
string UIName = "Lamp 0 Direction";
string Space = (LIGHT_COORDS);
> = {0.7f,-0.7f,-0.7f};
float3 gLamp0Color : COLOR <
string UIName = "Lamp 0";
string Object = "DirectionalLight0";
string UIWidget = "Color";
> = {1.0f,1.0f,1.0f};

// Point light 0
float3 gPoint0Position : POSITION <
string Object = "PointLight0";
string UIName = "PointLight0";
string Space = (LIGHT_COORDS);
> = { 0.5f, 20.0f, 0.0f };

// Point light 1
float3 gPoint1Position : POSITION <
string Object = "PointLight1";
string UIName = "Point light 0 position";
string Space = (LIGHT_COORDS);
> = { -10.0f, 20.0f, -10.0f };


// surface color
float3 gSurfaceColor : DIFFUSE <
string UIName = "Surface";
string UIWidget = "Color";
> = {1,1,1};

// Ambient Light
float3 gAmbiColor : AMBIENT <
string UIName = "Ambient Light";
string UIWidget = "Color";
> = {0.07f,0.07f,0.07f};

float gKs <
string UIWidget = "slider";
float UIMin = 0.0;
float UIMax = 1.0;
float UIStep = 0.05;
string UIName = "Specular";
> = 0.4;

float gSpecExpon <
string UIWidget = "slider";
float UIMin = 1.0;
float UIMax = 128.0;
float UIStep = 1.0;
string UIName = "Specular Exponent";
> = 30.0;

/// texture ///////////////////////////////////

FILE_TEXTURE_2D(gDiffuseTexture, gDiffuseSampler , "rockwall.jpg")
FILE_TEXTURE_2D(gNormalTexture, gNormalSampler, "rockwall.tga")

DECLARE_QUAD_TEX(ColrTex,ColrSampler,"A16B16G16R16")
DECLARE_QUAD_TEX(NormTex,NormSampler,"A16B16G16R16")
DECLARE_QUAD_TEX(ViewTex,ViewSampler,"A16B16G16R16")
DECLARE_QUAD_DEPTH_BUFFER(DepthBuffer,"D24S8")
DECLARE_QUAD_TEX(LightTex, LightSampler, "A16B16G16R16")

/************* DATA STRUCTS **************/

/* data from application vertex buffer */
struct appdata {
float3 Position : POSITION;
float4 UV : TEXCOORD0;
float4 Normal : NORMAL;
float4 Tangent : TANGENT0;
float4 Binormal : BINORMAL0;
};

/* data passed from vertex shader to pixel shader */
struct vertexOutput {
float4 HPosition : POSITION;
float2 TexCoord0 : TEXCOORD0;
float2 TexCoord1 : TEXCOORD1;
float3 WorldNormal : TEXCOORD2;
float3 WorldTangent : TEXCOORD3;
float3 WorldBinormal : TEXCOORD4;
float4 Position2 : TEXCOORD5;
};

/*********** vertex shader ******/

//
// use the std connector declaration but we can ignore the light direction
//
vertexOutput unlitVS(appdata IN,
uniform float4x4 WorldITXf,
uniform float4x4 WorldXf,
uniform float4x4 ViewIXf,
uniform float4x4 WvpXf
) {
vertexOutput OUT = (vertexOutput)0;
// OUT.LightVec = 0;
OUT.WorldNormal = mul(IN.Normal,WorldITXf).xyz;
OUT.WorldTangent = mul(IN.Tangent,WorldITXf).xyz;
OUT.WorldBinormal = mul(IN.Binormal,WorldITXf).xyz;
float4 Po = float4(IN.Position.xyz,1);
float3 Pw = mul(Po,WorldXf).xyz;

OUT.TexCoord0 = IN.UV.xy;
OUT.TexCoord1 = IN.UV.xy;

OUT.Position2 = mul(Po, WvpXf);
OUT.HPosition = mul(Po,WvpXf);

return OUT;
}

vertexOutput lightVS(appdata IN)
{
vertexOutput OUT = (vertexOutput)0;
OUT.HPosition = float4(IN.Position, 1.0f);

OUT.WorldNormal = mul(IN.Normal,gWorldITXf).xyz;
OUT.WorldTangent = mul(IN.Tangent,gWorldITXf).xyz;
OUT.WorldBinormal = mul(IN.Binormal,gWorldITXf).xyz;
float4 Po = float4(IN.Position.xyz,1);
float3 Pw = mul(Po,gWorldXf).xyz;

OUT.TexCoord0 = IN.UV.xy + QuadTexelOffsets;
OUT.TexCoord1 = IN.UV.xy + QuadTexelOffsets;

OUT.Position2 = float4(normalize(gViewIXf[3].xyz - Pw), 1.0);

return OUT;
}

/********* pixel shader ********/


float3 vector_to_texture(float3 v) { return ((v*0.5)+float3(0.5,0.5,0.5)); }
float3 texture_to_vector(float3 t) { return ((t-float3(0.5,0.5,0.5))*2.0); }


void prepMRTPS(vertexOutput IN,
out float4 ColorOutput : COLOR0,
out float4 NormalOutput : COLOR1)
{
half4 diffuseTex = tex2D( gDiffuseSampler, IN.TexCoord0);
half3 normalTex = tex2D( gNormalSampler, IN.TexCoord1);

//diffuseTex.xyz = diffuseTex.www;

float3x3 TangentToView;
TangentToView[0] = IN.WorldNormal;
TangentToView[1] = IN.WorldTangent;
TangentToView[2] = IN.WorldBinormal;
half3 normal = normalize(mul(normalTex, TangentToView));

//pack
normal = normal * 0.5f + 0.5f;

ColorOutput = float4(diffuseTex.xyz, 0.0f);
NormalOutput = float4(normal, IN.Position2.z / IN.Position2.w);
}

half4 lightBufferPS( vertexOutput IN ) : COLOR0
{
half4 gBuffer = tex2D(NormSampler, IN.TexCoord0);
half4 position = mul((IN.Position2 * gBuffer.w), gInvProj);

half3 normal = gBuffer.xyz * 2 - 1;
normal = normalize(normal);

half3 lightPos0 = mul(half4(gPoint0Position, 1.0), gViewIXf);

half3 lightVec0 = normalize(lightPos0 - position.xyz);
half length0 = length(lightVec0);

lightVec0 = lightVec0 / length0;
half atten0 = max(1.0f - (length0 / 10.0) ,0.0);

half NdotL0 = dot(normal, lightVec0);

//return half4(NdotL0, 0.0, 0.0, 1.0);

half selfShadow0 = (NdotL0 > 0) ? 1 : 0;
half3 diffuse = NdotL0 * selfShadow0 * half3(0.7, 0.7, 0.7);

half3 eyeVec = normalize(position.xyz);
half3 halfAngle0 = normalize(lightVec0 + eyeVec);
half specular0 = max(pow(dot(halfAngle0, normal), 3), 0) * selfShadow0;

//return half4(NdotL0 * selfShadow0 * atten0 * specular0, 1.0);
return half4(0.1 * NdotL0, 0.1 * NdotL0, 0.1 * NdotL0, specular0 * NdotL0 * 0.1);
}

float3 RGB2Lum(float3 input)
{
float lum = (input.r * 0.3f) + (input.g * 0.59f) + (input.b * 0.11f);
return float3(lum, lum, lum);
}

float4 useMRTPS(QuadVertexOutput IN,
uniform float Ks,
uniform float SpecExpon,
uniform float3 LightDir,
uniform float3 LightColor,
uniform float3 AmbiColor) : COLOR
{
float3 albedo = tex2D(ColrSampler, IN.UV).rgb;
float4 light = tex2D(LightSampler, IN.UV);
float3 lightning = float3(light.x, light.y, light.z) + ( light.www / RGB2Lum(light.xyz));

return float4(albedo + lightning, 1.0f);
}

///////////////////////////////////////
/// TECHNIQUES ////////////////////////
///////////////////////////////////////

technique Main <
string Script =
"Pass=create_MRTs;"
"Pass=fillLightBuffer;"
"Pass=deferred_lighting;";
> {
pass create_MRTs <
string Script =
"RenderColorTarget0=ColrTex;"
"RenderColorTarget1=NormTex;"
"RenderDepthStencilTarget=DepthBuffer;"
"ClearSetColor=gClearColor;"
"ClearSetDepth=gClearDepth;"
"Clear=Color0;"
"Clear=Color1;"
"Clear=Depth;"
"Draw=Geometry;";
> {
VertexShader = compile vs_3_0 unlitVS(gWorldITXf,gWorldXf,
gViewIXf,gWvpXf);
ZEnable = true;
ZWriteEnable = true;
ZFunc = LessEqual;
AlphaBlendEnable = false;
CullMode = None;
PixelShader = compile ps_3_0 prepMRTPS();
}

pass fillLightBuffer <
string Script =
"RenderColorTarget0=LightTex;"
"RenderColorTarget1=;"
"RenderDepthStencilTarget=DepthBuffer;"
"ClearSetColor=gClearColor;"
"ClearSetDepth=gClearDepth;"
//"Clear=Color;"
"Clear=Depth;"
"Draw=Buffer;";
> {
VertexShader = compile vs_3_0 lightVS();
ZEnable = false;
ZWriteEnable = false;
AlphaBlendEnable = false;
CullMode = None;
PixelShader = compile ps_3_0 lightBufferPS();
}

pass deferred_lighting <
string Script =
"RenderColorTarget0=;"
"RenderColorTarget1=;"
"RenderDepthStencilTarget=;"
"ClearSetColor=gClearColor;"
"ClearSetDepth=gClearDepth;"
"Clear=Color;"
"Clear=Depth;"
"Draw=Buffer;";
> {
VertexShader = compile vs_3_0 ScreenQuadVS2(QuadTexelOffsets);
ZEnable = false;
ZWriteEnable = false;
AlphaBlendEnable = false;
CullMode = None;
PixelShader = compile ps_3_0 useMRTPS(gKs,gSpecExpon,
gLamp0Dir,gLamp0Color,
gAmbiColor);
}
}




Hope also that this helps somebodyelse :)
The problem also is that I had to disable the clear color in the light pass, that causes the entirely black light-buffer.
The second problem is about the intensity: I've had to multiply all in the light pass with 0.1 to have a smaller light.

Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!