Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Problem with Transparency


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Medo3337   Members   -  Reputation: 672

Like
0Likes
Like

Posted 07 September 2013 - 10:19 AM

When I render transparent object and the terrain is at the background, I see the sky instead of the terrain.

 

Which make it appear like the terrain doesn't exists behind the transparent object.

 

What's going wrong?

a.png



Sponsor:

#2 Tom KQT   Members   -  Reputation: 1610

Like
3Likes
Like

Posted 07 September 2013 - 11:16 AM

You probably aren't drawing the terrain before the transparent objects. The right rendering order is like:

1. All opaque objects (in whichever order)

2. All transparent objects (sorted - furthest first, closest last)

 

When you are rendering a transparent object, the backbuffer already has to contain all objects that are behind the transparent one and that can be seen through it. Only this way the blending can work properly.


Edited by Tom KQT, 07 September 2013 - 12:45 PM.


#3 cozzie   Members   -  Reputation: 1654

Like
0Likes
Like

Posted 07 September 2013 - 05:20 PM

Also keep in mind the order of drawing your skybox and how the Z buffer is set at these moments

#4 imoogiBG   Members   -  Reputation: 1219

Like
0Likes
Like

Posted 08 September 2013 - 06:53 AM

Drawing order (in regular* alpha blendig) is really important. What alpha bending operations to is that thay simply gets the current color value of the buffer and the transperant surface color values. After that those values are processed with the operation defined by you. There is a technique called orderless(or independant) alpha blending but it is a bit more advanced topic. So this is what you want to do to get accurate blending;

 

1. Draw all solid objects

2. Sort all all surfaces with transperancy by dist. from camera.

3. Draw those surcafes starting from the most distant surface from the camera.

 

Well here the most hardest thing is the sorting. It really depends on your scene. 

 

Hope that will help.

 

Sry for by bad English.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS