
In hidsight, baking a lookup table of vectors and the spherical harmonics, might lead to artifacts, but with 1024 samples it doesnt look too bad
Feel free to download the source to sing along, its all based on the Sony Paper from 2003 see the PDF from SCEA
Python executable that write Spherical Harmonics Renderman header: sh1.py
Please find the resulting header file attached: SH.h
And a simple shader to calculate transmission based on the table of stratified samples above: localVisibility.sl
Its a bit clunky because I couldn't work out how to do two dimensional arrays in RSL, im glad to fix it up if it is possible.
The preprocessor thing isnt that sweet either :/
As below:
#include "SH.h"
surface localVisibility(
uniform float maxDistance = 10;
uniform string outputFolder = "";
)
{
SHVECTOR
SHSPH0
SHSPH1
SHCOEFF0
SHCOEFF1
SHCOEFF2
SHCOEFF3
SHCOEFF4
SHCOEFF5
SHCOEFF6
SHCOEFF7
SHCOEFF8
vector Nworld = vector(transform("world",N));
point Pworld = transform("world",P);
uniform float numSamples = 1024;
uniform float numCoeffs = 9;
varying float results[9]={0,0,0,0,0,0,0,0,0};
uniform float i,j;
varying float faceforward = 0;
varying float occl = 0;
for(i=0;i 0){
faceforward += 1;
float isHit = comp(transmission(P,destinationCurrent),0);
if (isHit > 0)
{
occl += 1;
for(j=0;j I dont think it is working yet, but it compiles and renders
Sam
- Log in to post comments