Page 1 of 1

bake engine

Posted: Mon Mar 29, 2021 12:35 pm
by BruceXu
In the code of bakecpu/lightmap, when calculating the next ray, why does the sampling direction not need to be adjusted based on the sign of calculation result about dot(sampledDir, geometryN)?

Re: bake engine

Posted: Mon Mar 29, 2021 12:51 pm
by Dade
BruceXu wrote: Mon Mar 29, 2021 12:35 pm In the code of bakecpu/lightmap, when calculating the next ray, why does the sampling direction not need to be adjusted based on the sign of calculation result about dot(sampledDir, geometryN)?
Where exactly, do you mean the BSDF::Evaluate() ?

Re: bake engine

Posted: Mon Mar 29, 2021 12:59 pm
by BruceXu
Dade wrote: Mon Mar 29, 2021 12:51 pm
BruceXu wrote: Mon Mar 29, 2021 12:35 pm In the code of bakecpu/lightmap, when calculating the next ray, why does the sampling direction not need to be adjusted based on the sign of calculation result about dot(sampledDir, geometryN)?
Where exactly, do you mean the BSDF::Evaluate() ?
Here it is.
https://github.com/LuxCoreRender/LuxCor ... thread.cpp +279~285

Re: bake engine

Posted: Mon Mar 29, 2021 1:27 pm
by Dade
BruceXu wrote: Mon Mar 29, 2021 12:59 pm Here it is.
https://github.com/LuxCoreRender/LuxCor ... thread.cpp +279~285
Notice the:

Code: Select all

const Vector sampledDir = bsdf.GetFrame().ToWorld(localSampledDir);
It works in local frame and, in the local frame, Z+ is always geometryN.

Re: bake engine

Posted: Tue Mar 30, 2021 1:25 am
by BruceXu
Dade wrote: Mon Mar 29, 2021 1:27 pm
BruceXu wrote: Mon Mar 29, 2021 12:59 pm Here it is.
https://github.com/LuxCoreRender/LuxCor ... thread.cpp +279~285
Notice the:

Code: Select all

const Vector sampledDir = bsdf.GetFrame().ToWorld(localSampledDir);
It works in local frame and, in the local frame, Z+ is always geometryN.
:D :D :D
I see, thank you.