yaluxplug (Daz to LuxCoreRender 2.5 plugin): Help Needed

Discussion related to the LuxCore functionality, implementations and API.
danielbui78
Posts: 17
Joined: Wed Jun 23, 2021 10:47 pm

yaluxplug (Daz to LuxCoreRender 2.5 plugin): Help Needed

Post by danielbui78 »

Hi. I am updating an old Daz To LuxRender plugin I wrote in 2015 to work with LuxCoreRender 2.5 and the latest Daz Studio assets (Genesis 8.1 and PBRSkin/IrayUber shaders). I know that the RealityDS plugin is now open-sourced and have looked through the source code a little bit. I'll try to incorporate anything which is done better from it. However, I wrote my plugin back in 2015 to do a few things that RealityDS did not offer: native Daz Render Engine support (with potentially interactive rendering) and integrated network rendering. The network rendering code needs to be updated for LuxCoreRender, but I have most of my LXS export code now converted to CFG/SCN format. However, I'm having some trouble getting a few things to work correctly: (1) bumpmap strength scaling, (2) material mixing of glossy2 + metal2 materials, (3) UV-space flipping of IBL/HDR lighting file, (4) normal map usage without bump maps create black textures. I have little to no experience using LuxCoreRender, so I'm sure some of these issues are related to user error.

Regarding bumpmap strength scaling: I have been trying to use the texture type:mix to scale down the strength of bumpmap files. I am setting scene.textures.<>.texture1 to constfloat value of 0.5, and setting scene.textures.<>.texture2 to the original bumpmap. Then I am setting the scene.textures.<>.amount to the desired bumpmap strength. However, It does not seem that the amount is having any effect on the actual render. In my experience, most Daz Studio bumpmap textures need to be scaled down by at least 100x for LuxRender.

Regarding material mixing of glossy2 + metal2 materials: whenever I try mix glossy2 and metal2 materials together in my export code, I get several visual artifacts including random unlit triangles and altered position of scene lighting.

The issue related to IBL lighting is that I need to flip the V coordinate space of HDR textures so that they properly align to Iray rendering behavior. This actually seems to be a global issue with almost all textures from Daz to LuxRender; I am using UV scaling of (1, -1) to fix this for most textures, but I don't know if there is an equivalent feature to flip the coordinate space on an HDR image. If not, I can just write out a temporary HDR file with flipped coordinates, so this is not a big deal.

Finally, whenever a specify a normal map (with glossy2) using scene.materials.<>.normaltex but do not specify a bump texture with scene.materials.<>.bumptex, the entire material is rendered as a black space. Also, the Convergence is always at 0.000000% and never increases. I have gotten around this problem by inserting a constfloat1 texture as a "dummy" bumptex.


Here are some relevant images and the corresponding scene files:

Iray Reference:
Image

test-102a-yaluxplug.jpg (no bumpmaps, no material mixing):
cfg file: https://mod-place.com/perm/test-102-yaluxplug.cfg
scn file: https://mod-place.com/perm/test-102a-yaluxplug.scn
Image

test-102b-yaluxplug.jpg (bumpmaps enabled):
scn file: https://mod-place.com/perm/test-102b-yaluxplug.scn
Image

test-102c-yaluxplug.jpg (glossy2+metal2 mixing):
scn file: https://mod-place.com/perm/test-102c-yaluxplug.scn
Image


Here is a second set of images:

Iray Reference:
Image

test-103a-yaluxplug.jpg (no bumpmaps, no material mixing):
cfg file: https://mod-place.com/perm/test-103-yaluxplug.cfg
scn file: https://mod-place.com/perm/test-103a-yaluxplug.scn
Image

test-103b-yaluxplug.jpg (bumpmaps enabled):
scn file: https://mod-place.com/perm/test-103b-yaluxplug.scn
Image

test-103c-yaluxplug.jpg (glossy2+metal2 mixing):
scn file: https://mod-place.com/perm/test-103c-yaluxplug.scn
Image

test-103d-yaluxplug.jpg (bumpmap AND glossy2+metal2 mixing enabled):
scn file: https://mod-place.com/perm/test-103d-yaluxplug.scn
Image


Here is the black texture / normalmap issue:
scn file: https://mod-place.com/perm/test-104-yaluxplug.scn
Image


Once I am able to solve these issues, I will work on a few unimplemented features to reach parity with the Daz Iray renderer: Dual Lobe Specular Reflectivity, SSS/Translucency/Transmission, and Top Coat effects. Currently, I'm just blending the two specular lobe data together, but I will try to apply the second specular roughness values as a glossycoating material. I will try to use glossycoating to do the same with Top Coat color, reflection, bump. I have not looked into SSS/Translucency too much, but I'll try to use Volumes to reproduce those effects. In the future, I will try to look into using the Disney shader to replace all of the above effects.

Please let me know if you have any ideas as to what could be causing these issues or if you have any advice or comments. Thanks!

BTW, here is the github link: https://github.com/danielbui78/yaluxplug
and the main thread on the Daz Forums: https://www.daz3d.com/forums/discussion ... gin#latest
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: yaluxplug (Daz to LuxCoreRender 2.5 plugin): Help Needed

Post by Dade »

I will look into problems, one by one.
danielbui78 wrote: Thu Jun 24, 2021 1:00 am Regarding bumpmap strength scaling: I have been trying to use the texture type:mix to scale down the strength of bumpmap files. I am setting scene.textures.<>.texture1 to constfloat value of 0.5, and setting scene.textures.<>.texture2 to the original bumpmap. Then I am setting the scene.textures.<>.amount to the desired bumpmap strength. However, It does not seem that the amount is having any effect on the actual render. In my experience, most Daz Studio bumpmap textures need to be scaled down by at least 100x for LuxRender.
Nope, you need to use the "scale" texture instead of "mix" like in this example: https://github.com/LuxCoreRender/LuxCor ... p/bump.scn

