Jump to content

  • Log In with Google      Sign In   
  • Create Account

BlendState during Lighting Pass


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 trevex   Members   -  Reputation: 125

Like
0Likes
Like

Posted 12 January 2013 - 09:05 AM

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



Sponsor:

#2 TiagoCosta   Crossbones+   -  Reputation: 2456

Like
1Likes
Like

Posted 12 January 2013 - 09:46 AM

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, 12 January 2013 - 09:46 AM.


#3 trevex   Members   -  Reputation: 125

Like
0Likes
Like

Posted 12 January 2013 - 09:53 AM

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






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS