BlendState during Lighting Pass

Started by
1 comment, last by trevex 11 years, 3 months ago

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

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.

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 :)

This topic is closed to new replies.

Advertisement