Jump to content
  • Advertisement
Sign in to follow this  
hserver

SetTextureStageState

This topic is 3612 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi i have a problem about blending these picture that have also alpha channel body.tga : 3 body.tga alpha : 1 effect.tga: Photobucket effect.tga alpha : Photobucket I want to blend them to reach this picture as a result( white color is actually transparent) : 2 I perform this TextureStageState Init_HelperPLane D3DDevice.SetTexture 0, bodytexture D3DDevice.SetTexture 1, effecttexture D3DDevice.SetVertexShader FVF_VERTEX D3DDevice.SetRenderState D3DRS_LIGHTING, False D3DDevice.SetRenderState D3DRS_SRCBLEND, D3DBLEND_SRCALPHA D3DDevice.SetRenderState D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA D3DDevice.SetRenderState D3DRS_ALPHABLENDENABLE, 1 D3DDevice.SetTextureStageState 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 'D3DTOP_SELECTARG1 D3DDevice.SetTextureStageState 0, D3DTSS_ALPHAARG2, D3DTA_CURRENT D3DDevice.SetTextureStageState 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE D3DDevice.SetTextureStageState 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 D3DDevice.SetTextureStageState 0, D3DTSS_COLORARG1, D3DTA_TEXTURE D3DDevice.SetTextureStageState 0, D3DTSS_COLORARG2, D3DTA_CURRENT D3DDevice.SetTextureStageState 1, D3DTSS_ALPHAOP, D3DTOP_MODULATE D3DDevice.SetTextureStageState 1, D3DTSS_ALPHAARG2, D3DTA_CURRENT D3DDevice.SetTextureStageState 1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE D3DDevice.SetTextureStageState 1, D3DTSS_COLOROP, D3DTOP_SELECTARG2 D3DDevice.SetTextureStageState 1, D3DTSS_COLORARG1, D3DTA_TEXTURE D3DDevice.SetTextureStageState 1, D3DTSS_COLORARG2, D3DTA_CURRENT D3DDevice.DrawPrimitiveUP D3DPT_TRIANGLESTRIP, 2, TestPlane(0), Len(TestPlane(0)) but i can't get proper result . what is my mistake?

Share this post


Link to post
Share on other sites
Advertisement
Looks correct except for not disabling stage 2. What result are you getting?

Share this post


Link to post
Share on other sites
i have disabled it in my own code. i dont know how to explain my result (maybe that need another pic)

i'm wonder this code should only render "effect.tga" but it doesn't work either :

D3DDevice.SetTextureStageState 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1
D3DDevice.SetTextureStageState 0, D3DTSS_ALPHAARG2, D3DTA_CURRENT
D3DDevice.SetTextureStageState 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE
D3DDevice.SetTextureStageState 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1
D3DDevice.SetTextureStageState 0, D3DTSS_COLORARG1, D3DTA_TEXTURE
D3DDevice.SetTextureStageState 0, D3DTSS_COLORARG2, D3DTA_CURRENT


D3DDevice.SetTextureStageState 1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1
D3DDevice.SetTextureStageState 1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE
D3DDevice.SetTextureStageState 1, D3DTSS_ALPHAARG2, D3DTA_CURRENT
D3DDevice.SetTextureStageState 1, D3DTSS_COLOROP, D3DTOP_SELECTARG1
D3DDevice.SetTextureStageState 1, D3DTSS_COLORARG1, D3DTA_TEXTURE
D3DDevice.SetTextureStageState 1, D3DTSS_COLORARG2, D3DTA_CURRENT

Share this post


Link to post
Share on other sites
Quote:
Original post by hserver
i'm wonder this code should only render "effect.tga" but it doesn't work either :

D3DDevice.SetTextureStageState 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1
D3DDevice.SetTextureStageState 0, D3DTSS_ALPHAARG2, D3DTA_CURRENT
D3DDevice.SetTextureStageState 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE
D3DDevice.SetTextureStageState 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1
D3DDevice.SetTextureStageState 0, D3DTSS_COLORARG1, D3DTA_TEXTURE
D3DDevice.SetTextureStageState 0, D3DTSS_COLORARG2, D3DTA_CURRENT


D3DDevice.SetTextureStageState 1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1
D3DDevice.SetTextureStageState 1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE
D3DDevice.SetTextureStageState 1, D3DTSS_ALPHAARG2, D3DTA_CURRENT
D3DDevice.SetTextureStageState 1, D3DTSS_COLOROP, D3DTOP_SELECTARG1
D3DDevice.SetTextureStageState 1, D3DTSS_COLORARG1, D3DTA_TEXTURE
D3DDevice.SetTextureStageState 1, D3DTSS_COLORARG2, D3DTA_CURRENT
It should I think, yes. What do you mean it "doesn't work"? Does it render incorrect results? If so, what? Does it fail to render anything? Does it crash? Does it set your PC aflame?

Share this post


Link to post
Share on other sites
I can only think of one thing you might be missing. You likely don't have 2 sets of UVs in your vertex. You must tell stage 1 to use the first set of UVs. By default it expects it's own set.

1, D3DTSS_TEXCOORDINDEX, 0

Share this post


Link to post
Share on other sites
it doesn't work means it render incorrect results
it doesn't work don't mean it fail to render anything
it doesn't work don't mean it crash
and finally it doesn't work don't mean it set my PC aflame
(sorry)

Namethatnobodyelsetook bingo! one line of code make my dream come ture
you are my man!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!