Geometry vertex and triangle AOVs

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

Geometry vertex and triangle AOVs

Post by Dade »

Introduction

The initial discussion about storing arbitrary custom data associated mesh vertices and triangles started here: viewtopic.php?f=4&t=1884

Vertex and Triangle AOVs

LuxCore now supports up to 8 custom float values associated to each mesh vertex. It also supports up to 8 custom float values associated to each mesh triangle. They are totally arbitrary data that can be used by textures (see below) or more.

New "hitpointvertexaov" and "hitpointtriangleaov" textures

The new "hitpointvertexaov" and "hitpointtriangleaov" textures can be used for shading purpouse, like "hitpointcolor", "hitpointalpha" and "hitpointgrey":

Code: Select all

scene.textures.curvature_orig.type = hitpointvertexaov
scene.textures.curvature_orig.dataindex = 0
"makefloat3" texture

"makefloat3" texture can be used to join 3 AOV channels in a color if you need to transport a RGB value instead of a scalar values.

"random" texture

"random" is a new texture node that can used to randomize AOV values, for instance:

Code: Select all

scene.textures.aovtex.type = hitpointtriangleaov
scene.textures.aovtex.dataindex = 0
##
scene.textures.randomtexR.type = random
scene.textures.randomtexR.texture = aovtex
scene.textures.randomtexR.seed = 0
##
scene.textures.randomtexG.type = random
scene.textures.randomtexG.texture = aovtex
scene.textures.randomtexG.seed = 1
##
scene.textures.randomtexB.type = random
scene.textures.randomtexB.texture = aovtex
scene.textures.randomtexB.seed = 2
##
scene.textures.randomtex.type = makefloat3
scene.textures.randomtex.texture1 = randomtexR
scene.textures.randomtex.texture2 = randomtexG
scene.textures.randomtex.texture3 = randomtexB
The ".seed" parameter is added to the input value coming from the texture (in this case is used to get a random RGB color out of a single AOV value).
"makefloat3" texture can be used to join 3 AOV channels in a color if you need to transport a RGB value instead of a scalar values.

Shape "pointiness"

Shape Pointiness has been update to support vertex AOVs and to, optionally, store there the curvature information (instead of using the alpha channel):

Code: Select all

scene.shapes.luxshell.type = pointiness
scene.shapes.luxshell.aovindex = 0
If the ".aovindex" is not used or the value 4294967296 (2^32) is used, the curvature information will be stored in vertex alpha channel for compatibility with the past.

New shape "islandaov"

The new shape "islandaov" assigns, to a triangle AOV, the index of the "island", for instance:

Code: Select all

scene.shapes.hair_shape.type = strands
scene.shapes.hair_shape.file = scenes/strands/straight.hair
scene.shapes.hair_shape.tessellation.type = solidadaptive
scene.shapes.hair_shape.tessellation.solid.sidecount = 8
scene.shapes.hair_shape.tessellation.adaptive.maxdepth = 32
scene.shapes.hair_shape.tessellation.adaptive.error = 0.025
##
scene.shapes.hair_shape_aov.type = islandaov
scene.shapes.hair_shape_aov.source = hair_shape
scene.shapes.hair_shape_aov.dataindex = 0
hair.jpg
Assign island information to the hair mesh coming from a strand file.

New shape "randomtriangleaov"

The new shape "randomtriangleaov" can add/replace the triangle AOV with a randomized value, for instance:

Code: Select all

scene.shapes.hair_shape.type = strands
scene.shapes.hair_shape.file = scenes/strands/straight.hair
scene.shapes.hair_shape.tessellation.type = solidadaptive
scene.shapes.hair_shape.tessellation.solid.sidecount = 8
scene.shapes.hair_shape.tessellation.adaptive.maxdepth = 32
scene.shapes.hair_shape.tessellation.adaptive.error = 0.025
##
scene.shapes.hair_shape_aov.type = islandaov
scene.shapes.hair_shape_aov.source = hair_shape
scene.shapes.hair_shape_aov.dataindex = 0
##
scene.shapes.hair_shape_raov.type = randomtriangleaov
scene.shapes.hair_shape_raov.source = hair_shape_aov
scene.shapes.hair_shape_raov.srcdataindex = 0
scene.shapes.hair_shape_raov.dstdataindex = 0
This is a faster solution than using "random" texture because the value is baked at pre-processing stage.

