Planetside Software Forums

Support => Terragen Support => Topic started by: WASasquatch on August 23, 2018, 05:52:38 PM

Title: Add reflectivity function to Reflective Shader
Post by: WASasquatch 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
Title: Re: Add reflectivity function to Reflective Shader
Post by: Matt 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.
Title: Re: Add reflectivity function to Reflective Shader
Post by: Matt 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).
Title: Re: Add reflectivity function to Reflective Shader
Post by: Dune 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.
Title: Re: Add reflectivity function to Reflective Shader
Post by: bobbystahr on August 26, 2018, 05:37:29 PM
A big Go For It on the mask!
Title: Re: Add reflectivity function to Reflective Shader
Post by: WASasquatch 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?)
Title: Re: Add reflectivity function to Reflective Shader
Post by: Matt 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.
Title: Re: Add reflectivity function to Reflective Shader
Post by: WASasquatch 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.
Title: Re: Add reflectivity function to Reflective Shader
Post by: Matt 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.
Title: Re: Add reflectivity function to Reflective Shader
Post by: WASasquatch 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.
Title: Re: Add reflectivity function to Reflective Shader
Post by: Matt 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.
Title: Re: Add reflectivity function to Reflective Shader
Post by: Matt 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.
Title: Re: Add reflectivity function to Reflective Shader
Post by: WASasquatch 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.
Title: Re: Add reflectivity function to Reflective Shader
Post by: Matt 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.
Title: Re: Add reflectivity function to Reflective Shader
Post by: WASasquatch 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.
Title: Re: Add reflectivity function to Reflective Shader
Post by: WASasquatch on September 05, 2018, 06:05:46 PM
Here is a comparison between HS 0.5 and 1.5 and roughness of 1.5, which produces the horizon shift of 1.5, but also applies roughness which changes your specular. :( :'(

I am using a constant colour for the roughness to try and get as accurate results as possible. Lowering the settings of the constant colour start to change the Horizon Shift like the slider does, but also the specular roughness.

The Gif quality makes it a little hard to see the actual horizon shift of the sun glow but if you look closely you can see 1.5 shifts this glow to the "left"
Title: Re: Add reflectivity function to Reflective Shader
Post by: Matt on September 05, 2018, 08:45:33 PM
Do you think the horizon shift 1.5 looks better than 0.5?
Title: Re: Add reflectivity function to Reflective Shader
Post by: WASasquatch on September 05, 2018, 08:48:58 PM
Do you think the horizon shift 1.5 looks better than 0.5?

It depends on the material I'm creating. I use a lot of reference images and try to mimic what I see a lot. It creates subtle differences that work towards creating realistic reflections of different materials.

For example I have a new gold I'm working on that uses a Water Shader for base Ray Trace Reflections and Horizon Shift, and a secondary reflection shader without ray tracing, and specular enabled, and merged together for the control I am looking for.

The differences may not look drastic, but neither is a 1.21 Index of Refraction vs 1.33, but when comparing to realistic results of materials, it makes a difference in realism. It just seems like added control to the reflection shader that should be there from the get go, as I like the results it can provide when changing things about.
Title: Re: Add reflectivity function to Reflective Shader
Post by: Matt on September 05, 2018, 08:49:40 PM
Fair enough. I should point out that horizon shift is a complete hack that I'm trying to leave behind once we start using more physically based rendering of glossy reflections. I don't really want to expose it in any more shaders than the Water Shader.
Title: Re: Add reflectivity function to Reflective Shader
Post by: WASasquatch on September 05, 2018, 08:52:10 PM
Fair enough. I should point out that horizon shift is a complete hack that I'm trying to leave behind once we start using more physically based rendering of glossy reflections. I don't really want to expose it in any more shaders than the Water Shader.

A hack it may be, but we have many materials in real life that create results like through microscopic details plus surface materials, such as actual glosses over a surface which add refraction of light which can be simulated with horizon shift.

Without this feature, reflections won't truly be customizable to some real-world expectations.
Title: Re: Add reflectivity function to Reflective Shader
Post by: Matt on September 05, 2018, 08:53:02 PM
Horizon shift will be completely ignored by the path tracer (coming soon), as it should do the job of handling that correctly for you.
Title: Re: Add reflectivity function to Reflective Shader
Post by: Matt on September 05, 2018, 08:55:38 PM
In any case, a value greater than 1 is just not realistic in any scenario I can see. Any situation where it would need to be higher than that, the specular highlight *should* be larger, which is why it's intrinsically tied to the roughness parameter.

But I would love to see real world examples.
Title: Re: Add reflectivity function to Reflective Shader
Post by: WASasquatch on September 05, 2018, 08:56:48 PM
Horizon shift will be completely ignored by the path tracer (coming soon), as it should do the job of handling that correctly for you.

Which I am excited about. Will we have any previews in the future? Would love to see some comparison shots of what's going on in dev.
Title: Re: Add reflectivity function to Reflective Shader
Post by: Matt on September 05, 2018, 08:58:41 PM
Coming soon :)
Title: Re: Add reflectivity function to Reflective Shader
Post by: WASasquatch on September 07, 2018, 04:18:23 AM
Here is a instance where the Horizon Shift would have been promptly advantageous. here I would like to have sand reflections, but not just specular highlights in the form of dots, but also a spread field of ambient definition. However, when using roughness for the specular highlight dots, this changes the horizon shift as you explained, while the ambient specular has no horizon shift, and thus they do not match up and have a visible offset. Changing the ambient with a constant or PF changes my desired look and isn't a fix. An unfortunate realism-killer.