SDK: eval() and GI

Hi,

if I enable GI for rendering and add a RenderElement “GlobalIllumination”, I get the GI in the renderElement but not on my BeautyRGB..

How do I handle the GI in the eval() or any other function to add it to my final-output-color?

Aya~

Are you writing a material? This will be done automatically if you call VRenderMtl::shade(). You need to make sure that getDiffuseColor() returns the proper color of the surface.

Best regards,
Vlado

Yep, I am writing a Material.

Should getDiffuse() return only the color that will end up in the “VRayDiffuseFilter”-RenderElement, or realy the whole computed diffuse?

If it has to return the whole diffuse.. then, what’s the difference between “getDiffuse” and “eval” with the FBRDF_DIFFUSE flag?

I call the shade() function, but on the backside of my objects that is not illuminated by any light the beauty-RGB is still black… when I do the same with a VRay Material it is light gray (because of the GI)..

Aya~

Yes, it should return just the diffuse filter color for the surface.

I call the shade() function, but on the backside of my objects that is not illuminated by any light the beauty-RGB is still black… when I do the same with a VRay Material it is light gray (because of the GI)..Do you mean back side like the side that is in shadow from other lights, or the back view of a single surface (on the reverse side of the normal)?

Best regards,
Vlado

I made a image to show you what I mean :slight_smile:

My Shader isn’t reacting to GI at all :frowning:

Change the traceForward method like this, and it should work:```
void MyBaseBSDF::traceForward(VRayContext &rc, int doDiffuse) {
BRDFSampler::traceForward(rc, doDiffuse);
if (doDiffuse) rc.mtlresult.color+=rc.evalDiffuse()*diffuse_color;
}


Best regards,
Vlado

Here is also attached a version of the VRayBlinn material example with added diffuse component and transparency.

Best regards,
Vlado
vrayblinnmtl.zip (13.9 KB)

Hey, thanks a lot :slight_smile:
But I can’t download it, because I don’t have the permission for it :frowning:

Email me to vlado@chaosgroup.com and I’ll send it.

Best regards,
Vlado

(Could you delete the post with my mail adress when you got it? :slight_smile: )

Yep, I just replied to your email, apologies for the delay.

Best regards,
Vlado

Thanks a lot~ it’s working now :slight_smile: