Render targets with alpha

Started by
13 comments, last by RobM 11 years, 1 month ago

Not quite, I just suspect you're clearing it to an 'opaque' alpha value when you really want it to be cleared to a transparent one. You can try flipping the alpha to 1.0f/255u and seeing if that changes anything. Of course, all this is irrelevant if you're using an XRGB render target!


Definitely using an XRGB render target - if I return an alpha of 0.5 in the shader ithe transparency works but everything is half bright as expected.

When I clear, I clear z and colour and use the equivalent of D3DCOLOR(0,0,0,0). Wouldn't that just resolve down to a DWORD of zero anyway? So even if I used FromXRGB(0,0,0), surely that would still resolve down to a DWORD of zero?
Advertisement

Is the *HUD* render target being cleared and/or XRGB, or is the backbuffer?

clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.

Is the *HUD* render target being cleared and/or XRGB, or is the backbuffer?


Yes, the hud render target gets cleared in the 'normal' way, i.e. clear colour, clear z, with a colour of 0,0,0,0. Not sure what you mean by 'or is the backbuffer?'

Yes, the hud render target gets cleared in the 'normal' way, i.e. clear
colour, clear z, with a colour of 0,0,0,0. Not sure what you mean by 'or
is the backbuffer?'

If you call Device->clear(X,...); the currently set rendertarget gets cleared, where the first parameter ist the stage you bound it to using SetRenderTarget(X, surface). So if you just call "clear" at the end of the render loop after you set the rendertarget back to backbuffer (SetRenderTarget(0,NULL)) only the backbuffer will get cleared. You need to call Clear expicitely when the texture is bound as a rendertarget. You need to clear the backbuffer like you probably do know in addition to that.

Plus, no need to "Clear z" for a backbuffer-sized rendertarget.

Sorry guys, just fixed this, I had inadvertently created my render targets with XRGB - it's working with ARGB. I could have sworn I checked that - thanks a lot for all your responses.

This topic is closed to new replies.

Advertisement