Add reflectivity function to Reflective Shader

Started by WAS, August 23, 2018, 01:52:38 PM

Previous topic - Next topic

WAS

This would be really nice. Currently you have to simply mask the reflective shader, and this seems to cause artifacts on objects unless you mask is perfect for the shader, which defeats your desired looks.

Additionally when using roughness (which is all you got) it tends to "brighten" the reflections too much, and too sensitive to roughness in the maps and create specular dots.

https://planetside.co.uk/forums/index.php/topic,24690.msg253813.html#msg253813
https://planetside.co.uk/forums/index.php/topic,25420.0.html

Matt

If I were to add a reflectivity function it would have the same effect as the mask. The issue you had with the mask is caused by the fractal and how it interacts with the normals of the object (I have replied in that other post just now).

When you increase roughness, the brightness seems to increase because of the larger area. The peak intensity decreases correctly when you increase roughness, but you don't perceive this in a low dynamic range image because the highlights are clipped, so all you see is more bright pixels.

I see what you mean about the sparkly highlights from your displacement (bump), but I don't think this is necessarily an issue with the specular model itself. It's more likely to be a sampling issue (probably needs higher AA to deal with the displacement/bump), but you might be able to mitigate this by increasing specular roughness in the same places where the displacement is rougher.
Just because milk is white doesn't mean that clouds are made of milk.

Matt

I thought the Reflective Shader had a mask input, but it doesn't. So I should probably add either that or a reflectivity function (they will work the same way, so it's mostly a UI/parametrisation decision).
Just because milk is white doesn't mean that clouds are made of milk.

Dune

Mask input would be great, now that you mention it. I had to resort to adding through surface layer, and I mask reflectivity often.

bobbystahr

something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist

WAS

Also, not sure if this can be done, but it would be cool if the reflection shader also had a Horizion Shift. I've been playing water water a lot and sometimes have to "recreate" the reflections since they'd get muddled through merges, but without the Horizon Shift, I can't match water reflections exactly with the addition of rebuilding roughness. (not sure how the water shader makes it's roughness or if there is any?)

Matt

The Water Shader adjusts roughness using extra knowledge that it has about the fractal displacement, wind patches, and distance from camera. It isn't really possible to exactly replicate this when the displacement is separate from the reflection shader.
Just because milk is white doesn't mean that clouds are made of milk.

WAS

#7
Quote from: Matt on September 04, 2018, 04:28:04 PM
The Water Shader adjusts roughness using extra knowledge that it has about the fractal displacement, wind patches, and distance from camera. It isn't really possible to exactly replicate this when the displacement is separate from the reflection shader.

What about the horizon shift bit? That presents some unique advantages to reflection on water displacement peaks. Is that also calculated via internal mechanisms? Or could it be added to normal reflection? We often apply reflection to displaced terrain/objects and I feel it could add to refining reflections to conform to those changes in geometry. With rebuilding water, the horizon shift seems to change how "intense" reflection is in contrast to camera position and light sources, and with a normal reflection layer is just uniform.

Matt

In the Reflective Shader the "horizon shift" is hardcoded to 0.5. But the actual effect varies with the specular roughness, so if you want to adjust this effect you can do it by changing the specular roughness. However, this is as far as it can go. The Water Shader takes it further by modulating the roughness according to (A) the wind patch effect and (B) the size of the waves with respect to the micropolygon size in world space. The Reflective Shader can't do this because it doesn't know anything about the waves.
Just because milk is white doesn't mean that clouds are made of milk.

WAS

Quote from: Matt on September 04, 2018, 08:17:25 PM
In the Reflective Shader the "horizon shift" is hardcoded to 0.5. But the actual effect varies with the specular roughness, so if you want to adjust this effect you can do it by changing the specular roughness. However, this is as far as it can go. The Water Shader takes it further by modulating the roughness according to (A) the wind patch effect and (B) the size of the waves with respect to the micropolygon size in world space. The Reflective Shader can't do this because it doesn't know anything about the waves.

Can't it receive this information from geometry to apply a custom horizon shift? Rather than changing your roughness just to achieve a different horizon modulation? You said it's hard coded, what if it was a slider based on the geometry supplied?

It presents unique reflection modulation which would be nice for other materials.

Matt

Both the Water Shader and the Reflective Shader adjust the horizon shift effect proportionally to the roughness. So what you should do is use the roughness modulator.
Just because milk is white doesn't mean that clouds are made of milk.

Matt

Quote from: WASasquatch on September 04, 2018, 08:48:08 PM
You said it's hard coded, what if it was a slider based on the geometry supplied?

The part that's hardcoded is the part that is constant within a single render anyway, e.g. 0.5. In the Water Shader the only modulation that occurs across the image is roughness modulation, so you can do the same thing by modulating the roughness in the Reflective Shader.
Just because milk is white doesn't mean that clouds are made of milk.

WAS

#12
Quote from: Matt on September 04, 2018, 11:14:37 PM
Quote from: WASasquatch on September 04, 2018, 08:48:08 PM
You said it's hard coded, what if it was a slider based on the geometry supplied?

The part that's hardcoded is the part that is constant within a single render anyway, e.g. 0.5. In the Water Shader the only modulation that occurs across the image is roughness modulation, so you can do the same thing by modulating the roughness in the Reflective Shader.

Sooo, the Horizon Shift, that changes the reflectivity of the Water Shader, is hardcoded at 0.5 anyway? I don't seem to follow. Is Horizon Shift Roughness, or isn't it? Seems to be an entirely different effect applied to water reflection, and vice versa with roughness on the reflection shader.

I'd be interested if you could provide a sphere example between water shader (no waves) and a reflective shader and roughness settings cause I'm at a lost. Seems like different breeds. It seems the Horizon Shift is just as it's name implies, and shifts the horizon light angle of the reflection, see provided image with water and reflection shader mocking each other as close as possible minus horizon shift.

Matt

If horizon shift is at 0.5, both shaders should produce the same result.

I see differences but they could be due to perspective. May need to test with the objects in the same place.
Just because milk is white doesn't mean that clouds are made of milk.

WAS

#14
Quote from: Matt on September 05, 2018, 02:55:11 AM
I see differences but they could be due to perspective. May need to test with the objects in the same place.

Good point. Let me check that. Though I do not remember this being a issue with my shader balls all at different positions and heights.

Yeah with a sphere at 0,0,0 the sun horizon appears to be the same. I also moved the sun over to 270 because I find it odd how the sun, behind-ish the sphere (300), even had a sun spot on the front face.

But like I was saying, you can slide around that Horizon Shift, and change the glows on the sun spot and sphere edges, especially when displacement is involved, and get better results than with just the reflection shader without effecting the roughness. When using the roughness I can't seem to replicate the effects of the Horizon Shift on the sphere.

I'll make a comparison between roughness and horizon shift on a plain sphere.