|
|
Ilya Razmanov <ily### [at] gmailcom> wrote:
> I would like to superimpose several different wavy patterns, and
> probably something else for fluff. Maybe add, of maybe multiply them to
> each other. But for doung so, I need writing my own functions for
> normals, and I have no idea whether it's possible or not.
Of course.
I gave you the link to the documentation on POV-Ray's functions.
Pigments and normals are just functions that take x, y, and z as their arguments
and use that to create the procedural pattern.
You can access them by using the pigment {} statement as a sort of look-up table
into the function, and then use normal {function {}} to apply it.
Here's a small scene to show how that's done.
#version 3.8;
global_settings {assumed_gamma 1.0 }
#include "functions.inc"
camera {
location <0, 20, -50>
right x*image_width/image_height
up y
look_at <0, 10, 0>
rotate -y*20
}
light_source {<20, 50, -50> rgb 1} // for documentation illustrations
sky_sphere {pigment {rgb 1}}
#declare fmod = function (Value, Modulo) {select (Value, 1 - mod (abs (Value),
Modulo), mod (abs (Value), Modulo))}
#declare BW = color_map {
[0 rgb 0]
[1 rgb x+y]
}
#declare Spiral = function {pigment {spiral1 5}}
#declare Leopard = function {pigment {leopard}}
#declare Checker = function {pigment {checker 0 1 scale 3}}
#declare Crackle= function {pigment {crackle}}
#declare Mesh = function {f_mesh1 (x, z, y, 1, 0.2, 1, 0.1, 2)}
#declare Mesh2 = function {max(Mesh (x, y, z), 0)}
#declare Mixed = function {select (Checker (x, y, z).red, 0, Spiral(x, y,
z).red, Crackle (x, y, z).red)}
box {-10, 10 texture {pigment {rgb z} finish {specular 0.4} normal {function
{Spiral(x, y, z).red} bump_size 2}} }
box {-10, 10 texture {pigment {rgb z} finish {specular 0.4} normal {function
{Spiral(x, y, z).red*Leopard (x, y, z).red} bump_size 2}} translate x*20}
box {-10, 10 texture {pigment {rgb z} finish {specular 0.4} normal {function
{Spiral(x, y, z).red*(sin(x)+1)/2} bump_size 2}} translate -x*20}
box {-10, 10 texture {pigment {rgb z} finish {specular 0.4} normal {function
{Mixed (x, y, z)} bump_size 2}} translate -x*20 translate y*20}
box {-10, 10 texture {pigment {function {Mesh2(x, y, z)} color_map {BW}} finish
{specular 0.4} normal {function {Mesh (x, y, z)} bump_size 2}} translate x*20
translate y*20}
- BW
Post a reply to this message
Attachments:
Download 'normal function.png' (790 KB)
Preview of image 'normal function.png'
|
|