Sun showing thru object

Started by Ben3D, April 08, 2015, 05:21:13 PM

Previous topic - Next topic

Ben3D

Hello,
I have a render that has objects but the sun is showing thru the object when the sun should be invisible behind the object. Using version 3.2.03.0 of Terragen you can add a standard cube and lower the sun and you should get the same result:

[attach=1]

Matt

#1
This is caused by the atmosphere between the object and the camera, receiving light where in real life it would be in shadow. The standard way to fix this is to enable "receive shadows from surfaces" in the Quality tab of the Planet Atmosphere. If you have a scene where there are clouds in front of the object, you need to check it on the cloud layer(s) too.

This setting usually increases render times quite a bit.

If you have this problem in a scene where you really can't afford to increase render times, there is an advanced feature in the atmosphere and cloud nodes that allows you to use function nodes or shaders to mathematically define where the volumetric shadow should be, avoiding the need to enable "receive shadows from surfaces".

A third strategy you can use is a small, localised cloud layer where the object is. You can make it invisible (by turning off "enable primary"), but it will cast shadows into the atmosphere, avoiding the need to enable shadows from surface.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

Ben3D

I had about 6 frames that had this problem so I rerendered only the object and went into Photoshop to draw over the picture with the sun with the picture without. Since the camera moves quite fast it's not noticeable even if the redraw is not perfect.

Thanks for the information, I will keep it in case I have multiple frames that have this problem.

Dune

QuoteIf you have this problem in a scene where you really can't afford to increase render times, there is an advanced feature in the atmosphere and cloud nodes that allows you to use function nodes or shaders to mathematically define where the volumetric shadow should be, avoiding the need to enable "receive shadows from surfaces".
You mean; plugging in a combination of say simple shape shader (located where object is) and distribution shader (for max height) into the shadow function of the cloud?

Matt

Quote from: Dune on April 09, 2015, 02:58:38 AM
QuoteIf you have this problem in a scene where you really can't afford to increase render times, there is an advanced feature in the atmosphere and cloud nodes that allows you to use function nodes or shaders to mathematically define where the volumetric shadow should be, avoiding the need to enable "receive shadows from surfaces".
You mean; plugging in a combination of say simple shape shader (located where object is) and distribution shader (for max height) into the shadow function of the cloud?

Yes, but instead of using those shaders to say where the object is, you say where the shadow is. So you'd put the shape in between the object and camera. Your shape isn't the shape of the shadow-casting object, but the shape of the shadowed volume. This means it's very fast to calculate, and also allows you to do some things that wouldn't be possible any other way. But if you want the shadow to be automatically cast from a shape, you could just make a cloud from the shape.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

Dune

#5
Thanks Matt. I have to think this over and try it. Ah, works like a dream!

AP

I have a project where the sun in just below the horizon and enabling the receive shadows from surfaces function increases render times too much for me to wait. I attached a imported height field terrain to the shadow input for the Atmosphere node, however this did not work. Am I overlooking something else?

Oshyan

What you're achieving by doing that is simply to mask the atmosphere by a Y-projected grayscale version of the heightfield, which of course is not what you want. It does not interpret it as "mask by this displacement as it appears from the camera's perspective".

What you *might* be able to do is use an image map (in through camera mode) or painted shader to mask out the area where the sun glow should not appear, and then use that as a mask. However I don't know if the shadow modulator actually affects atmospheric glow in that way. Worth a try. The other alternative is just to render that part of the terrain in a crop with Receive Shadows enabled, to save render time, then in post blend it with the main render done *without* Receive Shadows.

- Oshyan

Dune

That doesn't really work well, I'm afraid. Though it might be interesting for stuff.

AP

And I was just about test that idea. I may try the composite idea but more then likely I may just move the sun.

Dune

This might work better.

AP

That did not work either. I decided to move the sun and accept the results.

Oshyan

Oh, that's clever Ulco!

- Oshyan