Shininess doesn't work for me

Hello, ive tried to implement the Hello Material tutorial and it not work totally correct :( . The setFloat("Shininess " float val) method doesnt work and my rock doesnt 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 ?<br /> <br /> Hello Material tutorial link: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_material<br /> The other thread link: http://hub.jmonkeyengine.org/groups/effects/forum/topic/jmonkey-shaders-doesnt-work-for-me/<br /> <br /> The video on the second link doesnt work anymore.

Thank you and sorry because I opened two thread for the same problem

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.

What version are you using?

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

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

[ ] jME3_2011-12-06.zip 06-Dec-2011 00:09 81M - for eclipse

and yesterday i have auto-update the JMonkey IDE

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?

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

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

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. :stuck_out_tongue:

btw i use a ATI

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.

He’s right shininess acts weird lately.

Also changing shininess in the example of his other thread doesn’t seem to have any effect.

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



[java] #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[/java]



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

[java]

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);[/java]



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

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.

@Momoko_Fan it’s time for a “revamp shininess” thing! :smiley:

Personally, I say we go back to where it was when there was some kind of “early return” error on ATI cards and fix that.

in other hand i have question i never resolved.



why its if i give Shininess 0.9f it look the same as Shininess 0.1. but Shininess 1.0f / 2.0f / etc have diffrences



so why it is in float?



Second question:



for Shininess 1.0f AND Directional light strength 1 white and Ambient light strong 1 White

in some places it look ok:

http://i.imgur.com/ixCiA.png

but in other places…

http://i.imgur.com/TGTCO.png



WHY space between rocks is black in second image?



there are sooooo many light… but this places are black o.o

Are you using a bloom filter?

yes… but how it would be possible that bloom create this black places? o.o



you mean that bloom dont effect on dark places and it look like that?



edit: i tested without bloom, off couse less shiny, but still black places between rocks and shiny rocks



edit 2:

i need check some things