Transparency

Dear friends,

I have to render a model of a building which contains transparent windows and translucent glass inside the building.
When I use the blend function, it makes the windows and glass completey transparent.
Is there any way, so that I can render transparent windows and translucent glass simantaneously.

When drawing multiple layers of transparency, which is what I think you want to do, you need to think about the drawing order and your depth sorting. You will also perhaps need to think about the alpha blending values you assign to colours and/or textures to get various effects.

If you draw the windows of the building first and then the glass inside if you are using depth masking the internal glass will not be drawn as it is behind the windows of the building and as far as OpenGL is concerned (wrt to depth functions) all polygons are opaque.

This may be of help…
http://www.opengl.org/resources/faq/technical/transparency.htm

After that you then perhaps need to think about reflections of environments to give the effect of glass and that opens a whole pandoras box of either environment maps and / or shaders for getting reflections and refractions.

I am not sure if you want to go quite that far for this, but let me know if you do and I can post some other links.

Thanks for the reply.

The whole building is a mesh in obj format and I can’t detect which part is drawn first. Even I am not using Depth Masking, the internal glass is not drawn or drawn completely transparent.

Well to get things to work you are going to have to split out the various parts that make up different layers in the mesh.

Unfortunately these kind of effects are not that simple to achieve without a bit of work on your end to draw the model in stages with different settings.

I have not used OBJ files much, but it seems to me from this…

http://www.royriggs.com/obj.html

…that if the model is made in “parts” you should be able to easily identify them.

If you can load it in an editor and see the different parts / materials etc. then you should be able to split those out into different parts either procedurally, or by hand as OBJ is a text format.