Shaderlight

Fall Shore

 
awaddington
Total Posts: 359

This fall render is a contrast to my fall render last year (http://www.artvps.com/index.php/discuss/viewthread/2624/).  Where last years post focused on vibrant colours and very low poly model, this render is later in the season when the colours have faded and uses the replace me feature to introduce high poly grass and leaves (http://www.artvps.com/index.php/discuss/viewthread/2712/).

Still some room for improvement on the lighting and some of the materials, but it’s getting there I think.

Image Attachments
fallGimp2crop60.png
Click thumbnail to see full-size image
EGIE
Total Posts: 482

Hi Andrew - Many thanks for this charming autumn greeting render!
And again, this is a wonderful piece of nature. I love it!

Even if you see the possibility for improvements here and there, it is a mystery to me how to
achieve such a nature like variety richness within the lawn

I’m glad you’re reporting back here ;-)

Best, Egie

awaddington
Total Posts: 359

Thanks Egie,

One of the features I wasn’t happy with yet is the water.

I am experimenting with ways to boost the Fresnel effect for the reflections—basically the further away the water surface is from the camera the more reflection I want.  Standing at the edge of the water and looking straight down you would expect to see the lake bottom, but at the far side of the lake, you would only expect to see reflections. (In reality I think Fresnel is more to do with angle than distance, but in this instance distance becomes angle)

Transparent PNGs don’t work as expected, blending from clear to black results in half of the material being clear and the other half being pure opaque black when rendered.  But using an opaque texture of white to black and setting the material to clear liquid does work. Darker liquids reflect more than white (clear) liquids.

So in my original render above, I used a material that I had darkened at the edges and came to a brighter point in the middle; the lighter point is then positioned at the camera and the material gets darker as it moves away from the camera.  This worked somewhat as you can see, but the result is not perfect for a couple of reasons:

- the shading of the outer areas and lightening the center conflicts with the bumping performed by shaderlight - the tops of ripples are muted and the valleys are deepened resulting in a flat surface with holes instead of ripples.

- the image is no longer tileable so you either need massive material images or be limited to small focused renders like the one shown.


Today I’ve come up with a better solution.

- The top face of the water surface is painted with a tileable clear-water texture
- The bottom face (the reverse side of the top face) is painted with a single, untiled black and white image that blends from pure white to pure black.
- the camera is positioned above the pure white area and the pure black is furthest from the camera
- both materials are set to transparent->liquid

If you compare two attached renders (one with the Fresnel workaround and the other without) you see a few things of interest:

- without Fresnel
—the lake bottom is visible through the reflection even at the furthest point (almost 80 feet away)
—I had a similar issue with my fall render last year and cheated by painting the lake bottom black

- with the Fresnel
—the reflection is greater the further you get from the camera
—the water bump values are preserved
—the water bumps are tileable/scalable
—you can change/adjust either the ripple map or the Fresnel blend independently of one another.

This still isn’t perfect because the blend isn’t truly accurate, no Fresnel equations were used to define the blend rate and the effect only works when the camera is positioned over the white end of the blend material. If you want to change the angle or position of the camera, you need to rotate the material.

Still, I think the resulting effect adds some richness to the render.

I hope this is helpful to someone.

Cheers,

Andrew

Image Attachments
fresripple2.jpgLake_Fresnel.jpgLake_noFresnel.jpgwaterbump2.pngblend.jpg
Click thumbnail to see full-size image
kfoojones
Total Posts: 232

Hi Andrew,

Ingenious technique, and very effective!

I’m a bit surprised it’s necessary, though – Shaderlight does apply the Fresnel equations when calculating reflections, so in most situations it ought to do ‘the right thing’. It looks like your ‘without Fresnel’ image has too much lake bottom showing through for some reason, like it’s too bright and overpowering the reflections. Which would explain why your graduated texture helps – the dark part casts a shadow on the bottom further away from the camera, allowing the reflections to show up more clearly.

I wonder if your camera angle is not quite oblique enough to really trigger much in the way of Fresnel effect? Or perhaps your water isn’t deep enough to attenuate much light? Did you use the same water texture on the underside of the water surface of the ‘without Fresnel’ version? The texture on the underside is what’s used to shadow the lake bottom, so if it’s completely clear the bottom will not be shadowed.

I’ve attached a quick render that I did using just your water texture (the tile-able version) on both sides of the water surface, and I think it shows the Fresnel effect you’re after. Lisanne is standing on the bottom, to give you some idea of the depth, and it slopes up to the surface just behind the ‘boulders’ (sorry – programmer art!). I used the Golf Course environment for lighting and background reflections. I think my camera is a bit closer to the water than in yours, which might be helping.

Thanks for sharing,
Shaderlight support

Image Attachments
Water.jpg
Click thumbnail to see full-size image
awaddington
Total Posts: 359

All of your suggestions are true/possible explanations.

—The “without Fresnel” has a perfectly clear underside.
—The camera is likely higher than yours
—The water is relatively shallow

The Fresnel in your example looks great; however, another problem still exists.  At the camera,  the lake bottom (that in my renders below is 80 feet down) looks like it is just below the surface.

Part of the problem is that real lake water isn’t typically perfectly clear.  If we add a bit of murk to the material (changing the colour to a brownish green) the results improve. 

The attached renders compare different material combinations using the same manual exposure setting.  The camera is lowered and the distance to the boulders increased from 80 feet to 260+

Render A:
  Top - clear wave bump material;
  Bottom - clear wave bump material.

Render B:
  Top - clear wave bump material;
  Bottom - solid “murk” color (transparent->liquid).

Render C:
  Top - wave bump material with “murk” color applied;
  Bottom - wave bump material with “murk” color applied.

Render D:
  Top - wave bump material with “murk” color applied;
  Bottom - solid “murk” color (transparent->liquid).

Render A allows far too much light through to the depths and back.  I like the subtlety of Render B and, if the depth was around 6 feet or so, I would say this is about perfect; unfortunately, with an 80-foot depth there is too much light hitting the lake bottom.

Render C is a bit better, but the highlights are still too bright for an 80-foot depth.  Short of changing the lake bottom material to something darker or introducing some form of atmospheric interference below the water surface, Render D is probably the best at presenting a deep lake bottom. 

So, using a blended underface material is limited to being an artistic effect; but use of the underlying (no pun intended) principle may still be valid for certain scenarios to increase the perceived realism.


 

Image Attachments
Comp.png
Click thumbnail to see full-size image
kfoojones
Total Posts: 232

That’s a good point, Andrew, and the later renders do give a greater impression of depth. However, I would have thought the bottom would be pretty much invisible at a depth of 80ft?

The thing about using the wave texture to provide the ‘murk’ is that the murk also gets the wave pattern. Whilst that does produce a nice caustic-like effect, it might not always be what you want, and limits how deep the water can look, since some areas of the bottom stay bright.

Also, having different materials on the top and bottom surfaces of the water face introduces an inconsistency between rays entering and leaving the water, which can lead to incorrect refractions and global illumination, for example. Not always a problem, but worth bearing in mind.

An alternative is to create a second water face, just a few millimetres below the usual one, with the solid ‘murk’ colour applied to both sides. So the upper face has the wave texture and the lower one a solid colour. Both materials are set to Transparent, Liquid. This allows us to rely on the wave texture just for the bump mapping and the murky colour just for the darkening / tinting. The amount of absorption can be adjusted with the darkness of the colour used. If you render any extreme close-ups of partially submerged objects, you might see the thin ‘clear’ layer of water floating on top of the murky water, but in most situations that shouldn’t be apparent.

The attached render shows this applied to my previous scene. The depth near to the camera is about 4ft.

Image Attachments
Water_2.jpg
Click thumbnail to see full-size image
EGIE
Total Posts: 482

Hi Andrew and Kim
These all are great and amazing reflections from both of you to this topic with equally amazing render outcomes.


Unfortunately, I have difficulties to translate this informations into something that I can understand.

What is meant by “fresnel effect”?
Which one of your shown textures is applied to which geometry with which SL-settings to result in
which one of your shown rendered pictures?

