|
|
> Aren't shaders used mainly for pseudo-realistic effects (such as creating
> shadows by superimposing a transparent texture generated from a stencil
> buffer)
> rather than proper raytracing?
Yes, but that's only because they are mainly used by GPUs for real-time
applications. No reason at all why something similar can't be used in POV.
> How do you envision a shader being merged with a
> full-fledged raytracer such as povray?
What the shader must do, is to take some data as input (eg world space
coordinates, uvw texture coordinates, surface normal etc) and return a
colour value. You could just define it as another user defined function
type in POV.
Maybe something like:
#shader myShader( worldPos , texCoords , normal , rayDir)
#local color = <0,0,0,0,0>;
// add some suface normal modifier
#local normal += noise3d(worldPos)*0.1;
// add some basic ambient
#local color.rgb += <0.1,0.1,0.1>;
// loop through each light in the scene
#local n = 0;
#while( n < nLightsInScene )
// add simple diffuse lighting
#local color.rgb += vdot(normal,light[n].direction) * <0.7,0.4,0.4>;
// and some specular
#local color.rgb += pow( vdot(vreflect(rayDir,normal),lightDir[n]),40)) *
<1,1,1>;
#local n--;
#end
#end
Post a reply to this message
|
|