Sign in to follow this  
Medo Mex

Problem with Transparency

Recommended Posts

Medo Mex    891

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?


Share this post

Link to post
Share on other sites
Tom KQT    1704

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

Share this post

Link to post
Share on other sites
ongamex92    3255

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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this