• Advertisement
Sign in to follow this  

BlendState during Lighting Pass

This topic is 1831 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

For my coursework I started working on a small deferred renderer. I am using no optimizations like gbuffer packing, a light pre-pass or so.

The general shader seem to work fine, but when I add a second light, I noticed the blending is not working.

 

So instead of the spotlight being added the spotlight overdraws everything, so the previously visible arrays of the directional light are black.

 

My BlendState is defined in the FX file as follows:

 

BlendState AdditiveBlending
{
	BlendEnable[0] = TRUE;
	SrcBlend[0] = ONE;
	DestBlend[0] = ONE;
	BlendOp[0] = ADD;
	SrcBlendAlpha[0] = ZERO;
	DestBlendAlpha[0] = ZERO;
	BlendOpAlpha[0] = ADD;
	RenderTargetWriteMask[0] = 0x0F;
};

 

 

And Set in the associated technique like this:

 

SetBlendState(AdditiveBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xffffffff);

 

 

I am new to blending and thought I figured it out, unfortunately not...

 

Thanking you in anticipation,

Nik

Share this post


Link to post
Share on other sites
Advertisement
The blending seems to be correct.

Are you sure you're not clearing the render target before drawing the second light?

Post the whole shader and the code that binds render targets.

You could also check if the blend state is being enabled in PIX or NVIDIA NSight. Edited by TiagoCosta

Share this post


Link to post
Share on other sites

Can't believe it, sorry for the troubles.

Basically I was executing the wrong shader still the pointlight shader... Totally stressed because of coursework... thanks for the advice :)

Share this post


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

  • Advertisement