Hi Guys,
could you be so kind and tell me what should I pass to define normals in funcion DefineMesh?
I should pass one normal / triangle or one normal / vertex?
I'm trying with a simple cube taken from example: luxcorescenedemo.cpp
DefineMesh("myName", 24, 12, float[24 * 3], uint[12 * 3], null, null, null, null). -> works corectly
float[] normals = float[24 * 3];
for (int i = 0; i < 24; i++) //init with some default values
{
normals[i *3] = 0; normals[i *3 + 1] = 0; normals[i *3 + 2] = 1;
}
DefineMesh("myName", 24, 12, float[24 * 3], uint[12 * 3], normals, null, null, null). -> gives me segmentation fault when I start rendering
luxcore::Scene::DefineMesh parameters
Re: luxcore::Scene::DefineMesh parameters
Vertex normals (they are optional and used to have "smooth" surfaces). For instance, they are required to have a "smooth" sphere. If you want a faceted one, they are not required.bartek_zgo wrote: ↑Mon Oct 26, 2020 12:12 pm I should pass one normal / triangle or one normal / vertex?
Triangle normals can and are computed directly by LuxCore.
I assume it is "float[] normals = new float[24 * 3];" Are you using C++ or something else ?bartek_zgo wrote: ↑Mon Oct 26, 2020 12:12 pm I'm trying with a simple cube taken from example: luxcorescenedemo.cpp
DefineMesh("myName", 24, 12, float[24 * 3], uint[12 * 3], null, null, null, null). -> works corectly
float[] normals = float[24 * 3];
for (int i = 0; i < 24; i++) //init with some default values
{
normals[i *3] = 0; normals[i *3 + 1] = 0; normals[i *3 + 2] = 1;
}
DefineMesh("myName", 24, 12, float[24 * 3], uint[12 * 3], normals, null, null, null). -> gives me segmentation fault when I start rendering
luxcorescenedemo.cpp doesn't have an exmaple of normal usage but has an example of UV usage: https://github.com/LuxCoreRender/LuxCor ... o.cpp#L182
UV and normals work exactly in the same way aside form the size: 2 Vs 3 floats.
Note: there are 2 overloaded versions of DefineMesh(), one that take a single pointer UV/Normal/etc. buffer and one that take an array for pointers. The second is used to define multiple sets of UVs/Normals/etc. for the mesh.