Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 17 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Want to use blending but all 4 color channels are taken


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
4 replies to this topic

#1 theagentd   Members   -  Reputation: 740

Like
0Likes
Like

Posted 03 April 2014 - 07:51 AM

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, 03 April 2014 - 07:51 AM.


Sponsor:

#2 theagentd   Members   -  Reputation: 740

Like
0Likes
Like

Posted 03 April 2014 - 01:12 PM

After some more Googling I managed to find http://www.opengl.org/registry/specs/ARB/blend_func_extended.txt which provides just the functionality that I need, but sadly it's only supported by OS X 10.9 or higher. Seems like I'll have to keep a simple decal renderer which doesn't modify normals as well which doesn't modify GBuffer1.



#3 LorenzoGatti   Crossbones+   -  Reputation: 3245

Like
0Likes
Like

Posted 04 April 2014 - 04:26 AM

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.

Omae Wa Mou Shindeiru


#4 Hodgman   Moderators   -  Reputation: 42375

Like
1Likes
Like

Posted 04 April 2014 - 04:51 AM

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.

#5 theagentd   Members   -  Reputation: 740

Like
0Likes
Like

Posted 06 April 2014 - 09:22 PM

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... -_-






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