Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make the lighting in OpenGL more visually pleasant?
    primarykey
    data
    text
    <p>I need a rendering platform to show the result of my mesh processing algorithm, it's quite basic and easy, I've had it done, except that the default lighting from OpenGL is a little weird.</p> <p>My rendering result is like:</p> <p><img src="https://i.stack.imgur.com/7iY7d.png" alt="stanford bunny"></p> <p>And the lighting parameter in OpenGL is like:</p> <pre><code> // Lights properties float ambientProperties[] = {0.4f, 0.4f, 0.4f, 1.0f}; float diffuseProperties[] = {0.8f, 0.8f, 0.8f, 1.0f}; float specularProperties[] = {1.0f, 1.0f, 1.0f, 1.0f}; float lightPosition[] = {0.2f, -0.3f, -0.3f, 0.0f}; glLightfv(GL_LIGHT0, GL_AMBIENT, ambientProperties); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseProperties); glLightfv(GL_LIGHT0, GL_SPECULAR, specularProperties); glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, 1.0); glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); // Material Properties float MatAmbient[] = {0.3f, 0.3f, 0.3f, 1.0f}; float MatDiffuse[] = {0.7f, 0.7f, 0.7f, 1.0f}; float MatSpecular[] = {0.8f, 0.8f, 0.8, 1.0f}; float MatShininess[] = { 64 }; float MatEmission[] = {0.0f, 0.0f, 0.0f, 1.0f}; glMaterialfv(GL_FRONT, GL_AMBIENT, MatAmbient); glMaterialfv(GL_FRONT, GL_DIFFUSE, MatDiffuse); glMaterialfv(GL_FRONT, GL_SPECULAR, MatSpecular); glMaterialfv(GL_FRONT, GL_SHININESS, MatShininess); glMaterialfv(GL_FRONT, GL_EMISSION, MatEmission); </code></pre> <p>What I want is something like this:</p> <p><a href="http://iparla.inria.fr/publications/2007/BS07b/sketch_teaser.jpg" rel="nofollow noreferrer">hand http://iparla.inria.fr/publications/2007/BS07b/sketch_teaser.jpg</a></p> <p>I've changed the full resolution version of mine rendering results to vertex normal and added a simplified version, to make the comparison more convincing. We can see that the latter ones are apparently more vividly lighted, ignoring the color. </p> <p>Can the default OpenGL lighting be parameter-tuned like the results that I want?? Or how can I retrieve codes for some high-quality GLSL shaders for lighting?? I'm only new to graphics rendering, and I think such a lighting routines is not rare.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload