distant light size

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Post Reply
User avatar
lacilaci
Donor
Donor
Posts: 1969
Joined: Fri May 04, 2018 5:16 am

distant light size

Post by lacilaci »

I wanted to have direct color control over sun, so I switched to distant and tried to increase size to also get nice blurry shadows.
However up to sun size of 0.04 the shadows are sharp and at 0.05 size the sun/distant light pretty much just dissapears.
Is this a known bug or some limitation? Is there a way to directly control sun light/temperature?
BTW I know I can somehow counterbalance sun color using the color input but that is just way to complicated way to control sun color.
Attachments
004.jpg
005.jpg
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: distant light size

Post by B.Y.O.B. »

This code in the addon is responsible:

Code: Select all

            if lamp.luxcore.sun_type == "sun":
                # sun
                definitions["type"] = "sun"
                definitions["dir"] = sun_dir
                definitions["turbidity"] = lamp.luxcore.turbidity
                definitions["relsize"] = lamp.luxcore.relsize
            elif lamp.luxcore.theta < 0.05:
                # sharpdistant
                definitions["type"] = "sharpdistant"
                definitions["direction"] = distant_dir
            else:
                # distant
                definitions["type"] = "distant"
                definitions["direction"] = distant_dir
                definitions["theta"] = lamp.luxcore.theta
The problem is that the distant light does not work with very small theta. In a normal-scaled scene you should not notice the transition between the light types.
Can you upload the scene (or a simpler scene that shows the problem)?
Maybe the scene is scaled very small?
User avatar
lacilaci
Donor
Donor
Posts: 1969
Joined: Fri May 04, 2018 5:16 am

Re: distant light size

Post by lacilaci »

Ok,

I made a new scene, very basic.
It doesn't matter if I use metric at 0.01(cm) or at 1 or if I turn off unit scale completely.
Distant light does not work at all if it's size is 0.05 or above.
Attachments
distantsize.blend
(755.93 KiB) Downloaded 123 times
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: distant light size

Post by B.Y.O.B. »

The problem is that the size of the distant light influences the amount of light it emits.
The sharpdistant light on the other hand always emits the same amount (because the size can't change).
So what happens in your scene is that as soon as the sharpdistant light gets replaced with the distant light by increased size, the amount of emitted light suddenly drops to something very low and only scales up slowly with increased size.

Try the following: Disable the world light, start a viewport render, and increase the light size.
The automatic tonemapper will adapt to the sudden brightness change.
With the sky enabled, the tonemapper will not adapt because the sky is still very bright.
User avatar
lacilaci
Donor
Donor
Posts: 1969
Joined: Fri May 04, 2018 5:16 am

Re: distant light size

Post by lacilaci »

B.Y.O.B. wrote: Tue Sep 04, 2018 8:21 am The problem is that the size of the distant light influences the amount of light it emits.
The sharpdistant light on the other hand always emits the same amount (because the size can't change).
So what happens in your scene is that as soon as the sharpdistant light gets replaced with the distant light by increased size, the amount of emitted light suddenly drops to something very low and only scales up slowly with increased size.

Try the following: Disable the world light, start a viewport render, and increase the light size.
The automatic tonemapper will adapt to the sudden brightness change.
With the sky enabled, the tonemapper will not adapt because the sky is still very bright.
Thank you so much, now it works!

However If I wanted to use camera tonemapping/shutter speed etc close to real-like settings I have to use pretty high values for distant light.
Which makes me think how it affects performace?
Like if I use linear/autolinear tonemapping and low values for distant+sky intensity VS camera settings + high distant light values
Can I expect different performance cause of the insane numbers? Or it doesn't matter?
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: distant light size

Post by B.Y.O.B. »

It doesn't matter for performance.
However if the values get too extreme, you might experience the limits of floating point accuracy (e.g. you could get visible banding in the sky).
See e.g. https://github.com/LuxCoreRender/LuxCore/issues/89 (the attached picture is from that issue)
Attachments
scrn_2018-04-06_09-02-12.png
Post Reply