0
\$\begingroup\$

I created a 512x512 shadow texture, and I don't want to render the center part on my Terrain. Can something like this be done? I didn't find anything on the internet about this enter image description here

(Example as in the picture)

I want to do this because I want to have a different texture in the center. If I don't cut it, it blends with my second, and I will have texture0 + texture1.

If I don't blend the textures, I will have texture0 or texture1.

Code:

STATEMANAGER.SetTransform(D3DTS_TEXTURE0, &m_matDynamicShadow);
STATEMANAGER.SetTexture(0, m_lpCharacterShadowMapTexture);

STATEMANAGER.SetTransform(D3DTS_TEXTURE1, &m_matDynamicShadow2);
STATEMANAGER.SetTexture(1, m_lpCharacterShadowMapTexture2);


STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);


STATEMANAGER.SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
STATEMANAGER.SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT);
STATEMANAGER.SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
\$\endgroup\$
2
  • \$\begingroup\$ Do you just want to change your blending function inside your shader so that samples inside the middle region of this texture read exclusively from that different middle texture? If so, you should include the relevant part of your shader code in your question so we can help you modify it. \$\endgroup\$
    – DMGregory
    Nov 27, 2021 at 12:23
  • \$\begingroup\$ Hi, I added the code-part. I don't use shaders :D \$\endgroup\$
    – Tiberius
    Nov 27, 2021 at 14:14

1 Answer 1

0
\$\begingroup\$

Since you're using D3DTOP_MODULATE (multiplication) to blend your textures, you can effectively remove the influence of this texture in regions you don't want it to affect by painting it white in those places. (White maps to one, and multiplying anything by one returns the input unchanged).

You could do this by rendering a plain white quad into the middle of your texture after generating your shadow information, or by clearing the texture to white and using a stencil test to prevent rendering of shadow information into the middle square in the first place.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .