Spec and Shiny

Hello,

I’ve seen that we have a global ‘shinyness’ parameter and ‘spec maps’ for phong specularity.

Here are three things that I’ve learned through career and studies:
1- artists often provide a ‘shiny map’ (varying shinyness by gray texture)
2- you can either use the phong model for spec (light sources as spec) or environment maps for spec (baked lights from environment)
3- it is possible to provide multiple versions of environment maps - from sharp (for maximum shinyness) to extremely blurred (for low shinyness)

It might just be worth it - at least I would make shiny maps for my models - eyes have high shinyness, metal has medium, wet skin has low shinyness…
To generate a cube environment map and blur it with image manipulation would also be cool - an alternative to the standard way of the phong model.

What do you think?

you mean like the specular map that is in the lighting material?

We have shininess maps, professionals like to call them “specular maps” :wink:
Did you check out the “UseCase Demo 2” video? It explains a lot about amodels, textures and how to handle assets generally.

So, for you shiny and spec are the same?

Doesn’t sound right to me…

If used the latest SDK version, made a material - you can specify a ‘specular map’ (2d texture) and a ‘shiny variable’ (1 value for the whole material).

What I meant is a ‘shinyness map’ - where you have the shinyness defined in a 2d texture, additionally to the specular map 2d texture.

In the basic phong model, you define a specular color and a shiny exponent.

These two are definetly different things:

The specularity shows how much (and in some versions also what color).

The shiny exponent defines how ‘sharp’ (max) or ‘blurred’ (min) the reflected light is.

@Ogli, no I do not think the Lighting material works with a shininess map. But It would be almost trivial to change the shader to use the alpha channel in the specmap to do what you want. Unless that alpha-value is used for something else, I do not remember if it is.

1 Like

Yes, that’s a good idea - at least for non-compressed texture formats.
If I remember correctly, the alpha channel is beeing compressed somewhat different (and more blocky) in some compression algorithms.

Btw. is the specular map an RGB or a grayscale sampler at the moment?

I think that magic word here is ‘gloss’. Specular map controls intensity (or color), gloss map controls sharpness of highlight.

And yes, modifying Lighting.frag to support either explicit gloss map or encoding in alpha specular should be trivial.
Atm, specular map is RGB, so you can encode colors there. Alpha channel is not used, but it is passed around.
Regarding DTX encoding of alpha - generally, you get a same amount of bits for alpha as for all colors together, so it is not that bad. Use DXT5 and you should be happy with results.

<cite>@abies said:</cite> And yes, modifying Lighting.frag to support either explicit gloss map or encoding in alpha specular should be trivial.
Who is the right person to talk to? Who will commit this change, who decides if it will be made or not?
<cite>@abies said:</cite> Atm, specular map is RGB, so you can encode colors there. Alpha channel is not used, but it is passed around.
Hm, okay, but is this really needed? Usually the spec color is the same as diffuse color. Needs two extra channels. But on the other hand, there may be people who make use of that already, and interesting art effects are possible.

And what about the other point that I mentioned?

<cite>@Ogli said:</cite> 3- it is possible to provide multiple versions of environment maps - from sharp (for maximum shinyness) to extremely blurred (for low shinyness)
I saw this in an OpenGL shading language book. Here is a monkey example for what I mean:

That blurriness in that image isn’t confined to the geometry so you would have to use a post effect for that. As for adding it to the engine (whatever you mean exactly), pass over some code and we can test it and add it if its good. I’d suggest using shader nodes for that but they are not in the stable releases yet.

@Ogli said: Who is the right person to talk to? Who will commit this change, who decides if it will be made or not?
I guess that would be @Momoko_Fan or me. Considering the fact that we are "just about to release " (never been so close), for now we won't make any change to the lighting shader. It's very widely used and we don't want to break user code.

But, as Normen said, this will be done through shader nodes, one will be able to “plug in” features into the existing lighting pipeline.
But I get your point, actually, I’m not really satisfied with our lighting model, and i’d like to make something better for the future.
Something that would make artists and developers happy :wink:

