Issues after upgrading to 0.7.1 renderer
Posted: Mon Dec 07, 2009 16:16
Hello,
I've upgraded to cegui 0.7.1 from 0.6.2. In the process I had to rewrite the renderer module so it would use my own renderer. Upgrading to the new system went quite smooth, except for three issues:
Issue 1) Antialiased text blends over the background.
---
Here's a screenshot:
Take a very close look at the text. Some of it appears blue, some reddish/white.
How does this happen?
- CEGUI clears the render target to color(r=0,g=0,b=0,a=0).
- Then it renders the window background, output is a pixel with the window background color, e.g. color (r=0.5,g=0.5,b=0.5,a=1).
- Next it renders the text with blending enabled and blending function set to SrcAlpha, InvSrcAlpha.Say the color of pixel of the font is (1,1,1,0.25). Now this blends with the already present pixel in the render target to 0.25 * (1,1,1,0.25) + 0.75 * (0,0,0,0) = ( 0.25, 0.25, 0.25, 0.06 ). This means the final pixel in the render target is almost transparent (alpha=0.06).
- The window render target is bound as a texture and rendered over the background. Since some pixels are almost transparent, they will blend with the background. This results in the strange text colours you can see in the screenshot.
How do you fix this? Use SeparateBlendEnable = true and DstAlpha = One? Or is there another recommendation?
Issue 2): Perspective matrix
----
Why do the default renderers use a perspective projection matrix instead of an orthographic one? Is this to show off 3d rotation of windows? Or is this important in other respects, too?
Issue 3):
----
injectMouseMove(0,0) did not work anymore, had to use something like system->injectMouseMove(1e-5f, 1e-5f). This is not dramatic though and probably better than the behaviour before. Just a change that I didn't see documented.
-Matthias
P.S.: CEGUI is a really great library
P.P.S.: The main page http://www.cegui.org.uk seems to be down for me since a few days; it gives an error message.
I've upgraded to cegui 0.7.1 from 0.6.2. In the process I had to rewrite the renderer module so it would use my own renderer. Upgrading to the new system went quite smooth, except for three issues:
Issue 1) Antialiased text blends over the background.
---
Here's a screenshot:
Take a very close look at the text. Some of it appears blue, some reddish/white.
How does this happen?
- CEGUI clears the render target to color(r=0,g=0,b=0,a=0).
- Then it renders the window background, output is a pixel with the window background color, e.g. color (r=0.5,g=0.5,b=0.5,a=1).
- Next it renders the text with blending enabled and blending function set to SrcAlpha, InvSrcAlpha.Say the color of pixel of the font is (1,1,1,0.25). Now this blends with the already present pixel in the render target to 0.25 * (1,1,1,0.25) + 0.75 * (0,0,0,0) = ( 0.25, 0.25, 0.25, 0.06 ). This means the final pixel in the render target is almost transparent (alpha=0.06).
- The window render target is bound as a texture and rendered over the background. Since some pixels are almost transparent, they will blend with the background. This results in the strange text colours you can see in the screenshot.
How do you fix this? Use SeparateBlendEnable = true and DstAlpha = One? Or is there another recommendation?
Issue 2): Perspective matrix
----
Why do the default renderers use a perspective projection matrix instead of an orthographic one? Is this to show off 3d rotation of windows? Or is this important in other respects, too?
Issue 3):
----
injectMouseMove(0,0) did not work anymore, had to use something like system->injectMouseMove(1e-5f, 1e-5f). This is not dramatic though and probably better than the behaviour before. Just a change that I didn't see documented.
-Matthias
P.S.: CEGUI is a really great library
P.P.S.: The main page http://www.cegui.org.uk seems to be down for me since a few days; it gives an error message.