Hello,
I am reading Advanced Renderman, and I cannot reproduce the Voronoi
noise thresholding described in the end of chapter 10 using Gelato.
Here is the code I am using:
#include "stdshader.h"
#include "noises.h"
surface test
(
string shadingspace = "shader"
[[ string description = "Shading space",
string UItype = "coordsys" ]],
float shadingfreq = 1
[[ string description = "Shading frequency" ]]
)
{
point Pshad = shadingfreq * transform(shadingspace, P);
float f1, f2;
point p1, p2;
voronoi(Pshad, 1, f1, p1, f2, p2);
float scalefactor = distance(p1, p2) / (distance(Pshad, p1) +
distance(Pshad, p2));
C = step(0.05 * scalefactor, f2 - f1);
}
Can someone tell me what I am doing wrong?
SIDE NOTE:
The file implementing voronoi noise noises.h is situated in C:\Program
Files\NVIDIA Cor****ation\Gelato\shaders. From the comments I understand
that it is adapted from Renderman Shading Language implementation.
There is bug on line 171:
// The stuff that Ken Musgrave calls "VLNoise"
#define VLNoise(Pt,scale) (snoise(vsnoise(Pt)*scale+Pt))
since there is no vsnoise in Gelato, snoise should be used.


|