Jump to content

  • Log In with Google      Sign In   
  • Create Account


Glass Effect and material color


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 BboyMasa   Members   -  Reputation: 100

Like
0Likes
Like

Posted 25 July 2011 - 03:38 PM

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.

Schermata 2011-07-21 a 22.36.21.png

Sponsor:

#2 zrtyzrcx   Members   -  Reputation: 122

Like
0Likes
Like

Posted 25 July 2011 - 05:49 PM

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.

#3 BboyMasa   Members   -  Reputation: 100

Like
0Likes
Like

Posted 26 July 2011 - 01:33 PM

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!

#4 carangil   Members   -  Reputation: 489

Like
0Likes
Like

Posted 26 July 2011 - 02:04 PM

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.

#5 BboyMasa   Members   -  Reputation: 100

Like
0Likes
Like

Posted 26 July 2011 - 02:44 PM

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...




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS