glOrtho setup for rendering "impostors" into a texture.

Are you blending that to the screen as pre-multiplied or as regular alpha blending? It does look like the alpha is over-saturated, but it also looks like you are also re-multiplying the source pixels by the alpha. Maybe not, I can't really tell just from the screenshot.

Code:

glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

According to the red book at least, don't you need to do anything special to use glBlendFuncSeperate() over glBlendFunc(), they both are activated with the GL_BLEND token.

TomorrowPlusX Wrote:I'd *never* even heard of this glBlendFuncSeparate...

Promoted from EXT_blend_func_separate to OpenGL 1.4. It is only available on Radeon8500+ and GeForce5200+. And, er, software.

Quote:can GL Profiler allow me to see the renderbuffer contents when I'm doing RTT? I thought it only allowed me to see the contents of the display context.

If you are really using FBO renderbuffers (why would you use a renderbuffer to render to texture?) then no, the GL Profiler available as of XCode 2.2.1 can't show you the contents. A future version should fix that. It can show the contents of any display context, just use the context popup. And of course any texture, including ones bound to an FBO.

In my previous projects like PCSX I found it very helpful to watch the alpha buffer drawn one primitive at a time. It is much easier to see how those DST_ALPHA values are built up.

arekkusu Wrote:Promoted from EXT_blend_func_separate to OpenGL 1.4. It is only available on Radeon8500+ and GeForce5200+. And, er, software.

Gotcha. I stumbled across that googling for info on glBlendFuncSeparate. I'm willing to make the card-compatibility sacrifice

arekkusu Wrote:If you are really using FBO renderbuffers (why would you use a renderbuffer to render to texture?) then no, the GL Profiler available as of XCode 2.2.1 can't show you the contents. A future version should fix that. It can show the contents of any display context, just use the context popup. And of course any texture, including ones bound to an FBO.

It's very possible that I'm mixing up my terminology. I'm using an FBO to target a color attachment texture; I'm not certain of any other approach to do the same, other than PBuffers. Too bad I can't view its alpha channel.

arekkusu Wrote:In my previous projects like PCSX I found it very helpful to watch the alpha buffer drawn one primitive at a time. It is much easier to see how those DST_ALPHA values are built up.

I have to post an update. First, I solved what I thought was the problem. The whole black-fringe thing was an artifact resultant of a bug in how my scenegraph sets up drawing for transparent objects ( which are depth sorted and all that hoo-hah ).

Anyway, on catching that, I discovered that I have, in fact, the exact opposite problem than I thought. Initially I thought that alpha was saturating.

Now, I realize that alpha is not saturating, but is in fact acting more along these lines:

Pseudo

Code:

dst.alpha = src.alpha * dst.alpha

You can see in this annotated screenshot:

What's happening, as far as I can tell, is that each incoming fragment with alpha < 1 is reducing the alpha in the color buffer. I've tried different blending modes with no luck.

Well, after a fair amount of experimentation, I now have both the alpha compositing and the ortho projections working correctly!

In fact, in tests, the tree ( rendered distantly as an impostor ) looks almost exactly the same as the real geometric tree, complete with parallax when you look from different angles. The only difference is that the impostor -- being a texture -- is antialiased where the normally rendered tree is not. When I enable FSAA, it basically is indistinguishable!

So, now I've got some plumbing issues to make trees automatically switch between impostor and solid rendering based on distance ( and probably lrp the alpha of the solid and impostor for a range between the switch, so I don't get "popping" ).

OneSadCookie Wrote:You might need to use EXT_blend_equation_separate or another similar extension to get the destination alpha working the way you want.

Ultimately, that's what I used, but making it *work* required -- apparently -- turning off alpha and depth testing. I don't understand why, though.