YafaRay rendering plug-in

This topic has been viewed 526613 times and has 172 replies
Thread status: Active
Test the features and bug fixes of future versions [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
MichaelN
Posts: 29
Joined: Sun Apr 21, 2019 8:12 pm

Re: YafaRay rendering plug-in

Post by MichaelN »

I just tried these plugin but it generates only complete grey pictures. Have I to do more than copying the file in the plugin folder?
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: YafaRay rendering plug-in

Post by Puybaret »

enkonyito, did you export and load all the YafaRay DLLs required for the plug-in, like in the [font=courier new]loadDLLs[/font] method I programmed in [font=courier new]YafarayRenderer[/font] class?

jjocsak, the current version of the plug-in can work only in 64 bit. Maybe you installed Sweet Home 3D in 32 bit? If it's the case, just relaunch the installer and select the 64 bit architecture in the screen that allows to choose the installation folder. Of course, this will be possible only if your system is 64 bit.

MichaelN, did you try with some other files, or maybe the demos?
Emmanuel Puybaret, Sweet Home 3D creator
MichaelN
Posts: 29
Joined: Sun Apr 21, 2019 8:12 pm

Re: YafaRay rendering plug-in

Post by MichaelN »

I tried it with my own file, not with the demo file.
I now tried an aother position, which works fine. Than I go again back to my kitchen - other view than before - and SH3D crashes without any message. It just disappears from the desktop.
jjocsak
Posts: 5
Joined: Sat Nov 09, 2019 3:55 pm
Country: USA

Re: YafaRay rendering plug-in

Post by jjocsak »

64 bit install solved the problem, thanks.
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: YafaRay rendering plug-in

Post by enkonyito »

enkonyito, did you export and load all the YafaRay DLLs required for the plug-in, like in the [font=courier new]loadDLLs[/font] method I programmed in [font=courier new]YafarayRenderer[/font] class?
Yes, otherwise it causes the error [font=courier new]java.lang.ExceptionInInitializerError[/font] .

What would prevent access to native methods in this case ([font=courier new]java.lang.UnsatisfiedLinkError[/font] ) ?
EnkoNyito
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: YafaRay rendering plug-in

Post by Puybaret »

Enkonyito, if you moved [font=courier new]native[/font] methods to another class or package, you'll have to generate new [font=courier new].h[/font] and [font=courier new].cpp[/font] files and compile source code to update [font=courier new]libyafarayjni.dll[/font]. Did you succeed to generate such a DLL?
Emmanuel Puybaret, Sweet Home 3D creator
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: YafaRay rendering plug-in

Post by enkonyito »

Enkonyito, if you moved [font=courier new]native[/font] methods to another class or package, you'll have to generate new [font=courier new].h[/font] and [font=courier new].cpp[/font] files and compile source code to update [font=courier new]libyafarayjni.dll[/font]. Did you succeed to generate such a DLL?
As this solution (#2) works, I have not retested since.

I had failed to generate the DLLs in a custom package (betaTestPlugin) when trying to follow this method:

Code: Select all

// To generate JNI DLL for Windows, read "YafaRay Windows 10 MinGW 64bit building - Standalone.txt" in Core-3.3.0\building (no need to install Python and stop after installing LIBRARY DEPENDENCIES)
// Run C:\mingw64\mingw64-shell.exe and use the following command (/C/Program Files/Java/jdk1.8.0_121 contains JDK)
// plugin project folder> g++.exe -D_GLIBCXX_USE_CXX11_ABI=0 -I"/C:\Program Files\Java\jdk1.8.0_201\include" -I"/C/Program Files/Java/jdk1.8.0_201/include/win32" -Isrc/[b]betaTestPlugin[/b]/include/yafaray -Isrc/[b]betaTestPlugin[/b]/include/other -I/C/msys64/mingw64/include src/[b]betaTestPlugin[/b]/YafarayRenderer.cpp -shared -o src/[b]betaTestPlugin[/b]/lib/windows/x64/libyafarayjni.dll -Lsrc/[b]betaTestPlugin[/b]/lib/windows/x64 -llibyafaray_v3_core
EnkoNyito
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: YafaRay rendering plug-in

Post by enkonyito »

Some suggestions for the next version (1.0 Beta 4):
- use a YafarayRenderer.properties file to modify rendering parameters such as for SunflowRender.properties
- include an example xml scene using arealights or visible spherelights because their implementation is problematic
- make tile borders visible to see the number of rendering threads

Enko
Feedback on the light panels.

* When I choose,

Code: Select all

params.put("type", "arealight");
// Uses the YafaRay coordinate system (X-right, Y-back, Z-up)
// vertex0 = (0% lightWidth, 0% lightDepth, 0% lightHeight)
// vertex1 = (100% lightWidth, 0% lightDepth, 0% lightHeight)
// vertex2 = (100% lightWidth, 0% lightDepth, 100% lightHeight)
// vertex3 = (0% lightWidth, 0% lightDepth, 100% lightHeight)
Point3f vertex0Location = new Point3f(0.0f - 0.5f, 0.0f - 0.5f, 0.5f - 0.0f);
Point3f vertex1Location = new Point3f(1.0f - 0.5f, 0.0f - 0.5f, 0.5f - 0.0f);
Point3f vertex3Location = new Point3f(0.0f - 0.5f, 0.0f - 0.5f, 0.5f - 1.0f);
lightTransform.transform(vertex0Location);
lightTransform.transform(vertex1Location);
lightTransform.transform(vertex3Location);
Point3f corner = new Point3f(vertex0Location.getX(), -vertex0Location.getZ(), vertex0Location.getY());
Point3f point1 = new Point3f(vertex1Location.getX(), -vertex1Location.getZ(), vertex1Location.getY());
Point3f point2 = new Point3f(vertex3Location.getX(), -vertex3Location.getZ(), vertex3Location.getY());
params.put("corner", corner);
params.put("point1", point1);
params.put("point2", point2);
params.put("color", new float [] {
	((lightColor >> 16) & 0xFF) * ((this.homeLightColor >> 16) & 0xFF),
	((lightColor >> 8) & 0xFF) * ((this.homeLightColor >> 8) & 0xFF),
	(lightColor & 0xFF) * (this.homeLightColor & 0xFF), 1});
params.put("power", power * 100);
params.put("samples", 4);
createLight(UUID.randomUUID().toString(), params);
no light is emitted.

* When I choose,

Code: Select all

params.put("type", "meshlight");
params.put("double_sided", false);
params.put("light_enabled", true);
params.put("color", new float [] {
	((lightColor >> 16) & 0xFF) * ((this.homeLightColor >> 16) & 0xFF),
	((lightColor >> 8) & 0xFF) * ((this.homeLightColor >> 8) & 0xFF),
	(lightColor & 0xFF) * (this.homeLightColor & 0xFF), 1});
params.put("power", power * 100);
params.put("samples", 4);
createLight(UUID.randomUUID().toString(), params);
Sweet Home 3D automatically closes every time without an error message in Eclipse.
EnkoNyito
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: YafaRay rendering plug-in

Post by Puybaret »

Hi,

For various reasons, I wanted to be able to recompile YafaRay DLLs. I succeeded to achieve this task without big problems under Windows and Linux thanks to the instructions given in YafaRay source code, but I had much more difficulties to make it work under macOS!
Finally, I was able to generate new DLLs based on a slightly modified version of the current source code (to fix an issue on normals management) and I'm happy to propose a version 1.0 Beta 4.
This new version is much smaller (13 MB instead of 46 MB) and should work under more systems.

enkonyito, before I investigate your problem, could you try again with this new version fist?

Happy New Year 2020 to everyone [:)]
Emmanuel Puybaret, Sweet Home 3D creator
enkonyito
Posts: 607
Joined: Thu May 28, 2015 4:52 pm

Re: YafaRay rendering plug-in

Post by enkonyito »

With the YafaRay Blender-Exporter, I was able to find examples of XML scenes using different types of light.

enkonyito, before I investigate your problem, could you try again with this new version fist?
With this version 1.0 Beta 4, the following three problems occur again.

1. No light emitted for arealight.
Example of implementation.

Code: Select all

params.put("type", "arealight");
Point3f corner = new Point3f(-100, -100, 100);
Point3f point1 = new Point3f(-100, 100, 100);
Point3f point2 = new Point3f(100, -100, 100);
params.put("corner", corner);
params.put("point1", point1);
params.put("point2", point2);
params.put("from", new float [] {0, 0, 100});
params.put("color", new float [] {
          ((lightColor >> 16) & 0xFF) * ((this.homeLightColor >> 16) & 0xFF),
          ((lightColor >> 8) & 0xFF) * ((this.homeLightColor >> 8) & 0xFF),
          (lightColor & 0xFF) * (this.homeLightColor & 0xFF), 1});
params.put("power", power);
params.put("samples", 4);
createLight(UUID.randomUUID().toString(), params);
I think it's related to line 84 of the arealight.cc file even for double sided panels.

2. Identifier not taken into account for spherelight and arealight.
To make the sphere or area lights visible, add

Code: Select all

params.put("object", id);
returns the error "[font=courier new]Invalid object ID given![/font]".
How to find this identifier after the creation of the object (mesh)?

3. SH3D crash for meshlight.
Example of implementation.

Code: Select all

params.put("type", "meshlight");
params.put("double_sided", false);
params.put("light_enabled", true);
params.put("object", 1);
params.put("color", new float [] {
          ((lightColor >> 16) & 0xFF) * ((this.homeLightColor >> 16) & 0xFF),
          ((lightColor >> 8) & 0xFF) * ((this.homeLightColor >> 8) & 0xFF),
          (lightColor & 0xFF) * (this.homeLightColor & 0xFF), 1});
params.put("power", power);
params.put("samples", 4);
createLight(UUID.randomUUID().toString(), params);
These portions of code are implemented in the [font=courier new]exportLightSource[/font] method of the [font=courier new]YafarayRenderer[/font] class.
EnkoNyito
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 2 guests