Wish: Displaymode shadow density, not only color

Hi guys,
When using display modes in layout it would be great to have a shadow density setting.
Now we can alter the color only, and setting gray instead of black results in an odd image:

For my needs the color could be replaced entirely with a density slider, but I guess for some color might be valuable, so then I guess both color and density would be great.

2 Likes

density or intensity? or are we saying the same thing?

1 Like

Potato Tomato :wink:
(Or “same thing”, just in case I accidentally used a frace that meant someting else)

1 Like

https://mcneel.myjetbrains.com/youtrack/issue/RH-59021

1 Like

@Holo,

I guess I’m not understanding what you’re asking here…

Here’s why…

A shadow color of BLACK used at 100% Intensity will yield black shadows.
If you had an Intensity slider, and set it to 50%, then black at 50% intensity will yield gray.

So what is the difference between setting something to 50% and simply setting the color to gray? You get exactly the same result. The same thing applies to any color… If you use solid RED as your color (i.e. RGB(1.0, 0.0, 0.0)) and set the Intensity slider to 50%, then you’re going to get something that is 50% of red (i.e. RGB(0.5, 0.0, 0.0)). So again, what’s the difference between setting a slider, or just computing the color yourself and setting that color?

-Jeff

@jeff,

There is a difference now in Rhino as it looks like your shadows are not in :Multiply" mode, so gray shadows actually can get brighter than the surface they are being cast on. This is not good.
The “intensity” would be a percentage of the opacity of the shadows.

See this test:

The last one (intensity 50%) is achieved by a trick - somehow in Rhino sun settings file saves shadow intensity as part of the settings file and applies it when loaded back if edited, this is just not exposed in UI: (see script here)

What color are computing as 50% gray? It sounds like you’re just going the wrong way. 50% of gray is not a lighter shade of gray, it’s a darker shade…and it looks like you’ve used a lighter shade.

If gray is RGB(0.5, 0.5, 0.5) … then multiplying that by 50% yields RGB(0.25, 0.25, 0.25)…which is a darker color. So I’m not following how you came up with almost white as “50% gray”??

-J

Also, keep in mind the edge cases of white and black. Black is really ZERO… so you can’t get a different intensity of black by simply multiplying zero by some percentage…hopefully for obvious reasons.

Left image shadow color is 100% black (RGB 0,0,0).
Center: RGB 128,128,128 (That’s my 50% Gray)
The last one must be RGB 0,0,0 but with 50% opacity which is the effect we are after with the original request (I guess!)

The thing is cast shadows should ALWAYS be darker than anything it is being cast on… So unless you apply your shadows in Multiply mode we end up with gray shadows that glow in the dark : )

What should you get if your shadow color is white? Certainly not something that is darker :wink: That’s the whole point of the shadow color… to produce an effect that is otherwise not possible. Just like if you try to cast/see dark shadows in a dark environment, then you’re just asking for failure… So if you try casting light shadows in a bright environment, again, you’re asking for trouble… If you use a “lighter” shadow color, then you better plan on using a darker environment.



So, having dark shadow color in the last image would be pointless…

-J

1 Like

Ok that is cool, but I was simply trying to point out that suggesting making shadows grey doesn’t solve the request for shadows intensity. Which is “transparency” of your shadow pass applied in the viewport, regardless if it’s white, black or pink.

I suppose you can get sort of GI effect if you set shadow and environment color the same… In this case, I’ve set everything red…

Ok maybe it’s Friday night effect. No worries I will give up soon. But maybe check the script I linked above. Make a simple scene with sun, have your shadows whatever color you want. Run the script and try values below 1 for shadow transparency. Somehow it works with that workaround using by saving the Sun data file, editing outside Rhino, importing back (the script merely automates it). It just would be nice if apart form the color of the shadow, there was a slider or a text field for shadow transparency, intensity… whatever you want to call this. This is certainly different than shadow color.

Don’t give up… I want to understand the request…but so far, it sounds like I’m being pretty thick.

So let’s start with a very simple example/case…

Suppose I have a pure white canvas… solid white viewport.
The shadow map is simply a circular portion of the viewport, and it’s solid black.

Multiplying the two together will yield a white viewport with a black circular region… right?

Now, suppose there’s an “Intensity slider”… and you set it to 50%…what should the result be?

-J

In this case, the less “intensity” the more gray shadow would look like…
Imagine your shadow is just a separate image your overlay over your view (which I think you are in Rhino display pipeline since it is a map).
Ok?
So, now imagine the intensity controls the Alpha (transparency) of that shadow image. Just makes it less.
As if you were changing shadow layer transparency in Photoshop, but dynamically in Rhino display pipeline…

Does it make sense? For some reason I can’t record a video now but the script above pretty much illustrates it, too.

I think I’m starting to understand… however, if I approach it like a layer in PS…then that means you can get a result that is 100% shadow map only…right? Which is not a desirable result (IMO), and is not really the same thing as a shadow’s “intensity”… I’ve actually just tried mocking this up using PS…

Here’s the scene without shadows…

Here’s the shadow map…

Applying the shadow map to the scene results as a layer using 50% yields this…

However, setting the shadow layer to 100% yields this…

Which is just the shadow map again… and I don’t think that “100% shadow intensity” means “only the shadow map”… So there has to be more logic in there somewhere that only applies to actual shadow pixels… which now makes this more than just a simple multiply.

-J

No if you use multiply as a blending mode, which is what I think @Jarek was trying to explain, that shadows should always make the object darker no matter what color the shadow is.

When I learnt to paint, I was told that shadows are not a specific color but the color of the surrounding and also that shadows are always darker than the original surface. With these two basic principles you can realistically paint any shadow. So for example, if we have green grass on a sunny blue day, what color is the cast shadow on that grass. In this case the shadow should be a mixture between green and blue and always darker than the original green of that grass. How much blue should we use? well that’s what I think @Holo and @Jarek are referring as density here. How much of that blue you want to see on that grass but always making it darker.

1 Like

Hi @jeff,

Ok, I gave it some more thought and digging. The ultimate goal did not change for shadow intensity, but maybe I was wrong how to get there, not understanding how Rhino display pipeline is handling applying the shadows pass in the viewport. If we were offered only black shadows, then obviously just applying the shadow map in Multiply mode with some opacity would be enough, but with color shadows it gets a bit more tricky.

  1. This is the scene with No Shadows:

  1. Same scene with 100% black shadow (Skylight + Cast)

  1. Same scene with Cyan-colored shadow (Skylight + Cast)

  1. Regardless of shadow color setting, the Shadow Map (obtained by TestShowShadowMap) always is a grayscale map:

Which leads me to believe that somehow the ShadowMap is used as an Alpha Mask for the Shadow Color that is applied on top of the display, in Normal Mode (no fancy blending modes here)

  1. So if we take inverted Shadow Map:


… and use it as information of how much of the Shadow Color (Black, Cyan, whatever) gets applied on top of the No-Shadow image (the more white, the more opacity of the Shadow Color), We ca reproduce what Rhino currently does:

  1. Full Cyan Color with Inverted Shadow Map as Alpha Mask over No-Shadow image:

  2. Full Black Color with Inverted Shadow Map as Alpha Mask over No-Shadow image:

  3. So in this case, changing the brightness of the Alpha Mask would control the fabled Shadow Intensity.
    Here is how it roughly works:

And the Photoshop file: RhinoShadows.zip (2.3 MB)


Now, this is somewhat confirmed by the “Sun Shadow Intensity” hack script mentioned above. We are exporting Sun Settings to .rsun file, and messing with this setting before reimporting it (script automates it):

for the intensity below 1, TestShowShadowMap just gets brighter (note only Cast Shadows - Skylight is not affected - must be not implemented in Rhino yet):

Here is the script to test: SetSunShadowIntensity.rvb (2.1 KB)

Whew…

In conclusion, the desired effect is just “less” shadow, whatever color we chose it is.
As if we took the first “No Shadow” image in Photoshop, put the one With Shadow on top of it, and just control the top layer transparency…

From the above maybe under the hood it is playing with the brightness of the Shadow Map pass shown by TestShowShadowMap. I don’t know. But I hope this explains it a bit better and may give you some idea what we are after and how to implement this…

–jarek

1 Like

hi José, that’s how I thought it works since I almost never touch Shadow color in Rhino, but with the option of any shadow color the Multiply mode will not cut it. The implementation in Rhino must be a bit different. Maybe the above helps. Intuitively I thought this is pretty straight-forward request but clearly there is more to it.

1 Like