Announcement

Collapse
No announcement yet.

Questions about code in "brdf_phong_impl.h"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Questions about code in "brdf_phong_impl.h"

    hi,

    I have some(actually, plenty of) questions about the ideas behind the code presented in "brdf_phong_impl.h". Since the amount of questions are too much, i think it would be better to start with the ones that prevent me from understanding the whole structure of implementing custom BRDF node. Here are the questions:

    1. I see some member functions equipped with "lightColor" parameters (i.e. getDiffuseColor, getLightMult & eval) and questions related to this parameters are:
    - Does the "lightColor" parameter include the total amount of light (from Local+Global Illumination) arriving current shading point ?
    - Why lightColor multiply with transparency only in raytracing context (I guess that the condition "nsamples>0" implys performing raytracing) ?
    - Why lightColor still have to multiply with transparency even the return result is not related to lightColor, such as in "getDiffuseColor" member function ?
    - why "getLightMult" member function use the unmodified lightColor(i.e. not multiply with transparency) for return value but still multiply it with transparency after setting up the return value ?

    2. The "hilight_glossiness" and "reflection_glossiness" in "init" seems to be the result of performing some value remapping of user-provided glossiness information, but what is this value remapping derived from ? Why this operation is necessary in raytrace context ?

    3. Here are questions about the member function setMtlResult:
    - Is it correct to set the rc.mtlresult.transp with rc.mtlresult.transp ? If not, what's the difference between the information provided by calling "brdf->getTransparency(rc)" & rc.mtlresult.transp ?
    - What's the difference between transp, alpha, alphaTransp in materialResult ? I suppuse that all these fields are just for the same purpose in initial but i can't certain about that after noticing they're asigned with different value
    - The "traceForward" member function in "brdf_phong_impl.h" reveal the situation that setMtlResult is not a necessary call in all condition branch, and this bring up the question that when should i call the setMtlResult function after performing some calculation about reflected light or material appearance ?
    - The explanation about the VRayContext's mtlresult and shaderesult attribute in document is oversimplified for me. One of the major problem when writing VRay BRDF\material node is: i don't know when i have to update the content in mtlresult\shaderesult since they're really very similar for me.

    4. Does the "k" weight in "eval" member function implies BRDF normalization factor ? It looks somewhat like nomralization factor but no PI in it (I remember many normalization factor include PI term)

    5. I found a file called "brdfsampler.h" in example but non other files include it & use it. The content of "brdfsampler.h" seems somewhat equivalent to "brdf_phong_impl.h" in functionality. Is it for old-version shader ?

    Thanks.
Working...
X