Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

doc_zero

Transparency again.

This topic is 5478 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

I have a problem with blending textures together. For my particle system with a texture with alpha channel I am starting to see the rectangles of the textures, even thoug edges are set to be transparent. It happens for certain angles. I am using bilboarding, (the simplest method, reseting model view matrix, so only translation is left) and still under the ceratin angle I can see texture quads. Does anyone knows how to deal with this? Thanks in advance. Regards, Alexander.

Share this post


Link to post
Share on other sites
Advertisement
Could you post a screenshot? It would help to give me an idea what the problem is.

Share this post


Link to post
Share on other sites
The first picture is what I would like to have and what I have with
rotation shown by lines (red is positive X, green is positive Y and blue is positive Z)
http://pubpages.unh.edu/~shirokov/pts_good.jpg
The second one is what I get for some rotation
http://pubpages.unh.edu/~shirokov/pts_bad.jpg

It looks like all I need it is a positive rotation around Y axis, once angle is between 0 and 180 I will get such result.

Thanks for the help.

Share this post


Link to post
Share on other sites
Ohh disable depth testing, and make sure blending is enabled.

glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);

Share this post


Link to post
Share on other sites
Thanks, Skow.

Disabling of the depth tets was the solution!
Now I have another issue. If I have a cube inside of my particle system, I would like particles behind the cube to be hidden (depth testing does it) but for proper blending I should switch it off. How this can be addressed? It looks like I do need depth testing.

Thanks.

Share this post


Link to post
Share on other sites
Could you explain what is depth writting? I found a solution, by drawing particles first, then I enable depth testing and draw objects. But it is just a solution, I could use in my particular case (I could change the order) But what is it about depth writing, I looked through the commands for glEnable and did not find anything about it. ( what did I miss?)

Thanks!

Share this post


Link to post
Share on other sites
glDepthMask(); had the same effect as disabling depth buffer. It turned out that it was not the solution, because object covers
everything, even what is in front of it. I am surprized that I have this problem on the first place? when I draw two objects one after another I can rotate them anyway I would like and they still will be overlapped properly. So there is something with drawing polygons and putting texture on it. I am reseting rotation of each polygon (manually using modelview matrix), so only translation is presereved.
As I think problem occurs, when I draw particle under another, which was already drawn and so color is not updated correctly. Hmm... but this is controled by depth buffer. Have no idea how to go around.

Any ideas?

Share this post


Link to post
Share on other sites

  • 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!