Advertisement Jump to content
Sign in to follow this  
theagentd

Want to use blending but all 4 color channels are taken

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

Hello.
 
I would like to blend in some decals into my G-buffer, which looks like this:

 

 

GBuffer0: diffuseR diffuseG, diffuseB, unused

GBuffer1: normal1, normal2, specular, gloss

GBuffer2: emissiveR, emissiveG, emissiveB, primitive ID number

 

 

I have no problem blending with gBuffer0 and gBuffer2 since I can just use glBlendFuncSeparate to disable any modification of the alpha value, but GBuffer1 needs to have all its values blended. Is there no way of specifying a separate 5th blending value or something like that? Even a separate global value would be extremely convenient.

 

PS: I'm using the 4th method of this article for my normals: http://aras-p.info/texts/CompactNormalStorage.html#method04spheremap.

Edited by theagentd

Share this post


Link to post
Share on other sites
Advertisement

Can you explain what you are trying to "blend" in GBuffer1 and how do you represent the decal?

  • If you have a decal you can obviously overlay a 4 channel RGBA sprite over diffuse or emissive colors, but likely not the same sprite for both.
  • Where are you getting decal normals from? And what do you want the resulting normals to be?
  • "Specular" and "gloss" are even more unclear.

Share this post


Link to post
Share on other sites
This is a long-standing problem with fixed-function blending; we really do need that 5th output as a blend factor...
You can blend rgb values in one pass (with write mask 0x7/rgb) and then render the decal in another pass rendering only alpha (write mask 0x8/a) without blending but with clip/discard in the pixel shader. That will let you do blended RGB decals and do cutout aloha decals.

Share this post


Link to post
Share on other sites

Very frustrating. It seems as if the maximum number of dual source blending buffers is only 1 for most GPUs out there. Obviously I only need 1 dual source buffer since only G-buffer1 has that problem, but then I'd require glBlendFuncSeparatei() to only use if for G-buffer1 which isn't supported by Nvidia's OpenGL 3 cards. Siiiigh... -_-

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!