Phong Shader for JME2

Hello,

I am looking for a way to implement Phong-Shading in my JME2 project.

Is there any package or "HowTo" for JME2 available?



Thank you for your time and help :slight_smile:

phong shading is the default shading no?



You can use flat or phong shading by setting a ShadeState:


    ShadeState sd = display.getRenderer().createShadeState();
    sd.setShadeMode(ShadeMode.Smooth);
    object.setRenderState(sd);


Core-Dump said:

phong shading is the default shading no?

You can use flat or phong shading by setting a ShadeState:


    ShadeState sd = display.getRenderer().createShadeState();
    sd.setShadeMode(ShadeMode.Smooth);
    object.setRenderState(sd);





Isnt that Gouraud-Shading?


Gouraud Shading



    * This is the most common approach

          o Perform Phong lighting at the vertices

          o Linearly interpolate the resulting colors over faces

          o This is what OpenGL does









Phong Shading



    * Phong shading is not the same as Phong lighting, though they are sometimes mixed up

          o Phong lighting: the empirical model used to calculate illumination at a point on a surface

          o Phong shading: linearly interpolating the surface normal across the facet, applying the Phong lighting model at every pixel





As far as implementing a shader, i dunno…

doh yes your right, smooth shading is Gouraud shading (says the red book).



If you want another shading method, you can create your own shader.

Look at TestNormalmap on how to use GLSLShaderObjectsState to load glsl shaders.