Shininess doesn’t work for me (25 posts)

Topic tags: Shininess
  • Profile picture of pengu pengu6p said 5 months, 1 week ago:

    Hello, i`ve tried to implement the Hello Material tutorial and it not work totally correct :( . The setFloat(“Shininess ” float val) method doesn`t work and my rock doesn`t shine. I discussed this problem in the other thread on this forum but it seems like nobody know what is the current version correct implementation for Shininess. So pls how can i make that rock shine ?

    Hello Material tutorial link: http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_material
    The other thread link: http://jmonkeyengine.org/groups/effects/forum/topic/jmonkey-shaders-doesnt-work-for-me/

    The video on the second link doesn`t work anymore.
    Thank you and sorry because I opened two thread for the same problem

  • Profile picture of glaucomardano glaucomardano252p said 5 months, 1 week ago:

    Are you sure you are using the lightning material deffinition?
    Have a try in Material Editor in jmp? You can set the material parameters easily there.

  • Profile picture of normen normen1271p said 5 months, 1 week ago:

    What version are you using?

  • Profile picture of pengu pengu6p said 5 months, 1 week ago:

    The last one.Last upgrade i`ve made was yesterday. And yes, i use the right material. It doesn’t even if i copy paste all the code from Hello Materials tutorial

  • Profile picture of normen normen1271p said 5 months, 1 week ago:

    What is the “last one”? branches/3.0beta (stable) or /trunk (nightly)?

  • Profile picture of pengu pengu6p said 5 months, 1 week ago:

    [ ] jME3_2011-12-06.zip 06-Dec-2011 00:09 81M – for eclipse
    and yesterday i have auto-update the JMonkey IDE

  • Profile picture of pspeed pspeed805p said 5 months, 1 week ago:

    I sort of half remember the default specular color changing at some point.

    Can you try setting the material’s specular color to white and seeing if that fixes the issue?

  • Profile picture of pengu pengu6p said 5 months, 1 week ago:

    I`ve change the mat specular color to white and there is no difference :(

  • Profile picture of pengu pengu6p said 5 months, 1 week ago:

    bingo i`ve solve the problem. I had to add add this lines of code and now work good
    mat_lit.setBoolean(“UseMaterialColors”,true);
    mat_lit.setColor(“Diffuse”, ColorRGBA.White);
    mat_lit.setColor(“Specular”, ColorRGBA.White);

  • Profile picture of pspeed pspeed805p said 5 months, 1 week ago:

    Yeah, so the fix for the fix for the fix that wasn’t a fix for the nvidia problem is the issue.

    We should probably just fix the shader for real this time. :P

  • Profile picture of pengu pengu6p said 5 months, 1 week ago:

    btw i use a ATI

  • Profile picture of pspeed pspeed805p said 5 months, 1 week ago:

    Yeah, this history goes like this if I have it right:
    -default shininess used to be 0 = no shine
    -0 caused problems on nVidia that made weird black areas and other problems
    -a fix was attempted to detect 0 shininess and not do the code that broke nvidia… but it used an “early return” instead of more strict structured programming and so broke certain ATI cards (not just bad visuals but shader would crash).
    -so a default shininess of 1 was introduced but now _everyone_ who had been ignoring shininess suddenly had ugly visuals because their non-shiny things were suddenly really shiny
    -so the default specular was changed to black.

    Personally, I think we should go back to the problem with the “early return” and fix the early return… it was the best overall fix, I think. Though I could be remembering it incorrectly and don’t have time to be fixing shaders myself at the moment.

  • Profile picture of nehon nehon590p said 5 months, 1 week ago:

    He’s right shininess acts weird lately.
    Also changing shininess in the example of his other thread doesn’t seem to have any effect.

  • Profile picture of mifth mifth132p said 5 months, 1 week ago:

    I’m possibly wrong but… I suppose the problem can be in the vertex shader:

       #ifdef MATERIAL_COLORS
          AmbientSum  = (m_Ambient  * g_AmbientLightColor).rgb;
          DiffuseSum  =  m_Diffuse  * lightColor;
          SpecularSum = (m_Specular * lightColor).rgb;
        #else
          AmbientSum  = vec3(0.2, 0.2, 0.2) * g_AmbientLightColor.rgb; // Default: ambient color is dark gray
          DiffuseSum  = lightColor;
          SpecularSum = vec3(0.0);
        #endif

    When SpecularSum = 0, so it becomes nothing. And in the fragment shader:

    vec4 SpecularSum2 = vec4(SpecularSum, 1.0);
    gl_FragColor.rgb =  AmbientSum       * diffuseColor.rgb  +
                               DiffuseSum.rgb   * diffuseColor.rgb  * vec3(light.x) +
                               SpecularSum2.rgb * specularColor.rgb * vec3(light.y);

    So, specular effect becomes 0 in the fragment shader. I would suggest to have always SpecularSum = (m_Specular * lightColor).rgb; .

  • Profile picture of pspeed pspeed805p said 5 months, 1 week ago:

    I think that is again trying to fix the fix of the fix of the fix.

    The issue is that when shininess _must_ be set then you either have to do several steps to turn shininess off or do several steps to turn it on again.

    I think it would be better to fix shininess to work properly. Even your approach doesn’t work if specular has not been set where as the old way you’d get shininess even if you didn’t set specular. You only had to set shininess… which makes more sense to me.