So sorry, that I am a little bit confused :-)  but still so much interested to follow you…

Best, Egie

PS is it maybe possible to share some of these case studies simplified in the 3d warehouse?

awaddington
Total Posts: 359

Your render looks about perfect for a four-foot depth, and I agree that 80 feet deep should be about black.

I tested your approach on my model, but added a boulder just below the surface(s).

As you can see, when the water is murky enough to hide the lake bottom as expected, it also hides objects just below the surface.  When I lighten the murk to show the boulder, the 80-foot lake bottom also comes into view.

This is not unique to your double layer approach.  Approaches I showed above have the same issue have the same issue.

 

Image Attachments
double_layer_clear_bump_+_light_murk_+_boulder.jpgdouble_layer_clear_bump_+_murk_+_boulder.jpg
Click thumbnail to see full-size image
awaddington
Total Posts: 359

Hi EGIE,

To avoid confusion, there are two independent discussions occurring, Fresnel (resolved) and how to mimic light loss for deep bodies of water.

Fresnel deals with the amount of reflection that is visible based on the viewing angle.  It describes why when you look straight down at your feet when standing in water, the water has very little reflection but when you look at water in the distance, the reflections are significantly greater.

To clarify, Shaderlight handles Fresnel correctly.

KfooJones—you know far more about the science of this (and of course the inner workings of SL than I ever will) - is there any standard algorithm for light fall-off while traveling through liquid that could be applied to future SL liquid materials such that the further a photon travels after passing through a liquid face the less energy it has? For example, I’ve seen one claim that light is reduced by 7% for every meter it travels through clear sea water. Or would that be computationally prohibitive?

Andrew

kfoojones
Total Posts: 232

Hi Andrew,

Well spotted again! I had thought that Shaderlight would correctly handle the distance passed through the water (via Beer-Lambert’s law), but having checked the code, it turns out that whilst the render engine itself does support that, the SketchUp exporter doesn’t fully expose the feature :-( (I suspect because the renderer’s implementation doesn’t start from a physical basis, but requires the artist to fine-tune the parameters for each situation, which doesn’t fit our Shaderlight philosophy of not requiring specialist rendering knowledge of the user…)

We’ll have to look at how we can include this in a future version, but, for now, all I can think of is to insert extra layers of water faces at different depths with darker colours. Sadly, this will only work if your underwater objects can be separated into a small number of layers, or you will run up against the ray-depth limit (the maximum number of refractions / reflections the ray-tracer will accept).

kfoojones
Total Posts: 232

Hi EGIE,

Perhaps this diagram will help explain the set-up. (This is for my second render. The first render is the same, but without the lower ‘Color H08’ face.) The materials are applied to both sides of their respective faces.

Image Attachments
Water_Scene.jpg
Click thumbnail to see full-size image
awaddington
Total Posts: 359

Thanks Kim,

Here is a render with:
- submerged bolder
- clear water bump layer
- multiple “murk layers”
—Colour: HSL(63,100,93)
—SL Material: Transparent->Liquid
—28 layers spaced 18 inches apart
—each layer is subtle enough that you don’t notice rings and it looks like gradual shading.

I like the outcome - the darkening water as it deepens adds a lot to the image, but (to your point re only using a limited number of layers) wow does it take a while to render all those liquid layers!  (The time for this 50% quality render was on par with a full quality render.  All those photons bouncing between the reflective sublayers.)

Cheers,

Andrew

Image Attachments
double_layer_clear_bump_+++_murk_+_boulder.jpg
Click thumbnail to see full-size image
kfoojones
Total Posts: 232

Hi Andrew,

That looks pretty good to my eyes.

Have you tried with fewer layers? I wouldn’t expect you to get any additional benefit from over five layers at quality level 5 – only five transparent / reflective surfaces are counted and any more than that are skipped to prevent render time explosions with rays bouncing endlessly between surfaces.

At Q10, ten transparent / reflective surfaces are counted. (The number of surfaces doesn’t follow the quality level throughout the range, though. For reference, Q1-3 gets three interactions, Q4-6 five, Q7-8 six, Q9 seven and Q10 ten.)

awaddington
Total Posts: 359

Thanks Kim,

That is interesting about quality vs number of layers. I ran some tests:

General Assumptions::

  1) light loses intensity at a rate of 7% per metre (three feet) under water
  2) When working with HSB colours, brightness (B) 0-100 is roughly equivalent to a range of fully opaque (0) to fully clear (100) (so B:93 is 7% less than perfectly clear when rendered)
  3) stacked layers should have an inverted cumulative effect - i.e., A layer of B:25 and a layer of B:75 when stacked should be equal to full opaque (100 - (25 + 75) = 0) 

