PDA

View Full Version : how to get metal or steel effect in OpenGL?



flypig
11-21-2011, 08:54 PM
i have changed material and light settings, but the effect is not good.
is there a way to get metal effect in opengl?

Lefteris
11-21-2011, 09:20 PM
Hello, it depends a lot on your lighting code/shader.

Assuming they are correct here is a page with sample material values to imitate various materials (including some metals)

http://www.opengl.org/resources/code/samples/sig99/advanced99/notes/node153.html

Alfonse Reinheart
11-21-2011, 09:29 PM
is there a way to get metal effect in opengl?

There is no such thing as a "metal effect". There are many lighting models and surface parameters that can simulate the many, many kinds of metals. But there is no catch-all "metal effect" that you can just switch on.

What kind of metal surface are you trying to show? Is it smooth and polished? Is it rough? How is it rough; is its roughness fairly uniform or patchy? Is it painted metal or bare metal? And so on.

flypig
11-21-2011, 10:05 PM
3ks,i will try it later

flypig
11-21-2011, 10:11 PM
i want polished steel effect.
i have googled it, it is said texture should be added to achieve the effect. is it true?

flypig
11-21-2011, 11:12 PM
thanks for your link
i want polished steel effect and i have tried with different material Parameters, unfortunatly the effect is not good. i think it is hard to achieve only by setting material parameters. light and texture must be added, but how to add......


Hello, it depends a lot on your lighting code/shader.

Assuming they are correct here is a page with sample material values to imitate various materials (including some metals)

http://www.opengl.org/resources/code/samples/sig99/advanced99/notes/node153.html

Lefteris
11-21-2011, 11:30 PM
Well from your replies it seems you really are not very familiar with openGL at all.

Of course in order to get the effect out of material parameters you will need lighting. Material parameters just define how your model will react to lighting calculations. With no light you will not be able to see nothing, just as if you were inside a pitch black room full of gold, silver and bronze coins you would see none of it.

So I would recommend reading some tutorials first. Are you aware of what is openGL fixed functionality? What is the major difference in programming openGL that version 2.0 introduced? If not just go with nehe's tutorials and start building up from there to see what is what.

http://nehe.gamedev.net/

Just use google. A good openGL lighting tutorial that explains what light is can be found here:
http://www.falloutsoftware.com/tutorials/gl/gl8.htm

flypig
11-22-2011, 12:37 AM
my poor English prevent me from communicating with you guys...
the effect desired is like this picture:(i think quite few people can achieve the effect, this could require good learning of material,light, texture, and need many practice, but i am not good at opengl:( )
in fact i have used opengl several years, and know fundamental and extension of opengl. google is used every day many many times although it is often been blocked. gamedev is a good site but i can not visit it because the website include "game". what a tragedy!
also i found some pdf on the network, but it seems quite complex(say, using Anisotropic Light Texture), so i came here for help and simpler way.


Well from your replies it seems you really are not very familiar with openGL at all.

Of course in order to get the effect out of material parameters you will need lighting. Material parameters just define how your model will react to lighting calculations. With no light you will not be able to see nothing, just as if you were inside a pitch black room full of gold, silver and bronze coins you would see none of it.

So I would recommend reading some tutorials first. Are you aware of what is openGL fixed functionality? What is the major difference in programming openGL that version 2.0 introduced? If not just go with nehe's tutorials and start building up from there to see what is what.

http://nehe.gamedev.net/

Just use google. A good openGL lighting tutorial that explains what light is can be found here:
http://www.falloutsoftware.com/tutorials/gl/gl8.htm

remdul
11-22-2011, 01:45 AM
You can achieve something similar in two ways, environment map reflection using cubemap. Look up any cubemap or 'envmap' tutorial and it should get you on the way.

It is also possible to do something similar using eye space texture projection and a normal texture (no cube map).

flypig
11-22-2011, 02:26 AM
thank you
sincerely

You can achieve something similar in two ways, environment map reflection using cubemap. Look up any cubemap or 'envmap' tutorial and it should get you on the way.

It is also possible to do something similar using eye space texture projection and a normal texture (no cube map).

Dark Photon
11-22-2011, 05:39 AM
i want polished steel effect.
If you're interested in rendering metals with a realistic appearance, you should definitely check out this SIGGRAPH 2010 course:

* Physically-Based Shading Models in Film and Game Production (SIGGRAPH 2010) (http://renderwonk.com/publications/s2010-shading-course/)

If you do nothing else, browse Naty's Background/Intro talk. In particular, slides 31-32, 55-61. A characteristic of metals is their high Fresnel Reflectance. If you write your own shaders to do your own lighting/shading, you can incorporate this.

Legacy OpenGL's lighting and material model doesn't have anything like this in it. Consequently, the legacy pipe excels at producing good plastics (low fresnel reflectance), but not metals.

Also be sure to browse Naty's 2nd talk in that course. The others are worthwhile too. If you're in a real hurry, search for metal.

You'll also want to gather light from reflected directions when rendering the metal to give it that "shiny" look. Others have already mentioned this. Naty does as well in the 2nd talk.

tksuoran
11-22-2011, 07:52 AM
If you are stuck to legacy OpenGL, you practically guarantee plastic look by using white specular material color - so try to avoid that. Setting specular color to same as diffuse is better approximation for metals. Of course if your material color is gray then there is not much you can do about that.