Forums
You are not logged in.
#1 2011-04-23 05:11:26
- EyeForComplexity
- New member
- Registered: 2009-10-08
- Posts: 7
how do I add renderpass GI/OCC to my written shaders?
hello everyone,
I would like to make my own shaders use the "full global illumination" - "occlusion" effects that can be found in the renderpass settings. I understand that it needs some code from the "global_illumination.h" file found in the 3delight install directory and I think the "getGlobalIllumination()" function. But I have no idea how to use it in my shader or how to add it to the final mix.
at the moment I am just trying to add it to a super basic lambert :
surface LambertGI(float Kd = 0.85;
color surfCol = color (1,1,1);
)
{
normal Nn = normalize(N);
Oi = Os;
Ci = Oi * surfCol * (Kd * diffuse(Nn));
}
If anyone could help me out and show how I could get it to work for this shader I would really appreciate it.
Semir
Offline
#2 2011-04-23 10:03:24
Re: how do I add renderpass GI/OCC to my written shaders?
A relatively simple way to find out is to check a .sl file that has been generated by 3dfm and go from there. Did you try that ? I would use a simple shader, such as lambert, since complicated hyper shade networks will be hard to follow.
-- Aghiles
Offline
#3 2011-04-24 04:11:05
- EyeForComplexity
- New member
- Registered: 2009-10-08
- Posts: 7
Re: how do I add renderpass GI/OCC to my written shaders?
yes I am trying to figure it out from the 3delight translated shaders but I am still having difficulty to really understand what is going on, there is not really any documentation about it.
Offline
#4 2011-05-04 16:08:29
Re: how do I add renderpass GI/OCC to my written shaders?
Here is something that works with the diffuse GI AOVs:
Code:
surface LambertGI(
float Kd = 0.85;
color surfCol = color (1,1,1);
#ifdef USE_AOV_aov_occlusion
output varying color aov_occlusion = 0;
#endif
#ifdef USE_AOV_aov_env_diffuse
output varying color aov_env_diffuse = 0;
#endif
#ifdef USE_AOV_aov_indirect
output varying color aov_indirect = 0;
#endif
#ifdef USE_AOV_aov_gi
output varying color aov_gi = 0;
#endif
)
{
normal Nn = normalize(N);
// For 3dfm global illumination
color __transparency = color(1.0);
#include "global_illumination.h"
color transparency = 0.0;
color Cdiff = Kd * diffuse(Nn);
Cdiff = getGlobalIllumination(Cdiff, transparency);
Oi = Os;
Ci = Oi * surfCol * Cdiff;
}To compile:
Code:
shaderdl -I $DELIGHT/maya/rsl/ -DUSE_AOV_aov_occlusion -DUSE_AOV_aov_env_diffuse -DUSE_AOV_aov_indirect -DUSE_AOV_aov_gi LambertGI.sl
Offline
#5 2011-12-20 12:31:56
- lunatik
- Member
- From: Bulgaria
- Registered: 2008-01-12
- Posts: 73
Re: how do I add renderpass GI/OCC to my written shaders?
In case somebody wonders why the point-based global illumination doesn't work (as I did): it's because you have to add this at the end of the shader in order to get the point cloud baked in the prepass.
Code:
illuminance("bakelight", P, "send:light:do_bake", 1)
{
}Offline