It is important because classic bump mapping is not intuitively additive and multiplicative (i.e. it doesn't play well with math operations), scale texture has specific bump mapping dedicated code to work as you expect.
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: yaluxplug (Daz to LuxCoreRender 2.5 plugin): Help Needed

Post by Dade »

danielbui78 wrote: Thu Jun 24, 2021 1:00 am Regarding material mixing of glossy2 + metal2 materials: whenever I try mix glossy2 and metal2 materials together in my export code, I get several visual artifacts including random unlit triangles and altered position of scene lighting.
This sounds strange but I need a complete scene to check the problem (i.e. a zip with .cfg, .scn, .ply and images).

Anyway, mixing glossy2 and metal2 is a bit strange, you may want to check new LuxCore materials like Disney material for this kind of stuff.
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: yaluxplug (Daz to LuxCoreRender 2.5 plugin): Help Needed

Post by Dade »

danielbui78 wrote: Thu Jun 24, 2021 1:00 am The issue related to IBL lighting is that I need to flip the V coordinate space of HDR textures so that they properly align to Iray rendering behavior. This actually seems to be a global issue with almost all textures from Daz to LuxRender; I am using UV scaling of (1, -1) to fix this for most textures, but I don't know if there is an equivalent feature to flip the coordinate space on an HDR image.
There is, infinite light accepts a "LightToWorld" 4x4 transformation matrix as parameter. This should be the transformation you are looking for:

Code: Select all

scene.lights.infinitelight.type = infinite
scene.lights.infinitelight.file = scenes/simple-mat/arch.exr
scene.lights.infinitelight.transformation = 1 0 0 0   0 1 0 0   0 0 -1 0   0 0 0 1
Flipping the Z axis to have, as result, a flip of the HDR image.
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: yaluxplug (Daz to LuxCoreRender 2.5 plugin): Help Needed

Post by Dade »

danielbui78 wrote: Thu Jun 24, 2021 1:00 am Finally, whenever a specify a normal map (with glossy2) using scene.materials.<>.normaltex but do not specify a bump texture with scene.materials.<>.bumptex, the entire material is rendered as a black space. Also, the Convergence is always at 0.000000% and never increases. I have gotten around this problem by inserting a constfloat1 texture as a "dummy" bumptex.
LuxCore has single bump/normal map slot, you can not use both at the same time. ".bumptex" always overwrite ".normaltex".

Actually ".normaltex" is just an utility for the to automatically interpose a NormalMapTexture and to plug the result in ".bumptex". You can check the code to see how it works: https://github.com/LuxCoreRender/LuxCor ... s.cpp#L163

See, a NormalMapTexture is implicitly defined and used as bump map when you use ".normaltex".
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: yaluxplug (Daz to LuxCoreRender 2.5 plugin): Help Needed

Post by Dade »

BTW, use "SOBOL" sampler instead of "METROPOLIS": METROPOLIS is deprecated on GPUs and SOBOL works a lot better and is a lot faster.
Support LuxCoreRender project with salts and bounties
danielbui78
Posts: 17
Joined: Wed Jun 23, 2021 10:47 pm

Re: yaluxplug (Daz to LuxCoreRender 2.5 plugin): Help Needed

Post by danielbui78 »

Thanks so much for your replies! I am trying out all of your recommendations and will post an update to let you know how it goes. As for the glossy2+metal2 material mixing, I will try using just glossy2 and instead do the mixing at the subcomponent level (specular, roughness, reflections) to see if I can get the intended visual effect. In the long term, I'll definitely try to transition to Disney.
danielbui78
Posts: 17
Joined: Wed Jun 23, 2021 10:47 pm

Re: yaluxplug (Daz to LuxCoreRender 2.5 plugin): Help Needed

Post by danielbui78 »

Just wanted everyone to know that all prior artifact issues turned out to be caused by my AMD OpenCL drivers -- Intel CPU OpenCL and native PathCPU rendering all turned out to be working correctly from the very beginning. Since my last posting, I now have implemented metallic maps, dual lobe specular, subsurface scattering and Iray's PBR SkinShader emulation. I will try to post some more renderings when I get a chance.
yaluxplug-victoria-81-sss-test-2021-07-24.jpg
danielbui78
Posts: 17
Joined: Wed Jun 23, 2021 10:47 pm

Re: yaluxplug (Daz to LuxCoreRender 2.5 plugin): Help Needed

Post by danielbui78 »

BTW, I also have fork of LuxCoreRender 2.5 which contains a few quality of life additions such as SIGINT handling for graceful shutdown, and Windows Event handling. My plan is to add support for end-of-render specific image pipeline stage which runs when render is complete or user-initiated shutdown/abort event.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: yaluxplug (Daz to LuxCoreRender 2.5 plugin): Help Needed

Post by Dade »

danielbui78 wrote: Sun Jul 25, 2021 10:13 pm BTW, I also have fork of LuxCoreRender 2.5 which contains a few quality of life additions such as SIGINT handling for graceful shutdown, and Windows Event handling. My plan is to add support for end-of-render specific image pipeline stage which runs when render is complete or user-initiated shutdown/abort event.
You can create pull requests on GitHub if you want the changes integrated back on the main branch :idea:
Support LuxCoreRender project with salts and bounties
Post Reply