the transparent object with light

Hi,

I have drawed transparent objects using alpha3D.c in redbook with light,however, the result is not good. I want the transparent object like glass in order to see the opaque object inside the transparent object.

How can I do?

thanks!

Do a search for “blending” and “depth” and “sorting” in the beginner’s forum. Or on google.

Hi,jwatte
I have called glEnable (GL_BLEND);glDepthMask (GL_FALSE);glBlendFunc (GL_SRC_ALPHA, GL_ONE);before drawing the transparent object,and sorted the objects,or drawing the opaque object first,then transparent objects.
I have seen the transparent objects. I want the result looked better like glass,not only transparent.
How can I improve my program?

thank you very much!!!

If you just want a cheesy glass effect then adding a subtle environment map might make things look a little nicer.

Originally posted by ding:
[b]Hi,jwatte
I have called glEnable (GL_BLEND);glDepthMask (GL_FALSE);glBlendFunc (GL_SRC_ALPHA, GL_ONE);before drawing the transparent object,and sorted the objects,or drawing the opaque object first,then transparent objects.
I have seen the transparent objects. I want the result looked better like glass,not only transparent.
How can I improve my program?

thank you very much!!!

[/b]

It sounds like you expect glass to be rendered by OpenGL just like a raytracer does…

Unfortunately, OpenGL (and every other realtime 3D API) is not a raytracer so if you want your objects to be made of glass you should not only make it translucent.

To create glass you’ll need to add at least an environment or cube map, like said before, but than it still won’t look like glass because there’s no refraction, and some things which are to expensive to compute in realtime.

Anyway, there are some examples of how to create glass-like objects in the NVSDK from NVIDIA so if you really want your objects to look more like glass I’d recommend you to check that out.

Thank you, my teachers.

I’ll try it!!!