Re: YafaRay rendering plug-in

by enkonyito » Thu Jan 23, 2020 2:52 am

Enkonyito, I made some tests about area and mesh lights, and you can use some working code found in the comments of [font=courier new]YafarayRenderer[/font] constructor.
In the source code you posted, [font=courier new]corner[/font], [font=courier new]point1[/font] and [font=courier new]point2[/font] must be arrays of 3 floats not [font=courier new]Point3f[/font] instances (by the way, [font=courier new]from[/font] parameter isn't used).
You should also take care of the orientation of the triangle built from [font=courier new]corner[/font], [font=courier new]point1[/font] and [font=courier new]point2[/font] (if ever it's wrongly oriented, just swap [font=courier new]corner[/font] and [font=courier new]point1[/font]).

About mesh lights, you have to provide the integer id of the mesh used as a light in a parameter named [font=courier new]object[/font]. This id is returned by [font=courier new]startTriMesh[/font] method so you'll have to store the ids of the meshes used as lights somewhere.
Good luck! [:)]
Thank you Puybaret for the advice on area lights! This works for unviewable light panels.

Image Image

Using

Code: Select all

long meshLightId = startTriMesh(-1, vertices.length / 3, verticesIndices.length / 3, false, uvs != null, 0, 0);
and

Code: Select all

params.put("object", Integer.parseInt(light.getProperty(this.INT_MESH_LIGHT_ID)));
Sweet Home 3D no longer crashes for mesh lights but the opaque light panel emits light without being luminescent.