I don’t know if these assumptions are accurate but they are the assumptions I have used. (As a side note, either assumption 2 or 3 is not perfectly accurate because none of the tests yielded a perfect black lake bottom, but they came close).

Layering Impact Test:

Test settings:

  - clear water bump for top layer
  - murk layers set at B:93
  - first murk layer positioned 0.0125 inches below bump layer
  - subsequent murk layers spaced 18 inches apart
  - total number of layers = number of murk layers + 1 (water bump layer)
  - render in increments of five layers (Images attached—A:5, B:10, C:15, D:20, E:25, F:30)
  - quality setting: 50

(Note that B:93 and 18-inch spacing is double the light reduction rate specified in the assumptions, for this test only, the cumulative affect of layering was insufficient to produce a near-black lake bottom.  Other tests accumulated approximately as expected)

If the rendering engine ignores layers greater than five, then one of the following should occur if more than five layers are added:

  H1 = no impact on shadow or refraction; or,
  H2 = extra layers are treated as solids and the lake bottom is hidden

Outcome:

- additional layers above five continue to darken the objects below
- the lake bottom is still visible
- the distortion/refraction of the lake bottom remains the same
- SL may not consider reflection/refraction for layers greater than five, but the transparency and colour impact remain

Quality Impact Tests: 

Test Settings:

  - Same as above but at Quality 100
  - Render only five and ten layers

If Q:100 acknowledges five more layers than Q:50 then Q:100 renders should be darker and more lake bottom more distorted/refracted. The differences between Q:50 and Q:100 for the 5-layer test reflect only the impact of the improved quality and are not related to the number of layers captured at that setting because Q:50 captures five layers—in essence the 5 layer test becomes a benchmark. If the capture of additional layers affects the render then the differences observed for the 10 layer test should be greater than those observed for the 5 layer test. 

Outcome:

  - Similar amounts of light appear to reach the lake bottom in Q:50 and Q100 tests (supports the findings of the first test)
  - significant difference in refraction/distortion between Q:50 and Q:100
—Q:100 magnifies the lake bottom
—5 Layer boulder is significantly distorted in Q:100 compared to Q:50
—10 Layer test is difficult to determine whether the same level of distortion exists for the boulder at Q:100 because the affected area is too dark
—The differences observed between quality settings may be more to do with the quality setting and less to do with the number of layers being captured by that setting (this finding may be a bit of a stretch given the small sample size)

*****

So, can we achieve sufficient depth shading with fewer layers?  The challenge here is that the fewer layers you have, the greater the difference between them and the less natural the darkening depths will look.  At a loss of 7% per metre, we should be completely dark by 42 feet below the surface. We cannot simply divide 42 feet and B:100 evenly across a given number of layers or the top areas will be too dark.  The highest, most visible areas require the most subtly because they are more visible.

