Features

Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Help  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 15
Posts: 15   Pages: 2   [ Previous Page | 1 2 ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 3415 times and has 14 replies Next Thread
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 6873
Status: Offline
Reply to this Post  Reply with Quote 
Re: Several rendering engines in the same plugin

In render method, you could create a camera with a different name for each rendered frame using a name equal to UUID.randomUUID().toString(). For the background and the sun, I don't see any way in YafaRay to replace a light by another one, remove a light from the rendered scene or disable a light.
You could ensure that they are created only once but this would forbid to simulate sun moves during the day. You could also compare sunDirection to its value during the previous call to render, and if it changed, delete the scene and environment with a call to finalize() and create again the environment and the scene like in YafarayRenderer constructor (this will slow down video creation process compared to SunFlow renderer, but changing time during a video is probably not a common use of the video creation tool).

Good luck!
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Feb 8, 2020, 4:25:07 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 433
Status: Offline
Reply to this Post  Reply with Quote 
Re: Several rendering engines in the same plugin

I used a unique identifier for the background, the sun and the camera.
String backgroundName = "background";
String cameraName = "camera";
...
createBackground(backgroundName = UUID.randomUUID().toString(), params);
...
createLight(UUID.randomUUID().toString(), params);
...
createCamera(cameraName = UUID.randomUUID().toString(), params);
...
params.put("camera_name", cameraName);
params.put("background_name", backgroundName);


To be sure they are not created several times in order not to slow down the video rendering, I put the call to the YafarayRenderer constructor in the renderImageAt method of the PhotoImageGenerator class.
I did the same for the call to the SunflowRenderer constructor and I adapted the management of the variable light sources.

These modifications allow to animate the camera and simulate the movements of the sun during the day regardless of the selected rendering engine.
[Feb 11, 2020, 8:44:12 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 6873
Status: Offline
Reply to this Post  Reply with Quote 
Re: Several rendering engines in the same plugin

If by "calling the YafarayRenderer constructor", you mean programming new YafarayRenderer(...) for each frame of the video, I don’t understand how it couldn’t not slow down the creation of the video. This constructor creates many objects and calls many methods of the rendering engine to create the scene! Or maybe, you meant something else...
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Feb 11, 2020, 11:55:29 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 433
Status: Offline
Reply to this Post  Reply with Quote 
Re: Several rendering engines in the same plugin

As it is not possible to remove a light created during the first video frame in YafaRay, a single call to new YafarayRenderer has the consequence of adding new lights to the scene with each new frame which slows down the video rendering.
Using finalize(), Sweet Home 3D crashes by generating a .log file in the plug-in project folder.

With several calls to new YafarayRenderer as for photos at points of view, a new scene is created with each video frame and the problem of removing lights does not arise.
The surprise is that the video rendering is no longer slowed down and is even faster than SunFlow.
[Feb 12, 2020, 2:30:00 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 6873
Status: Offline
Reply to this Post  Reply with Quote 
Re: Several rendering engines in the same plugin

Keep it that way if you want, at least it works. I'll study another way in the next version.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Feb 12, 2020, 11:24:36 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 15   Pages: 2   [ Previous Page | 1 2 ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2020 eTeks - All rights reserved