Sunlight simulation and variable light source

This topic has been viewed 9034 times and has 5 replies
Thread status: Active
Questions about extending features and developing plug-ins [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Sunlight simulation and variable light source

Post by enkonyito »

Currently, the computation of the light source power is done only once (in the constructor of the PhotoRenderer class then in the exportLightSources method).
When a sunlight simulation video is made, the apparent power of a light source varying with the position of the sun is not taken into account at each frame.

By moving the management of this computation into the render method, this solves the problem but greatly increases the estimated rendering time. We go from less than 2 hours to more than 6 hours for a timelapse of 8 seconds.
EnkoNyito
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Sunlight simulation and variable light source

Post by Puybaret »

I'm not sure to understand what you want to change.
If you want to change the power of the sun according to its position in the sky, you should just change how [font=courier new]sunPower[/font] is computed in the [font=courier new]render[/font] method of PhotoRenderer class.
[font=courier new]exportLightSources[/font] method is used to export the other light sources, but they are not supposed to vary, just maybe turned on and off.
Emmanuel Puybaret, Sweet Home 3D creator
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: Sunlight simulation and variable light source

Post by enkonyito »

In fact I wanted to make a video timelapse with a new light panel whose apparent power varies depending on the position of the sun.
This computation is done in the exportLightSources method.

It works great for simple or multiple photo rendering but not for video rendering.
EnkoNyito
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: Sunlight simulation and variable light source

Post by enkonyito »

Problem solved with an acceptable video rendering time. Phew..
EnkoNyito
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: Sunlight simulation and variable light source

Post by enkonyito »

Since Sweet Home 3D 7.0, lights with the lightSourceMaterialName# property are handled differently.
By default, in the render method, [font=courier new]updatedItems = null[/font].
For video rendering, even if I add [font=courier new]updatedItems = this.variableLights[/font], the auto light panel does not turn on after sunset.
EnkoNyito
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: Sunlight simulation and variable light source

Post by enkonyito »

Taking into account the new values of [font=courier new]sunDirection[/font] at each frame, the light panel turns on automatically after sunset.

Now there are two problems.

Problem 1: With a new update method
By removing the previously created light panel from the renderer, the updated light panel loses its appearance while keeping its lighting.
If it is not removed from the renderer, the updated light panels are added to the previous one which weighs down and modifies the rendering.

Problem 2: With [font=courier new]updatedItems != null[/font]
When removing the previously created light panel from the renderer, there are the following messages:

Code: Select all

GEOM error: Geometry "object09c1d2eb-25b8-4875-8459-a2f1a1c61250-0" was not declared yet - instance is invalid
API error: Unable to update "object09c1d2eb-25b8-4875-8459-a2f1a1c61250-0.instance" - removing
API error: Unable to declare camera "camera", name is already in use
Then

Code: Select all

java.util.MissingFormatArgumentException: Format specifier '%s'
EnkoNyito
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 2 guests