Glass Effect and material color

Started by
3 comments, last by BboyMasa 12 years, 8 months ago
Hello, I'm a beginner with opengl, I'm making a plasma sphere in opengl, i have a problem with a glass effect...i don't understand how i can have that effect, I suppose that I must work on material illumination property, but I don't know how it is possible because haven't idea how I can edit this parameter in opengl...Can you explain me how i must use to have this effect?

My second question is why when I insert a texture materials colors change and I can't have the effect that I want.

I attach a image of my sphere.

I want to have the glass effect on trasparent sphere. (I used alpha blending to do it);

If you need I can insert my code. To make all object I used quadric with glu (also to map the texture I used gluQuadricTexture, but background is inserted normally with texture position on screen position).

I use OpenGL with C programming language.

[attachment=4466:Schermata 2011-07-21 a 22.36.21.png]
Advertisement
Good glass effect is hardly to implement with only using the OpenGL fixed function.
One better way is that you may use opengl shading language combine fixed function for your good glass effect.

If you only know how to use fixed function you can use material of color for your glass module. But this effect is not enough good.
Any hint to implement a pseudo-glass effect with material color? I want to have effect light on my sphere like a glass and can I have alpha blending on sphere to view rear sphere...With my known of fixed function I don't really now how can I get this pseudo-effect :) Any guide? Thanks!
To simulate glass, you need to fake two effects: reflection and refraction

Reflection: Look into sphere or cube maps. You can do this in fixed function, and it doesn't look horrible.

Refraction: Refraction is all-but-impossible with fixed function. This page has some tips: http://www.opengl.or...es/node155.html (Also, notice the date on the page. It's old; no one really does it this way anymore, thanks to shaders.)

Simulating refraction will basically come down to rendering the whole scene (minus the glass ball) to a texture, and then mapping that texture onto the glass ball, giving the impression that the ball has distorted the image behind it.

But.. keep in mind trying to fake it without shaders is a lot of work. You really owe it to yourself to experiment with shaders. You don't even have to tackle fragment shaders; you can get pretty cool results with just vertex shaders. Even with shaders, the effect will probably be done very similarly.
Ok I 'll read opengl documents and I'll tell you if I have some results :) Thanks thanks thanks...But I have another question...Why color of ray in the sphere aren't how I want it? Ray are striped lines and I used glcolormaterial because glcolor doesn't work...But this error come only when I add textures...

This topic is closed to new replies.

Advertisement