<cite>@nehon said:</cite> Considering the fact that we are "just about to release " (never been so close), for now we won't make any change to the lighting shader. But, as Normen said, this will be done through shader nodes, one will be able to "plug in" features into the existing lighting pipeline.
Oh, I totally understand this. Make a stable release, and maybe I'm good enough at jME-speak for the next version. (Means, I'm not ready to help much just now). The plugin system sounds interesting.

Adding gloss maps in the alpha channel of the spec map like discussed above:
Yes, it is very simple to make, and artists use gloss maps, sometimes.
Just it would be good to consider this for some future version.
It might not be that much of a killer feature though :wink: so it can propably wait.

<cite>@normen said:</cite> That blurriness in that image isn't confined to the geometry so you would have to use a post effect for that. As for adding it to the engine (whatever you mean exactly), pass over some code and we can test it and add it if its good. I'd suggest using shader nodes for that but they are not in the stable releases yet.
Puh, how can I explain this better... I will try it: - see the image above as a texture (square shaped texture) - the texture contains six versions of a cube map, so it's really an atlas - cube maps are used for reflective materials - reflective materials are almost the same like specular materials - they reflect the environment (and hence all light sources, like the sun etc.) - for specular maps you have a shiny exponent (or gloss map, see discussion above) - the gloss map defines how sharp the reflections / specular highlights are - the six versions are six versions of differently sharp..blurry cubemaps - depending on the gloss map, the reflective material choses one of these cubemaps - it might even interpolate between two of these cubemaps for inbetween gloss values

I know, for me it sounds simple, but like you said:
Maybe I should write some shaders that show what I mean.
Currently I’m more occupied with game assets, few coding sessions lately.
Currently I’m studying jME3 all the general features to get a grasp of what’s there now.
So, excuse me if, for now, I just dropped these ideas here (the first one is easy, the second one is more complex).
:slight_smile:

I don’t think it would be necessary to add a new map for that but I’m looking forward to your code.

Hi

I don’t suppose this got implemented did it?

FWIW, the alpha-channel option would suit me fine.

I don’t think it was discussed how the gloss (shininess) parameter would/should be mapped to an unsigned byte. Shininess values well in excess of 255 are supported (and in my experience with JME, are required) for very shiny/wet materials.

Thanks

You may be misunderstanding what the shininess values are doing… presuming you are meaning the current material parameter. It only controls the relative size of the specular and not any kind of intensity. The usable range is actually smaller than will fit in a byte as I recall.

Hi

I know what it does and that it is unrelated to brightness/intensity :wink:

There is no (imposed) usable limit, and this material, for example

is using shininess = 850 to get a wet look (I occasionally use higher).

Barney

Hello barney,
what tool did you use to render this cobble stone floor?

Did you know that there is physically based rendering (PBR) which plays with such things as roughness/shininess?
Actually when this thread was made, jME people did not know about this upcoming AAA feature.
Currently, the core dev @nehon is working on PBR for jME.

Hi

We can create it even without PBR
You can create it with setting “Shininess” in “Lighting.j3m” material (in blender it takes values from 1 to 511. [for Phong material] ) and by adding a Normal map (and to get even more you can use Displacement map (Tessellation) .
This is a scene in JME 3.1 : Bump map + Displace map + Shininess = 50

Pretty Wet, isn’t it ? :stuck_out_tongue:

1 Like

Hi. It was rendered with JME3 (using steep parallax, specular map, normal map, fixed shininess = 850).

I don’t know anything about PBR, just resding a little about it, and though it sounds interesting, it doesn’t sound like a solution to having varying roughness on a single material, as in a gloss map.

Anyhow, I’ve implemented this now … there are only 3 files modified (Lighting.j3md, Lighting.frag, SPLighting.frag), and the changes are small.

The mapping from byte to shininess parameter is linear from 0 to 127 (mapped to range 0 to 64), and adds a cubic term for values 128 to 255, such that 255 maps to shininess 1024.

I’m happy of course to contribute these changes, if one of the core devs would be happy to approve and apply them?

Barney

1 Like

Well, nowhere near as wet as the example I posted with shininess 850! I would say your material looks like it rained 30 minutes ago, mine like it is still raining:) The point I was making is that high shininess values (>511) are perfectly valid from an artistic viewpoint.

1 Like