Planetside Software Forums

Support => Terragen Support => Topic started by: WAS on July 19, 2020, 01:15:44 AM

Title: Hard Shadows on Plane Glass Shader PT
Post by: WAS on July 19, 2020, 01:15:44 AM
When using the glass shader with a plane with high density the shadows are all broken up and hard as seen here: https://planetside.co.uk/forums/index.php/topic,28084.msg279486.html#msg279486

Not sure what's up with that.

Example basic snow settings:

<terragen_clip>
 <plane
name = "Plane 01"
gui_use_node_pos = "1"
gui_node_pos = "-1720 -360 0"
gui_group = ""
enable = "1"
visible_to_camera = "1"
visibility = "2"
visible_to_other_rays = "1"
cast_shadows = "1"
center = "0 0 0"
length_a = "1000"
length_b = "1000"
edge_vector_a = "1 0 0"
edge_vector_b = "0 0 1"
surface_shader = "Glass shader 01"
displacement_tolerance = "1"
render_method = "0"
sorting_bias = "0"
>
<default_shader
name = "Default shader 01"
gui_use_node_pos = "1"
gui_node_pos = "-1240 -240 0"
gui_group = ""
enable = "1"
input_node = ""
gui_use_preview_patch_size = "0"
gui_preview_patch_size = "1000 1000"
diffuse_colour = "0.5 0.5 0.5"
colour_image = ""
colour_function = ""
translucency = "0 0 0"
translucency_image = ""
translucency_function = ""
luminosity = "0 0 0"
luminosity_image = ""
luminosity_function = ""
reflectivity = "0 0 0"
reflectivity_image = ""
reflectivity_function = ""
reflection_tint = "1 1 1"
index_of_refraction = "1.5"
specular_roughness = "0.2"
specular_roughness_image = ""
invert_specular_roughness_image = "0"
specular_roughness_function = ""
displacement_direction = "1"
displacement_multiplier = "0.01"
displacement_image = ""
displacement_function = ""
displacement_offset = "0"
opacity = "1 1 1"
opacity_image = ""
use_alpha_channel = "0"
invert_opacity_image = "0"
opacity_function = ""
alpha_from_colour = "0"
alpha_key = "0 0 0"
key_tolerance = "0.1"
image_projection = "4"
projection_camera = ""
unpremultiply_colour = "0"
unpremultiply_translucency = "0"
unpremultiply_luminosity = "0"
unpremultiply_reflectivity = "0"
unpremultiply_specular_roughness = "0"
>
</default_shader>
</plane>
<glass_shader
name = "Glass shader 01"
gui_use_node_pos = "1"
gui_node_pos = "-1720 -300 0"
gui_group = ""
enable = "1"
input_node = ""
gui_use_preview_patch_size = "0"
gui_preview_patch_size = "1000 1000"
double-sided_surface = "0"
reflectivity = "0.25 0.25 0.25"
reflection_tint = "1 1 1"
transparency = "1 1 1"
index_of_refraction = "1.5"
highlight_intensity = "1"
caustic_intensity = "1"
specular_roughness = "1"
specular_roughness_function = ""
decay_distance = "0.15"
decay_tint = "0.4478999972 0.7893000245 1"
volume_1_density = "10"
volume_1_colour = "1 1 1"
volume_1_density_function = ""
volume_1_colour_function = ""
volume_1_colour_is_volumetric = "1"
volume_method_in_path_tracer = "0"
>
</glass_shader>
</terragen_clip>
Title: Re: Hard Shadows on Plane Glass Shader PT
Post by: N-drju on July 19, 2020, 05:01:49 AM
I'm afraid native objects just do have some screws loose. An equally puzzling thing happened to me, back in the days:

https://planetside.co.uk/forums/index.php/topic,27445.0.html
Title: Re: Hard Shadows on Plane Glass Shader PT
Post by: WAS on July 19, 2020, 01:12:33 PM
That's more just initially what I thought it was, just the cubes shadow. To me it makes perfect sense that would happen, and the shadows here aren't being cast on another surface but itself. It's only a issue with PT and subsurface scattering.
Title: Re: Hard Shadows on Plane Glass Shader PT
Post by: Matt on July 20, 2020, 01:45:03 PM
I'll see what I can do to improve this. If the subsurface media is very dense, for displaceable objects you should try to use a different shader that has a non-scattering subsurface (e.g. Default Shader).

At the moment (v4.5), displaceable objects with displacement create difficulties for the subsurface effects in the Glass Shader and Water Shader, and there are situations where it doesn't work well, depending on the render method, scale of the displacement and the ratio of micropolygon size to the scattering distance.


In the Standard renderer (as of v4.5)

The subsurface volume is trying to approximate a subsurface scattering effect without actually scattering the light, but this only works when the conditions are right. In order to appear soft and maintain the illusion of scattering when the the surface is displaced, it ignores the displaced normal and uses the undisplaced surface normal for illumination. Unfortunately this means it doesn't look right for dense media (or displacement that's large relative to the scattering distance). This render mode also relies on the object to have shadows disabled if you want the parts facing away from the light to receive light (as in the default Lake setup).

In some situations this would look better if it used the displaced normal so I might add that option in future.


In the Path Tracer (as of v4.5)

"Hard surface approximation": This has some of the same limitations as the Standard Renderer (i.e. choice of surface normal). Perhaps I should add an option to choose which surface normal to use.

"Subsurface scatter towards normal" and "Subsurface scatter in all directions": These options works well if the micropolygons are small enough relative to the scattering distance, but they fall back to the hard surface approximation (above) when the scattering point is too close to the surface relative to the micropolygon size. This is more likely to happen with high density of the subsurface medium, but it's also more likely to happen when the surface is far from the camera (where micropolygons are larger). This fallback is necessary because the scattering rays and the visible surface renderer don't use the exact same micropolygons (because of the Ray Detail Multiplier), so fully ray-traced scattering doesn't work at small scales (although it works fine for non-displaceables). I want to unify the micropolygon engines in future, and this would solve the problem.

I think it would look better if the fallback used the displaced surface normal, so I'll look into that.
Title: Re: Hard Shadows on Plane Glass Shader PT
Post by: WAS on July 20, 2020, 02:03:59 PM
Changing the subsurface scattering mode didn't actually effect the shadows in any way, I ended up on hard surface approximation just cause of render time, it was significantly faster while providing the same look (minus hard shadows).

I noticed this to a much lesser degree in river scene, where I was trying to do that spring melt where the river is very icy-blue and cloudy, but I had thought it was just the displacement in the water and my render settings creating artefacts for quick rendering, but it may be this issue as well.

It would be nice to see improvement as much of subsurface scatterings use is harder materials rather than like gems or something.
Title: Re: Hard Shadows on Plane Glass Shader PT
Post by: WAS on July 20, 2020, 02:06:13 PM
Also to note, I do have shadows on the displacable, this was giving me nice decay of the snows volume, but I wonder if I can get it to look similar without, such as colouring the underlying surface.