POV-Ray : Newsgroups : povray.newusers : pigment relative to normal vector? Server Time
27 Nov 2024 15:41:06 EST (-0500)
  pigment relative to normal vector? (Message 1 to 5 of 5)  
From: Justin Smith
Subject: pigment relative to normal vector?
Date: 9 Oct 2002 22:40:05
Message: <web.3da4e854a8bbf4f436ff7d20@news.povray.org>
This probably can't be done, but I want to be sure. Is there a way to assign
some kind of color_map to an object so that the actual color depends on the
vector of the surface normal? For example, if I were using a mountain
surface and I wanted realistic snow fields on it, it would be useful to be
able to have the parts with surface normals pointing mostly up to be
colored white, and parts with the up part of the vector ~ 0 to be colored a
stone-like shade, since snow would mostly collect in the ravines and not on
the sides of the cliffs.

-Justin Smith


Post a reply to this message

From: hughes, b 
Subject: Re: pigment relative to normal vector?
Date: 9 Oct 2002 23:27:59
Message: <3da4f3bf@news.povray.org>
"Justin Smith" <t74### [at] yahoocom> wrote in message
news:web.3da4e854a8bbf4f436ff7d20@news.povray.org...
> This probably can't be done, but I want to be sure. Is there a way to
assign
> some kind of color_map to an object so that the actual color depends on
the
> vector of the surface normal?

See the slope pattern in the Scene Help. It's at section 6.7.11.30 or just
search for slope and look at Patterns. So yes, it can be done. Don't confuse
it with the slope_map.
--
Farewell,
Bob


Post a reply to this message

From: Tom Melly
Subject: Re: pigment relative to normal vector?
Date: 10 Oct 2002 05:51:46
Message: <3da54db2$1@news.povray.org>
"Justin Smith" <t74### [at] yahoocom> wrote in message
news:web.3da4e854a8bbf4f436ff7d20@news.povray.org...

As advised, use "slope" - here's a simple example:

#declare MountTex =
texture{
  slope y
  texture_map{
    [0.64 pigment{Grey}]
    [0.66 pigment{White}]
  }
}

sphere{0,5 texture{MountTex}}


Post a reply to this message

From: Tom Melly
Subject: Re: pigment relative to normal vector?
Date: 10 Oct 2002 07:03:51
Message: <3da55e97$1@news.povray.org>
"Tom Melly" <tom### [at] tomandlucouk> wrote in message
news:3da54db2$1@news.povray.org...

<snip>

Here's a more complex (but not entirely succesful) example:


#version 3.5;

#include "colors.inc"
#include "functions.inc"

global_settings {
  ambient_light 0
  assumed_gamma 1.0
  radiosity {
    pretrace_start 0.08           // start pretrace at this size
    pretrace_end   0.04           // end pretrace at this size
    count 35                      // higher -> higher quality (1..1600) [35]
    nearest_count 5               // higher -> higher quality (1..10) [5]
    error_bound 1.8               // higher -> smoother, less accurate [1.8]
    recursion_limit 3             // how much interreflections are calculated
(1..5+) [3]
    low_error_factor .5           // reduce error_bound during last pretrace
step
    gray_threshold 0.8            // increase for weakening colors (0..1) [0]
    minimum_reuse 0.015           // reuse of old radiosity samples [0.015]
    brightness 1                  // brightness of radiosity effects (0..1) [1]

    adc_bailout 0.01/2
  }
}

// ----------------------------------------

camera {
  location  <0.0, 5, -10.0>
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
  pigment {
    wrinkles
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}

// ----------------------------------------

#declare BaseRockTex =
texture{
  pigment{granite scale 0.25 pigment_map{[0.0 Black][0.5 Gray10][1.0 Gray50]}}
  finish{ambient 0 diffuse 0.8}
  normal{
    average
    normal_map{
      [dents 15 scale 1 ]
      [granite 15 scale 1 turbulence 0.25]
      [marble 15 scale 1 turbulence 0.5]
      [crackle 15 scale 1 turbulence 0.5]
    }
  }
}

#declare SnowTex =
texture{
  pigment{rgb <0.5,0.5,1>} //<0.9,0.9,1.9>}
  finish{ambient 0.10 diffuse 0.85}
  normal{
    average 2
    normal_map{
      [dents 2 scale 1/25]
      [bozo 1 scale 4 turbulence 0.75]
    }
  }
}

#declare RockTex =
texture{
  marble rotate z*90 scale 10 turbulence 0.5
  texture_map{
    [0.9 BaseRockTex scale 0.01]
    [0.9 bozo scale 10 texture_map{[0.5 BaseRockTex][0.5 SnowTex]}]
  }
}

#declare MountTex =
texture{
  slope y
  texture_map{
    [0.60 RockTex] // BaseRockTex scale 0.01] //[0.64 RockTex]
    [0.62 SnowTex]
  }
}


#declare MountMFFunc = function(x,y,z){f_ridged_mf(x,y,z, 0.9, 5, 10, 0.75, 5,
0)}
#declare MountFunc = function(x,y,z){y + MountMFFunc(x,0,z)*2}

#declare Mount =
isosurface{
  function{MountFunc(x,y,z)}
  contained_by{box{<-15,-5,-15>,<15,5,15>}}
  accuracy 0.001
  max_gradient 10 // 1 for ng
  //scale 100
  texture{MountTex}
  scale 10
}


object{Mount}


Post a reply to this message

From: Justin Smith
Subject: Re: pigment relative to normal vector?
Date: 10 Oct 2002 23:10:03
Message: <web.3da63ffa209470ebd24af4b60@news.povray.org>
Thanks for all the advice. I have experimented with "slope" on my existing
iso mountains, and it is starting to look pretty nice.


Post a reply to this message

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