New LuxCore API SetMeshVertexAOV() and SetMeshTriangleAOV()

LuxCore API has been extended with new Scene::SetMeshVertexAOV() and Scene::SetMeshTriangleAOV() to set the values from an application.
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: Geometry vertex and triangle AOV

Post by Dade »

Any other idea for useful information to store in geometry AOVs ?
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: Geometry vertex and triangle AOVs

Post by Dade »

About the "island" information: 2 triangles that share one or more edges are part of the same island but what about triangles that share a single vertex ?

Should they be considered has part of the same island or not ?
Support LuxCoreRender project with salts and bounties
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Geometry vertex and triangle AOVs

Post by B.Y.O.B. »

Any other idea for useful information to store in geometry AOVs ?
I have considered Blender vertex weights, but I can add this at some point in pyluxcoreforblender, it's not a pressing issue.
TODO: do we need a texture to compose 3 float sub-textures in an rgb value ? Or it can already be done with some existing texture ?
This can be done with the "combine RGB" texture (I think I named it "makefloat3" in Luxcore).
Dade wrote: Sat Mar 21, 2020 4:22 pm About the "island" information: 2 triangles that share one or more edges are part of the same island but what about triangles that share a single vertex ?
Should they be considered has part of the same island or not ?
In Cycles, they are part of the same island:
Attachments
Capture.PNG
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Geometry vertex and triangle AOVs

Post by Dade »

B.Y.O.B. wrote: Sat Mar 21, 2020 4:28 pm
TODO: do we need a texture to compose 3 float sub-textures in an rgb value ? Or it can already be done with some existing texture ?
This can be done with the "combine RGB" texture (I think I named it "makefloat3" in Luxcore).
Ok, updated the first post.
B.Y.O.B. wrote: Sat Mar 21, 2020 4:28 pm
Dade wrote: Sat Mar 21, 2020 4:22 pm About the "island" information: 2 triangles that share one or more edges are part of the same island but what about triangles that share a single vertex ?
Should they be considered has part of the same island or not ?
In Cycles, they are part of the same island:
Ok, I guess we can just match the Cycles brehavior.
Support LuxCoreRender project with salts and bounties
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Geometry vertex and triangle AOVs

Post by CodeHD »

Nice, thanks!

I think the cycles behaviour is a good idea. Am I right, that single lines without a face will not be rendered?
Then this can be used by the users to create pseudo-random patterns by manually connecting islands.
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Geometry vertex and triangle AOVs

Post by B.Y.O.B. »

CodeHD wrote: Sat Mar 21, 2020 6:33 pm Then this can be used by the users to create pseudo-random patterns by manually connecting islands.
If you need this kind of control you might be better off writing a custom script that writes to the vertex colors in Blender (or uses the new LuxCore API functions as described in this thread).
CodeHD
Donor
Donor
Posts: 437
Joined: Tue Dec 11, 2018 12:38 pm
Location: Germany

Re: Geometry vertex and triangle AOVs

Post by CodeHD »

B.Y.O.B. wrote: Sat Mar 21, 2020 7:00 pm If you need this kind of control you might be better off writing a custom script that writes to the vertex colors in Blender (or uses the new LuxCore API functions as described in this thread).
True, I could. For a large number of islands it might also be the only feasible option. But not everyone is a regular python user ;)
I beliveve that for a small number of islands, Click + Click + F in edit mode would be faster.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Geometry vertex and triangle AOVs

Post by Dade »

I have strange problem with Blender: if I export a cube with in .ply format (or with BlendLuxCore), all vertices seem duplicated and not shared (i.e. the cube has 24 vertices). What is going on ? How can I get a cube with 8 vertices out of Blender ?
Support LuxCoreRender project with salts and bounties
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Geometry vertex and triangle AOVs

Post by B.Y.O.B. »

Dade wrote: Mon Mar 23, 2020 1:09 pm I have strange problem with Blender: if I export a cube with in .ply format (or with BlendLuxCore), all vertices seem duplicated and not shared (i.e. the cube has 24 vertices). What is going on ? How can I get a cube with 8 vertices out of Blender ?
I guess each flat-shaded face has an exclusive set of vertices?
I'm getting 24 verts when I use the Blender .ply exporter, and 36 when I use the LuxCore FILESAVER engine.

Maybe we're doing something wrong in here? https://github.com/LuxCoreRender/LuxCor ... r.cpp#L835
Post Reply