how to get metal or steel effect in OpenGL?

i have changed material and light settings, but the effect is not good.
is there a way to get metal effect in opengl?

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

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.

3ks,i will try it later

i want polished steel effect.
i have googled it, it is said texture should be added to achieve the effect. is it true?

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…

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

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.

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

thank you
sincerely

If you’re interested in rendering metals with a realistic appearance, you should definitely check out this SIGGRAPH 2010 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.

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.