POV-Ray : Newsgroups : povray.unofficial.patches : C source for four new patterns Server Time
2 Sep 2024 18:21:54 EDT (-0400)
  C source for four new patterns (Message 1 to 1 of 1)  
From: John VanSickle
Subject: C source for four new patterns
Date: 20 Jul 1999 18:31:11
Message: <3794FB6D.1D4F5E00@erols.com>
After trying to make a particular texture, and not getting much
success, I got the idea of modifying the crackle code (again) to create
a new pattern.  This led to the creation of another pattern, based on
similar code, and then while I was at it I decided to add two more
patterns that I'd been wanting awhile.  The C source is attached.

blotches

This pattern is like the crackle texture, except that each Voronoi region
is assigned a random value that is constant within the region.
The result is a bunch of randomly-centered, tightly-packed regions
with a solid random value in each.  If used as a color_map pattern,
it will yield irregular polygonal regions of differing random colors.

cells

This assigns a random value from 0 to 1 to each unit cube in 3d
space.

bands VECTOR_EXPRESSION

This computes the dot product of the evaluated point and the
supplied vector, and then applies the expression

  x-floor(x)

to the dot product.  The function returns 0 at the origin;
moving away from the origin, in a direction parallel to the
supplied vector, yields steadily increasing values from 0 to 1,
which repeat for every unit-length of distance along the vector
parallel to the given vector.  Moving in a direction opposite
the supplied vector results in decreasing values, starting at
1 and going down to 0, repeating as the evaluated point moves
farther in that direction.  Movement perpendicular to the
supplied vector results in no change.

This is different from the gradient pattern in two particulars:

 * the gradient pattern is mirrored around the origin; this
   pattern is not.  I got tired of having to translate my
   textures to get the origin away from where it would show.
 * the gradient pattern does not yield bands of consistent
   width for every supplied vector, whereas this pattern does.

sheet

  This is like the bands pattern, except that it instead of
being modified to yield a ramp_wave along the supplied vector,
the dot product is clamped to between 0 and 1, giving one
iteration of the ramp.  It is similar to the planar pattern,
except that there is no mirroring around the origin.

Hope you all have fun with this.  Let me know if you find a
bug.

Regards,
John


Post a reply to this message


Attachments:
Download 'patt3.c.txt' (9 KB)

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.