PDA

View Full Version : Glittering effect in opengl



abhinav_80
07-31-2002, 09:26 PM
How to achieve glittering effect in opengl ??

JimmyT
07-31-2002, 11:58 PM
like fairy dust?

pocketmoon
08-01-2002, 01:05 AM
Interesting effect. I was thinking about this one a while ago. The line of thinking I had was something like this:

Glittering is created by many tiny reflective facets across a surface. The glitter is where the light falling on the microfacets gets reflected straight back to the viewer. Your basically getting a specular effect.

So what you need is a normal map for your glittering surface with lots of random normals (within a limited range) and have high power specular lighting.

But you don't want these normals interpolated per pixel, as you would with bump mapping. Turning off filtering for your normal map texture should give the desired effect. Hmm I feel a demo comming on, unless Nutty beats me to it.

Of course you could also apply some post-processing to make the glitter produce glare as well http://www.opengl.org/discussion_boards/ubb/smile.gif

abhinav_80
08-01-2002, 01:11 AM
I mean "achieving sparkling effects like jewellery " in Opengl

Originally posted by JimmyT:
like fairy dust?

pocketmoon
08-01-2002, 01:25 AM
Originally posted by abhinav_80:
I mean "achieving sparkling effects like jewellery " in Opengl


Same thing really. The physical effect is specular. Fairy dust (the stuff I have anyway) is lots of tiny magical particles which have strong specular properties. If I throw a handfull into air, they sparkle and glitter as the falling motes rotate move through the light.

Reflection from a jewel is just the same (lets ignore refraction shall we!). Your seeing specular reflection off of the flat shiny surfaces of the jewel.

I think the glitter effect is when you far enough away from a multi-faceted surface that the speculat highlight become dense in your view. A diamond close up wont glitter, but a few feet away it might.




[This message has been edited by pocketmoon (edited 08-01-2002).]

dorbie
08-01-2002, 01:59 AM
For sparkle on jewelry you probably want a high dynamic range environment map, some flare using readback (like Nutty's glare stuff) and some highlights with a kind of apperture refraction (starburst effect) in a few places, this would be like lens flare only positioned on highlights and a starburst pattern. The glittering comes from the reflections, in this case form the environment map as it gets applied differently on the discrete facets of the cut jewel. In a real cut gemstone there are internal reflections that supply even more discrete highlights from all the possible paths inside the gem but I doubt you could render this well without a great deal of effort.

If I had to emulate this I might environment map the gem, with a high dynamic range image then apply verious additonal passes of faceted environment maps over the gem in multipass at different brightnesses to kinda simulate internal reflection, I don't know if it would look OK though.