Multiple mesh vertex UVs, Colors and Alphas support

Discussion related to the LuxCore functionality, implementations and API.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Multiple mesh vertex UVs, Colors and Alphas support

Post by Dade »

I have added the support for multiple mesh vertex UVs, Colors and Alphas.

LC_MESH_MAX_DATA_COUNT

The max. number of UVs, Colors and Alphas sets associated to mesh vertices is 6. It is a parameter (LC_MESH_MAX_DATA_COUNT) defined at LuxCore compilation time.

PLY file format

PLY file format doesn't natively support multiple UVs, Colors and Alphas so I had to extend the file format. Usually UVs are defined as "s" and "t" vertex channels, I added the support for "s1/"t1", "s2"/t2", etc. up to LC_MESH_MAX_DATA_COUNT. "red1"/"green1"/blue1", "red2"/"green2"/blue2", etc. for colors and "alpha1", "alpha2", etc. for alphas.

uvmapping2d and uvmapping3d

Now texture mapping uvmapping2d and uvmapping3d accept an additional parameter (".uvindex") where you can select the data set to use:

Code: Select all

scene.textures.tex1.type = imagemap
scene.textures.tex1.file = map.png
scene.textures.tex1.gamma = 2.2
scene.textures.tex1.mapping.type= uvmapping2d
scene.textures.tex1.mapping.uvindex = 1
scene.textures.tex1.mapping.uvscale = 2 2
hitpointcolor, hitpointalpha and hitpointgrey

Now textures hitpointcolor, hitpointalpha and hitpointgrey accept an additional parameter (".dataindex") where you can select the data set to use.

Implicit usage

UVs coordinates are implicitly used in many other contexts. For instance, Glossy material anisotropic direction, Cloth material direction, Pointiness, etc. At the moment, they are all still using the first UV data set (i.e. index 0). Eventually, the support for an explicit selection of the UV data set to use can be easily added.

Scene::DefineMeshExt()

Scene::DefineMeshExt() is the new method used in LuxCore API to define meshes with multiple vertex data sets.
Support LuxCoreRender project with salts and bounties
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by Sharlybg »

That is a nice one ! thanks you and well done.
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
marcatore
Donor
Donor
Posts: 463
Joined: Wed Jan 10, 2018 8:04 am

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by marcatore »

Very very good!!
Racleborg
Posts: 621
Joined: Sat Apr 07, 2018 10:31 am
Location: UK

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by Racleborg »

Great news. Thank you :)
marcatore
Donor
Donor
Posts: 463
Joined: Wed Jan 10, 2018 8:04 am

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by marcatore »

Dade, just for my knowledge.
Why you must use PLY as export format?

I know that you 're not a 3dsmax developer, but how they can manage "infinite" ( I think that 255 is the max UV ID number available) UV IDs?
If you will be able to avoid export from Blender, you should have the same opportunity?

thank in advance.

In any case, it's already a great thing to have more than 1 ID.
For BYOB, I think that in the BlenderAddon, we should have or a constrained setting with the max number (6) or a tips near the ID number, avoiding to put a number outside the working ones.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by Dade »

marcatore wrote: Wed Nov 20, 2019 7:56 am Why you must use PLY as export format?
It was the format used by LuxRender, it is also not particularly important because it is used only to export/import scene in text format (there is also a binary format).
BlendLuxCore directly exchanges the meshes with LuxCore on RAM (it doesn't write any file).
Support LuxCoreRender project with salts and bounties
User avatar
Egert_Kanep
Posts: 237
Joined: Tue Mar 13, 2018 10:34 am

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by Egert_Kanep »

So with this addition we could possibly fake up to 6 UDIMS :D. If I got it right. This is an amazing addition
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by B.Y.O.B. »

Dade wrote: Tue Nov 19, 2019 11:16 am LC_MESH_MAX_DATA_COUNT

The max. number of UVs, Colors and Alphas sets associated to mesh vertices is 6. It is a parameter (LC_MESH_MAX_DATA_COUNT) defined at LuxCore compilation time.
Is there a reason why this can't be dynamic?
I already had a report about a user hitting this limit.

edit: It looks like Blender has a limit of 8, so it would be great if we could use that as well.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by Dade »

B.Y.O.B. wrote: Mon Dec 30, 2019 10:25 pm Is there a reason why this can't be dynamic?
GPUs and dynamic memory allocation don't go well together.
B.Y.O.B. wrote: Mon Dec 30, 2019 10:25 pm I already had a report about a user hitting this limit.

edit: It looks like Blender has a limit of 8, so it would be great if we could use that as well.
It has a cost (in term of memory and performance) but I guess it is small between 6 and 8 so I will switch to 8.
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by Dade »

Dade wrote: Tue Dec 31, 2019 1:45 am It has a cost (in term of memory and performance) but I guess it is small between 6 and 8 so I will switch to 8.
Done.
Support LuxCoreRender project with salts and bounties
Post Reply