Multiple mesh vertex UVs, Colors and Alphas support

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

Multiple mesh vertex UVs, Colors and Alphas support

Post by Dade » Tue Nov 19, 2019 11:16 am

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
Posts: 1578
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by Sharlybg » Tue Nov 19, 2019 12:43 pm

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
Posts: 343
Joined: Wed Jan 10, 2018 8:04 am

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by marcatore » Tue Nov 19, 2019 3:46 pm

Very very good!!

Racleborg
Posts: 544
Joined: Sat Apr 07, 2018 10:31 am
Location: UK

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by Racleborg » Tue Nov 19, 2019 7:02 pm

Great news. Thank you :)

marcatore
Donor
Posts: 343
Joined: Wed Jan 10, 2018 8:04 am

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by marcatore » Wed Nov 20, 2019 7:56 am

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
Posts: 3421
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by Dade » Wed Nov 20, 2019 8:28 am

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: 202
Joined: Tue Mar 13, 2018 10:34 am

Re: Multiple mesh vertex UVs, Colors and Alphas support

Post by Egert_Kanep » Wed Nov 20, 2019 8:30 am

So with this addition we could possibly fake up to 6 UDIMS :D. If I got it right. This is an amazing addition

Post Reply