Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to figure out a specific alpha mask application using IDirect3D9#SetTextureStageState
    primarykey
    data
    text
    <p>I'm trying to create a system where I can cause a fadeout on a texture using a second texture as an alpha mask.</p> <p>I load the color texture in stage 0 and the mask texture in stage 1. I can get them to stage correctly so that the alpha values are based on the mask and I can get the fade to come in and out by using a sliding D3DTA_CONSTANT. The problem is that I'm trying to create a specific behavior that I can't seem to get out of the available D3DTA.</p> <p>Basically I want to have 2 values, one called 'step' and the other called 'vague'. The 'vague' value will remain constant throughout the effect and the 'step' argument will either start at 0 and increase to 255 over several frames. I'm trying to create the following behavior:</p> <p>*Texels with mask-alpha values below the value of 'step' draw with zero alpha.</p> <p>*Texels with mask-alpha values above 'step' + 'vague' draw with 255 alpha.</p> <p>*Texels with mask-alpha values in the range between 'step' and ('step' + 'vague') draw with alpha scaled such that alpha 'step' is zero alpha and alpha ('step' + 'vague') draws with max alpha.</p> <p>Here's a graph showing the function since it's hard to explain in words:</p> <p><a href="http://imageshack.us/photo/my-images/834/desiredalphamaskfunctio.png/" rel="nofollow">http://imageshack.us/photo/my-images/834/desiredalphamaskfunctio.png/</a></p> <p>The main problem that I'm running into is that I can't figure out how to configure the texture stages so that the middle range (between step and step+vague) to "stretch" its values between 0 and 255. There's no direct division or multiplication, just modulation, so I can't do it the obvious way, but I'm pretty sure that there's a way to do it that just hasn't occurred to me yet. (I had some hope for D3DTOP_MULTIPLYADD, but the 'multiply' turned out to just be another modulate.)</p> <p>Anyone have any ideas?</p> <p>Thanks in advance for any advice.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload