Blending Issues....

Started by
14 comments, last by barakus 19 years, 1 month ago
the sprite is 40x64(though its animated), while the quad is 256x224(Which is the size of the screen as set in the projection matrix). The quad isnt textured, its just a 256x224 black quad that should be half transparent(0.5f alpha).
I''ll try to get some pictures up of with shaders(how it should look) and how it looks without.
Advertisement
Also, this does seem to a problem with blending, since it only dosent render when you have an alphaed sprite. This may be too obvious but are yoiu sure you are not setting up a wrong threshold value and comparison function if using alpha testing, and if using alpha blending, what are you src and dest states?
[size=2]aliak.net
Ok here is the link to the images (sorry dont know any HTML)
the one called "shaders"(http://www.villagephotos.com/viewpubimage.asp?id_=12222934&selected=)
is the working one(the darkness comes from the transparent black quad) and "no shaders" (http://www.villagephotos.com/viewpubimage.asp?id_=12222935&selected=)
is the one that doesnt work. the sprite thats causing the problems is the human character( Trevor Belmont from Castlevania)

EDIT: sorry sirob i didnt see your post. To draw the sprite with alpha(the one thats causing the problems) I use
SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
and to draw the shiny point(which doesnt really matter because its not interfering with the quad, it works with this one and not the other one) I use
SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ONE);
SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );
The thing I don't get is how a vertex shader could have any effect on something related to textures, other than the uv coordinates and vertex color. Or are you using a pixel shader? If so, I guess a whole lot of things could be happening differently.

If it's just a vertex shader, it must be related to color or texture coordinates. Are you sure you're setting SetTexture(NULL) for the quad?

Yep. I think I'm out of ideas.
Quote:
which is then followed by a black semi transparent quad covering the whole screen


Is this what's not rendering? What are the src and dest settings for this quad?

(EDIT)Also,
SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ONE); and
SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE ); Seem like a pretty bad blending choice. It's really just modulating, you don't really need alphablending for that.
Sirob Yes.» - status: Work-O-Rama.
Yes! I wasnt setting the texture to null! It works now!
Thank you guys so much for your help I had completely run out of ideas.

This topic is closed to new replies.

Advertisement