PDA

View Full Version : the transparent object with light



ding
02-23-2002, 02:42 PM
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!

jwatte
02-23-2002, 03:20 PM
Do a search for "blending" and "depth" and "sorting" in the beginner's forum. Or on google.

ding
02-23-2002, 03:49 PM
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!!!

harryx
02-23-2002, 04:11 PM
If you just want a cheesy glass effect then adding a subtle environment map might make things look a little nicer.

richardve
02-24-2002, 12:05 AM
Originally posted by ding:
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!!!



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.

ding
02-25-2002, 04:08 PM
Thank you, my teachers.

I'll try it!!!