POV-Ray : Newsgroups : povray.binaries.images : Cell Shader: my try : slope pattern vs slope_map (from Cell Shader: my try) Server Time
16 Aug 2024 04:23:05 EDT (-0400)
  slope pattern vs slope_map (from Cell Shader: my try)  
From: TinCanMan
Date: 27 Apr 2002 13:23:11
Message: <3ccade7f@news.povray.org>
> Sounds similar to me. I've fiddled with this myself recently, but not
enough
> to understand. You mean, a slope pattern may use a slope_map, like pigment
> bumps take a pigment_map..? Documentation is a little complex I think.

I'll try this again.

You understand what surface normals are.  They are a perturbance of the
surface to give it a bumy appearance without actually changing the surface.
When using gradient pattern pattern as a normal pattern, by default you get
a sawtooth appearance:

 /| /| /| /|
/ |/ |/ |/ |

if you set the waveform to sine_wave, scallop_wave, cubic_wave , etc.  the
normal gains the associated appearance.  Slope_map furthers this to allow
you to specify your own surface normal waveform.
from 6.7.2.1:

    slope_map {
      [0   <0, 1>]   // start at bottom and slope up
      [0.5 <1, 1>]   // halfway through reach top still climbing
      [0.5 <1,-1>]   // abruptly slope down
      [1   <0,-1>]   // finish on down slope at bottom
    }
would give the same appearance as the triangle_wave waveform

    slope_map {
      [0    <0.5, 1>]   // start in middle and slope up
      [0.25 <1.0, 0>]   // flat slope at top of wave
      [0.5  <0.5,-1>]   // slope down at mid point
      [0.75 <0.0, 0>]   // flat slope at bottom
      [1    <0.0, 0>]   // finish flate slope at bottom
    }
this would give a a more complex normal.

see 'slopemap1.png' and 'slopemap2.png', the previos normals and slope_maps
are applied to a cylinder using the wood pattern. the bump_size has been
exagerated.

The slope pattern is not related to normals at all, it is a pattern not a
map.  It is applied the same as any other pattern, i.e, it can be used for
pigments, textures, normals, etc.  The slope pattern calculates the slope of
the object's surface at each point and applies the texture according to the
slope value. If you had a red sphere and wanted it white everywhere the
slope was less than 45degrees, you calculate the position by hand and use a
gradient pattern, but if you wanted to do it to, say, a blob shape, it would
be very difficult to do this way.  If we use the slope pattern it is very
easy:
    pigment{
      slope y
      color_map{
        [0.0 red 1]
        [0.75 red 1]
        [0.75 rgb 1]
        [1.0 rgb 1]
      }
    }

if we apply this to any shape the object will be white anywhere its slope
(relative to the direction vector 'y') is less than 45degrees see
'slope1.png'

the direction vector (y in this case) represents the direction the slope is
based on

slope values
0.0 = negative horizontal slope
0.25 = -45 degrees
0.5 = vertical
0.75 = 45 degrees
1.0 = positive horizontal
...etc.

this pattern can be very useful in several applications.  One place I use it
constantly is to apply dust to objects:

#declare TDusty=
texture{
  pigment{
    slope y
    color_map{
      [0.5 rgbt 1]
      [1.0 rgbt<0.65,0.65,0.60,0.75>]
    }
    poly_wave 1.1
  }
  finish{
    ambient 0
    diffuse 0.85
    brilliance .33
  }
}

see 'Slope2.png'

I hope this explains a little better.

-tgq


Post a reply to this message


Attachments:
Download 'slope2.png' (14 KB) Download 'Slope1.png' (14 KB) Download 'Slopemap1.png' (8 KB) Download 'slopemap2.png' (11 KB)

Preview of image 'slope2.png'
slope2.png

Preview of image 'Slope1.png'
Slope1.png

Preview of image 'Slopemap1.png'
Slopemap1.png

Preview of image 'slopemap2.png'
slopemap2.png


 

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