Page 1 of 1

I want to implement a standard surface material similar to arnold

Posted: Wed Sep 02, 2020 2:06 am
by BruceXu
I want to implement a standard surface material similar to arnold, like https://autodesk.github.io/standard-surface/
However, when luxcore performs evaluation, only one of the reflection and transmission can be calculated at a time. How can I implement multiple lobes like a standard surface?

Re: I want to implement a standard surface material similar to arnold

Posted: Wed Sep 02, 2020 9:26 am
by BruceXu
BruceXu wrote: Wed Sep 02, 2020 2:06 am I want to implement a standard surface material similar to arnold, like https://autodesk.github.io/standard-surface/
However, when luxcore performs evaluation, only one of the reflection and transmission can be calculated at a time. How can I implement multiple lobes like a standard surface?
Or similar to the principled BSDF of cycles, adding a transmit to the Disney model

Re: I want to implement a standard surface material similar to arnold

Posted: Wed Sep 02, 2020 11:10 am
by B.Y.O.B.
You could take a look at the disney material, especially https://github.com/LuxCoreRender/LuxCor ... y.cpp#L269

Re: I want to implement a standard surface material similar to arnold

Posted: Wed Sep 02, 2020 11:43 am
by BruceXu
B.Y.O.B. wrote: Wed Sep 02, 2020 11:10 am You could take a look at the disney material, especially https://github.com/LuxCoreRender/LuxCor ... y.cpp#L269
Yes, I'm actually learning the luxcore code, but the disney material in luxcore does not have the transmission effect.
I want to add the transmission effect to the luxcore disney material.
Currently, I add a transmit branch using localLightDir.z * localEyeDir.z in the evaluate function and add a transmit branch using passThroughEvent in the sample function.
I don't know if I'm doing it right.

Re: I want to implement a standard surface material similar to arnold

Posted: Wed Sep 02, 2020 11:49 am
by Dade
BruceXu wrote: Wed Sep 02, 2020 2:06 am I want to implement a standard surface material similar to arnold, like https://autodesk.github.io/standard-surface/
However, when luxcore performs evaluation, only one of the reflection and transmission can be calculated at a time. How can I implement multiple lobes like a standard surface?
Just check the glass code: https://github.com/LuxCoreRender/LuxCor ... s.cpp#L190

You decide if to transmit or reflect (https://github.com/LuxCoreRender/LuxCor ... s.cpp#L230) than adjust the PDF according what you are doing (https://github.com/LuxCoreRender/LuxCor ... s.cpp#L236 for reflect and https://github.com/LuxCoreRender/LuxCor ... s.cpp#L247 for transmit).

Re: I want to implement a standard surface material similar to arnold

Posted: Thu Sep 03, 2020 1:04 am
by BruceXu
Dade wrote: Wed Sep 02, 2020 11:49 am
BruceXu wrote: Wed Sep 02, 2020 2:06 am I want to implement a standard surface material similar to arnold, like https://autodesk.github.io/standard-surface/
However, when luxcore performs evaluation, only one of the reflection and transmission can be calculated at a time. How can I implement multiple lobes like a standard surface?
Just check the glass code: https://github.com/LuxCoreRender/LuxCor ... s.cpp#L190

You decide if to transmit or reflect (https://github.com/LuxCoreRender/LuxCor ... s.cpp#L230) than adjust the PDF according what you are doing (https://github.com/LuxCoreRender/LuxCor ... s.cpp#L236 for reflect and https://github.com/LuxCoreRender/LuxCor ... s.cpp#L247 for transmit).
OK,I'll try.

Re: I want to implement a standard surface material similar to arnold

Posted: Thu Sep 03, 2020 2:14 am
by BruceXu
Dade wrote: Wed Sep 02, 2020 11:49 am
BruceXu wrote: Wed Sep 02, 2020 2:06 am I want to implement a standard surface material similar to arnold, like https://autodesk.github.io/standard-surface/
However, when luxcore performs evaluation, only one of the reflection and transmission can be calculated at a time. How can I implement multiple lobes like a standard surface?
Just check the glass code: https://github.com/LuxCoreRender/LuxCor ... s.cpp#L190

You decide if to transmit or reflect (https://github.com/LuxCoreRender/LuxCor ... s.cpp#L230) than adjust the PDF according what you are doing (https://github.com/LuxCoreRender/LuxCor ... s.cpp#L236 for reflect and https://github.com/LuxCoreRender/LuxCor ... s.cpp#L247 for transmit).
Emmm, in addition, is the wo and wi to determine whether to reflect or transmit in evaluate funtion?

Re: I want to implement a standard surface material similar to arnold

Posted: Thu Sep 03, 2020 10:50 am
by Dade
BruceXu wrote: Thu Sep 03, 2020 2:14 am Emmm, in addition, is the wo and wi to determine whether to reflect or transmit in evaluate funtion?
Glass is a specular material (i.e. a delta one) so GlassMaterial::Evaluate() always return "Black": https://github.com/LuxCoreRender/LuxCor ... ss.cpp#L41

In GlassMaterial::Sample(), the decision if to sample transmission or reflection is based on the random variable "passThroughEvent": https://github.com/LuxCoreRender/LuxCor ... s.cpp#L230