how set light and materials to obtain an emerald object

Viewed 51

When I set the material in opengl for an object (glutSolidSphere(2.,10.,8.);), let for example the emerald parameters:

 float[] mat_ambient ={ 0.0215f, 0.1745f, 0.0215f, 0.55f };
 float[] mat_diffuse ={0.07568f, 0.61424f, 0.07568f, 0.55f };
 float[] mat_specular ={0.633f, 0.727811f, 0.633f, 0.55f };
 float shine = 76.8f;

In order to obtain really an emerald object I should set the components of light in the same way? I mean:

float[] light_ambient ={ 0.0215f, 0.1745f, 0.0215f, 0.55f };
float[] light_diffuse ={0.07568f, 0.61424f, 0.07568f, 0.55f };
float[] light_specular ={0.633f, 0.727811f, 0.633f, 0.55f };

float[] light_position= { 1.0, 1.0, 1.0, 0.0 };

The result is not good...

1 Answers

If you want to render a green surface with a Blinn–Phong reflection model and Gouraud shading you have found the answer. However, you can't do anything more realistic with the 20-year-old OpenGL Fixed-Function pipeline. Same reason as in the comments on your previous question How can I do a brass surface?.
With Gouraud shading the ligh model is computed per vertex, compared to Phong shadding where it is computed per fragment. Use a higher resolution on the sphere to improve lighting and get some specular highlights. See GLSL fixed function fragment program replacement and What's the difference between Phong shading and Gouraud shading?.

Related