POV-Ray : Newsgroups : povray.binaries.images : Isosurface rocks and slope texture : Re: Isosurface rocks and slope texture Server Time
29 Jul 2024 22:30:53 EDT (-0400)
  Re: Isosurface rocks and slope texture  
From: Le Forgeron
Date: 3 Jul 2013 09:47:09
Message: <51d42b5d$1@news.povray.org>
Le 03/07/2013 13:17, Thomas de Groot nous fit lire :
> I am experimenting with isosurfaces to make rock landscapes, using as a
> basis my arcane Geomorph macro of several years ago.
> 
> I am fairly satisfied with the rocks, but I have difficulties with the
> texture. I use a slope/altitude texture where I would like the grass to
> show on the /upper/ sides of rock ridges and not on the /underside/ as
> it does now. I tried different settings but to no avail. This is the
> code I use for the shown image:
> 
> texture {
>   slope {
>     <0.0, 0.3, 0.0> , 0.0 , 0.5
>     altitude <0, 1-0.3, 0.0> , LowerBound , UpperBound
>   }
>   texture_map {
>     [0.60 Grass]
>     [0.65 Soil]
>     [0.80 Rocks]
>   }
> }
> 
> Any idea how I could achieve what I want? The difficulty imo resides
> with the use of isosurfaces which have overhangs. A height_field would
> be easier in this case.
> 

Reading:

http://www.povray.org/documentation/view/3.6.1/393/

<0,0.3,0> is the direction of reference, so rather something like +y

Beware, going to -y evaluates to Low (here 0), and
going +y evaluates to High (here 0.5) (and horizontal x or z evaluates
to middle value (here 0.25) (but it's not linear, arcsinus is used, or
rather it's linear for the angle but not the projection)

Altitude add a gradient. here parallel to +y too.

At LowerBound, the value is 0, and 1 at UpperBound.

The value of slope and the value of altitude get merged using the
relative length of each vector (otherwise irrelevant). And it is *not* a
linear interpolation (but the final value is wrapped to be modulo 1.0),
it's just a basic weighted addition. (the slope value is [0,1), but the
altitude value can be out of range if LowerBound & UpperBound are too small)

So, let's assume +y is the normal where you want some grass to show.
slope { abs(L1)*y, 1, 0 // keep full range, inverted
// (y->0, vertical->0.5, overhang (surplomb)->1.0)
       altitude abs(L2)*y, LowerBound, UpperBound (
      }
 texture_map{
  [0.25 Grass] // flat & small slope are full of grass
  [0.45 Soil] // a slope without any grass
  [0.5 Rocks] // a vertical surface is rock, and so is overhanging
  }

you can then adjust the weight of L1 & L2. (nevertheless, L2 will
generate grass everywhere at LowerBound despite the normal, so better
have LowerBound far out of scope (or you might want to compress the
texture_map to 0.125/0.225/0.25 or further, to reduce the influence of
altitude LowerBound.

Assuming a ground at 0 and Upperbound at 100m, LowerBound might be
interesting at -100 or -200... (in function of the texture_map's
compression), with L2 about 0.01 or less; L1 can probably be 0.99 or a
bit less

(if Lowerbound & Upperbound are from the iso, maybe the Lowerbound value
in altitude should be replaced with Lowerbound - (Upperbound -
Lowerbound)*Factor )


Post a reply to this message

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