Author Topic: Add reflectivity function to Reflective Shader  (Read 526 times)

Offline WASasquatch

  • Member
  • *
  • Posts: 3089
  • The Homeless Landscape Artist
Add reflectivity function to Reflective Shader
« on: August 23, 2018, 05:52:38 PM »
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
Art can be a window into the soul

Offline Matt

  • Planetside Staff
  • *
  • Posts: 3444
  • I'm the crazy one
Re: Add reflectivity function to Reflective Shader
« Reply #1 on: August 24, 2018, 12:25:36 PM »
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.

Offline Matt

  • Planetside Staff
  • *
  • Posts: 3444
  • I'm the crazy one
Re: Add reflectivity function to Reflective Shader
« Reply #2 on: August 24, 2018, 12:28:06 PM »
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.

Offline Dune

  • Member
  • *
  • Posts: 14831
    • www.ulco-art.nl
Re: Add reflectivity function to Reflective Shader
« Reply #3 on: August 24, 2018, 12:52:30 PM »
Mask input would be great, now that you mention it. I had to resort to adding through surface layer, and I mask reflectivity often.

Offline bobbystahr

  • Member
  • *
  • Posts: 9988
  • Turn, and face the Strange Ch Ch Changes...D Bowie
Re: Add reflectivity function to Reflective Shader
« Reply #4 on: August 26, 2018, 05:37:29 PM »
A big Go For It on the mask!
something borrowed,
something Blue.
Ring out the Old.
Bring in the New

bobbystahr

Offline WASasquatch

  • Member
  • *
  • Posts: 3089
  • The Homeless Landscape Artist
Re: Add reflectivity function to Reflective Shader
« Reply #5 on: September 03, 2018, 05:18:51 PM »
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?)
Art can be a window into the soul

Offline Matt

  • Planetside Staff
  • *
  • Posts: 3444
  • I'm the crazy one
Re: Add reflectivity function to Reflective Shader
« Reply #6 on: September 04, 2018, 08: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.
Just because milk is white doesn't mean that clouds are made of milk.

Offline WASasquatch

  • Member
  • *
  • Posts: 3089
  • The Homeless Landscape Artist
Re: Add reflectivity function to Reflective Shader
« Reply #7 on: September 04, 2018, 09:02:27 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.
« Last Edit: September 04, 2018, 09:04:00 PM by WASasquatch »
Art can be a window into the soul

Offline Matt

  • Planetside Staff
  • *
  • Posts: 3444
  • I'm the crazy one
Re: Add reflectivity function to Reflective Shader
« Reply #8 on: September 05, 2018, 12:17:25 AM »
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.

Offline WASasquatch

  • Member
  • *
  • Posts: 3089
  • The Homeless Landscape Artist
Re: Add reflectivity function to Reflective Shader
« Reply #9 on: September 05, 2018, 12:48:08 AM »
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.
Art can be a window into the soul

Offline Matt

  • Planetside Staff
  • *
  • Posts: 3444
  • I'm the crazy one
Re: Add reflectivity function to Reflective Shader
« Reply #10 on: September 05, 2018, 03:07:06 AM »
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.

Offline Matt

  • Planetside Staff
  • *
  • Posts: 3444
  • I'm the crazy one
Re: Add reflectivity function to Reflective Shader
« Reply #11 on: September 05, 2018, 03:14:37 AM »
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.

Offline WASasquatch

  • Member
  • *
  • Posts: 3089
  • The Homeless Landscape Artist
Re: Add reflectivity function to Reflective Shader
« Reply #12 on: September 05, 2018, 04:25:20 AM »
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.
« Last Edit: September 05, 2018, 04:32:50 AM by WASasquatch »
Art can be a window into the soul

Offline Matt

  • Planetside Staff
  • *
  • Posts: 3444
  • I'm the crazy one
Re: Add reflectivity function to Reflective Shader
« Reply #13 on: September 05, 2018, 06:55:11 AM »
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.

Offline WASasquatch

  • Member
  • *
  • Posts: 3089
  • The Homeless Landscape Artist
Re: Add reflectivity function to Reflective Shader
« Reply #14 on: September 05, 2018, 05:15:08 PM »
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.
« Last Edit: September 05, 2018, 05:55:30 PM by WASasquatch »
Art can be a window into the soul

 

anything