We can try to weight the distance and change between layers (i.e., the top layers are closer in colour and closer in distance to one another than deeper layers. For lack of a better term let’s call these “exponential” layers (they aren’t truly but I need a name).

Testing at Q:50 we’ll start with a five layer scenario (four murk layers) with the following settings:

  Layer 1—B:95; Depth: 0 feet
  Layer 2—B:79; Depth: 9.33
  Layer 3—B:68; Depth: 23.33
  Layer 4—B:58; Depth: 42

The cumulative darkening theoretically reaches 0 at 42 feet.  As shown in the attached rendering, though, four layers are insufficient for creating a gentle transition.  Each layer is a noticeable surface (possibly with its own reflections).

Increasing the layer count to ten (nine murk layers) provides a better outcome.

  Layer 1—B:98; Depth: 0 feet
  Layer 2—B:96; Depth: 1.91
  Layer 3—B:93; Depth: 4.77
  Layer 4—B:91; Depth: 8.59
  Layer 5—B:89; Depth: 13.36
  Layer 6—B:89; Depth: 19.09
  Layer 7—B:84; Depth: 25.77
  Layer 8—B:82; Depth: 33.41
  Layer 9—B:78; Depth: 42

This also appears to be the first time that the capture of the additional five layers makes a really obvious impact.

When rendered at Q:50 the ten exponential layers still show the light level constant after a certain point and the bottom of the lake is still visible.

At Q:100, the lake bottom is completely dark and better gradation of shadow is evident.

So after all this - the winner to date, in my opinion, is the ten exponential layer approach at Q:100; however, this is a complicated method to set up.

Using the B in HSB to control clarity is also somewhat limited.  on my computer at least, Sketchup often rounds down to the nearest interval of two, so if I set B to 99, after exiting the material editor Sketchup will change this setting to 98.  This means that the very top murk level has an option of either clear or 2% murk, which is why the top of the boulder is slightly darker than you’d expect immediately below the surface.

Thoughts for future:

  - if a material cannot be developed that embraces the Beer-Lambert’s law, then perhaps a transparent material that behaves like liquid in the way that it uses colour and brightness, but that has no reflection/refraction properties. 

This will allow for faster renders and reduce the risk of unwanted reflections on murk layers or multiplied liquid

distortions. In theory, the only distortion we want should be coming from the liquid setting for water bump layer.
So all we want the murk layers to do is colour/shade the area below.

Cheers,

Andrew

Image Attachments
layer_test_scaled.pnglayer_quality_test.pngFour_Layer_Exp_Q50_sml.pngTen_Layer_Exp_Q100.pngTen_Layer_Exp_Q50.png
Click thumbnail to see full-size image
kfoojones
Total Posts: 232

This highlights some interesting subtleties about the renderer’s behaviour that I hadn’t considered before.

After the initial ‘eye’ ray passes through the first five layers (at Q5), it then advances to the lake bottom without interacting with the remaining layers. Once the ray hits the bottom, a ‘shadow’ ray (or several) is formed to find out how much light reaches the lakebed from the light sources (the sun / sky in this case). These shadow rays don’t have a limit on the number of layers they interact with, so the additional layers do cause the lakebed to get darker because less light reaches them in the first place.

As you have demonstrated, increasing the quality level allows more interactions with the eye ray, causing more distortion from refraction. I had originally expected the additional layers not to cause any further refraction because the index of refraction should be the same on both sides of the layer, but it turns out that Shaderlight doesn’t work like that, and it treats each layer as a new air-water interface. (In my defence, I didn’t write that part of the raytracer, so this is news to me!) One could argue that as the water depth increases so does its density and therefore its index of refraction, meaning light would be further refracted as it gets deeper. But I would guess that effect to be much more subtle than what we’re seeing here and would classify the current behaviour as a bug.

I’m not sure why the 5-layer Q10 render shows so much more distortion than the Q5 version – maybe the additional reflections you get at each layer interface are having a significant impact.

With respect to your general assumptions, I think your first two are correct (with the caveat that the absorption rate is very wavelength dependent, hence the blue colour of water), but the effect of cumulative layers is multiplicative rather than additive – each layer reduces the intensity proportionally to the remaining light, rather than the original amount. In the example of a 25% layer followed by a 75% layer, 25% * 75% (~19%) would be transmitted.

This suggests that you should get fairly accurate Beer-Lambert-style attenuation with a series of layers all at 93% brightness spaced 1m apart in the view direction, so technically they should be spherical shells centred on the camera location – reducing the spacing between your horizontal layers to 18 inches is probably reasonably close to the right spacing since the viewpoint is at an angle to the layers.

It might be also be worth trying the ‘Thin Glass’ material, as that won’t apply the additional refractions at each layer, although it will still result in unwanted reflection rays. Using one of the ‘Translucent’ materials, or Matt, Smooth with a non-opaque colour specified in the SketchUp colour picker might also produce useful results because they variously skip some of the refractions / reflections, although they might also introduce unwanted diffuse illumination on the layers. I haven’t had a chance to experiment with them in this particular situation yet.

For the future, I would definitely be interested in making the Liquid material apply Beer-Lambert’s law properly and correcting the behaviour when crossing multiple transparent material boundaries, meaning non of the tricks with the extra layers would be necessary.

Thanks for all your detailed analysis!

awaddington
Total Posts: 359
kfoojones - Oct 16, 2016 04:54pm

I’m not sure why the 5-layer Q10 render shows so much more distortion than the Q5 version – maybe the additional reflections you get at each layer interface are having a significant impact.

That’s what I was thinking or ...a refraction of a refraction of a refraction…

It would be interesting to see if having an odd or even number of refractive layers affects this if each layer “corrects” the layer above like a zigzag of rays.

kfoojones - Oct 16, 2016 04:54pm

...but the effect of cumulative layers is multiplicative rather than additive – each layer reduces the intensity proportionally to the remaining light, rather than the original amount. In the example of a 25% layer followed by a 75% layer, 25% * 75% (~19%) would be transmitted.

 
This seems logical based on what I observed in the rendering. Basically each layer block x% of the remaining light.  It reminds me of an old riddle:

“Three travelers enter an inn and order a plate of potatoes.  While waiting for their meal they fall asleep so the waiter leaves the plate on the table.  One traveler wakes up eats one-third of the potatoes and goes back to sleep.  Then the second traveler wakes up and eats one-third of the potatoes and goes back to sleep. Finally, the third traveler wakes up and eats his third of the potatoes and goes back to sleep.  When the waiter returns, almost one-third of the potatoes are still on the plate.  How can this be?

The answer, of course, being that none of the travelers knew that the other travelers had already eaten so each ate 1/3 of what was left. 

By that same logic, the multiplicative nature of the layers means that you never fully block all the light until you introduce a 100% opaque layer (although you would eventually get so close that it wouldn’t matter).

This means that the layer opacity calculations need to be rethought or we just make the last layer at 42 feet close to fully opaque because…life’s too short and no one will notice.

kfoojones - Oct 16, 2016 04:54pm

...technically they should be spherical shells centered on the camera location – reducing the spacing between your horizontal layers to 18 inches is probably reasonably close to the right spacing since the viewpoint is at an angle to the layers.

Excellent point that I hadn’t considered directly; although I had considered that horizontal distance was not being addressed through vertical layering.

After reading your post I almost attempted a layering approach using hemisphere below the surface, but realized that this only works if you viewing angle never sees over the lip of one of those spheres.  Also, it brings us back to one of the major drawbacks of my method in the beginning of this post wherein the effect only works from one camera position—at least there it only required shifting a material and not an array of layers :)

kfoojones - Oct 16, 2016 04:54pm

It might be also be worth trying the ‘Thin Glass’ material, as that won’t apply the additional refractions at each layer, although it will still result in unwanted reflection rays.

It did.

kfoojones - Oct 16, 2016 04:54pm

Using one of the ‘Translucent’ materials, or Matt, Smooth with a non-opaque colour specified in the SketchUp colour picker might also produce useful results because they variously skip some of the refractions / reflections, although they might also introduce unwanted diffuse illumination on the layers. I haven’t had a chance to experiment with them in this particular situation yet.

I haven’t played with this much either.  I did try a translucent material by accident but canceled the render half-way through because it wasn’t looking right and I realized I’d selected the wrong material.

kfoojones - Oct 16, 2016 04:54pm

For the future, I would definitely be interested in making the Liquid material apply Beer-Lambert’s law properly and correcting the behavior when crossing multiple transparent material boundaries, meaning none of the tricks with the extra layers would be necessary.

That would be great!

kfoojones - Oct 16, 2016 04:54pm

Thanks for all your detailed analysis!

My pleasure this was fun.

Andrew