Skip to main content
gamedev.net
🔒 Locked

alpha blending

Started by 16bit_port 2 replies 900+ views
Original Post
16bit_port
16bit_port
Using : D3D9 and shader model 2.0

Is it possible to perform alpha blending in the pixel shader and not have the color output (from said pixel shader) sent to the blending stage? If so, how?

Also, is it possible to set clear all the alpha blending settings that were called through m_pd3dDevice->SetRenderState() back to default?
MJP
MJP
A pixel shader can't read the contents of the render target. So the only way it can blend is if you sample a texture and blend with that, and then output.

You can't just set all render states back to default. If you want you can use state blocks, which "capture" state a certain point so that you can revert to that state.
unbird
unbird
Quote:
...not have the color output (from said pixel shader) sent to the blending stage?
There are several ways to mask pixels, provided you set up appropriate render-states and calculations in your shader.

- alpha-test
- stencil-test
- depth-test

And in the pixel-shader you can use clip(x) to omit pixels.
DragonGeo2
DragonGeo2
Quote:
Original post by 16bit_port
Using : D3D9 and shader model 2.0

Is it possible to perform alpha blending in the pixel shader and not have the color output (from said pixel shader) sent to the blending stage? If so, how?
Um, what are you trying to do that requires you not use the alpha blending stage? We might be able to help you come up with a method that does not require doing manual alpha blending in the pixel shader.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.