Skip to content

Instantly share code, notes, and snippets.

@linniksergey
Last active August 29, 2015 14:26
Show Gist options
  • Save linniksergey/19abfd5a94881a6fb0ff to your computer and use it in GitHub Desktop.
Save linniksergey/19abfd5a94881a6fb0ff to your computer and use it in GitHub Desktop.
#include "math.h"
void myDiffuse(vector color, nN, diffuseNoShadowPass, diffusePass, shadowPass; string categories, lightmask)
{
diffuseNoShadowPass = {0, 0, 0};
diffusePass = {0, 0, 0};
shadowPass = {0, 0, 0};
illuminance(P, nN, M_PI/2, bouncemask("diffuse"), "categories", categories, "lightmask", lightmask)
{
vector _diffuseNoShadowPass = Cl * color * dot(nN, normalize(L));
vector _diffusePass = shadow(_diffuseNoShadowPass);
vector _shadowPass = _diffuseNoShadowPass - _diffusePass;
storelightexport(getlightname(), "diffusePass", _diffusePass);
storelightexport(getlightname(), "diffuseNoShadowPass", _diffuseNoShadowPass);
storelightexport(getlightname(), "shadowPass", _shadowPass);
diffuseNoShadowPass += _diffuseNoShadowPass;
//diffusePass += shadow(diffuseNoShadowPass);
diffusePass += _diffusePass;
shadowPass += _shadowPass;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment