POV-Ray : Newsgroups : povray.general : Contour map -- plane vs. isosurface Server Time
30 Jul 2024 18:17:27 EDT (-0400)
  Contour map -- plane vs. isosurface (Message 1 to 7 of 7)  
From: How Camp
Subject: Contour map -- plane vs. isosurface
Date: 27 Jun 2008 08:50:00
Message: <web.4864e13d83231c9ec59235590@news.povray.org>
Back in 2000, Warp posted an interesting isosurface pigment to help someone
asking about contour maps:

http://news.povray.org/povray.advanced-users/thread/<3A2CEC7C.83FC2739@psu.edu>/

I've modified the code slightly, and am attempting to do something simple (I
think).  I'd like to create a contour pigment that can be applied to either an
isosurface (with results similar to Warp's) or to a plane where the contour
lines match up with the 3D gradient pattern.

I'm having trouble understanding how to correctly implement a non-gradient
pigment that can be applied to either the isosurface or the plane.  Surely I'm
making this way harder than it really is...?

My (incorrect) attempt to modify Warp's code looks like this:

-------

#version 3.6;
#include "functions.inc"

#declare f_isobar =
function { y-f_noise3d(x,y,z) }

#declare CMap =
color_map{
   [0.0 rgb <0, 0.0, 0.0>]
   [0.1 rgb <0, 0.0, 0.0>]
   [0.1 rgb <1, 0.7, 0.2>]
   [1.0 rgb <1, 0.7, 0.2>]
}

#declare PContour =
pigment
{
   gradient y
   color_map {CMap}
   scale <1, 1/4, 1>
}

#declare PContour2 =
pigment{
   function {f_isobar(x,y,z)}
   color_map {CMap}
   scale <1, 1/4,1>
 }

camera {location <0, 15, 0> look_at 0}
light_source {<50, 200, -100>, 1}

isosurface
{
  function { f_isobar(x,y,z) }
  contained_by {box {<-5,0,-5><5,1,5>}}
  scale <1,4,1>
  pigment {PContour}
  finish { specular .25 }
}

plane {y, 0.5 scale <1,4,1> pigment{PContour2} finish { specular .25 }}


Post a reply to this message

From: Mike Williams
Subject: Re: Contour map -- plane vs. isosurface
Date: 27 Jun 2008 12:45:13
Message: <hTkjGFGxjRZIFwm$@econym.demon.co.uk>
Wasn't it How Camp who wrote:
>Back in 2000, Warp posted an interesting isosurface pigment to help someone
>asking about contour maps:
>
>http://news.povray.org/povray.advanced-users/thread/<3A2CEC7C.83FC2739@
>psu.edu>/
>
>I've modified the code slightly, and am attempting to do something simple (I
>think).  I'd like to create a contour pigment that can be applied to either an
>isosurface (with results similar to Warp's) or to a plane where the contour
>lines match up with the 3D gradient pattern.
>
>I'm having trouble understanding how to correctly implement a non-gradient
>pigment that can be applied to either the isosurface or the plane.  Surely I'm
>making this way harder than it really is...?

Are you trying to do anything remotely like this?

http://www.econym.demon.co.uk/isotut/isobars.htm

The code for that is

#declare F=function{f_noise3d(x/6,y/5,z/5)}

plane {
  z, 0
  pigment { function{F(x,y,0)}
    colour_map {
     [0.2 rgb 4][0.2 rgb 0][0.204 rgb 0][0.204 rgb 4]
     [0.3 rgb 4][0.3 rgb 0][0.304 rgb 0][0.304 rgb 4]
     [0.4 rgb 4][0.4 rgb 0][0.404 rgb 0][0.404 rgb 4]
     [0.5 rgb 4][0.5 rgb 0][0.504 rgb 0][0.504 rgb 4]
     [0.6 rgb 4][0.6 rgb 0][0.604 rgb 0][0.604 rgb 4]
     [0.7 rgb 4][0.7 rgb 0][0.704 rgb 0][0.704 rgb 4]
     }
  }
}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: How Camp
Subject: Re: Contour map -- plane vs. isosurface
Date: 27 Jun 2008 13:40:01
Message: <web.4865253bea33eefc59235590@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
>
> Are you trying to do anything remotely like this?
> http://www.econym.demon.co.uk/isotut/isobars.htm


Yeah, sort-of.  How would I take this pigment and 'drape' it over the top of an
isosurface generated with the same noise3d function?  The end result would be
an isosurface with the same contours as the plane, such that both pigments
match up together.

Thanks for the code snip, Mike.


Post a reply to this message

From: Warp
Subject: Re: Contour map -- plane vs. isosurface
Date: 27 Jun 2008 14:23:23
Message: <4865301b@news.povray.org>
How Camp <hac### [at] gmailcom> wrote:
> Yeah, sort-of.  How would I take this pigment and 'drape' it over the top of an
> isosurface generated with the same noise3d function?  The end result would be
> an isosurface with the same contours as the plane, such that both pigments
> match up together.

  I really don't understand what is it that you are trying to do.

  Are you trying to, perhaps, project the isobars of an isosurface onto
a plane (so that it will look like an elevation map)?

-- 
                                                          - Warp


Post a reply to this message

From: How Camp
Subject: Re: Contour map -- plane vs. isosurface
Date: 27 Jun 2008 15:25:02
Message: <web.48653db7ea33eefc59235590@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>
>   I really don't understand what is it that you are trying to do.
>
>   Are you trying to, perhaps, project the isobars of an isosurface onto
> a plane (so that it will look like an elevation map)?


Apologies.

Let's start with a contour plot like Mike showed.  A plane with isobaric data
(like a weather map of temperatures across a region).  My goal is to make a
corresponding isosurface that matches this isobaric data -- that is, the
contour lines match up with the isosurface's elevation.  Looking at the
isosurface from the 'top', I would expect to see a contour map that looks
identical to the planar map.

Using your trick, Warp, I can generate a contour map on my isosurface via a
gradient function.  Using a noise3D function like Mike, I can generate contour
lines on either the isosurface or the plane... I just can't seem to get the
syntax right to make them match.


Post a reply to this message

From: Mike Williams
Subject: Re: Contour map -- plane vs. isosurface
Date: 27 Jun 2008 16:19:34
Message: <IX0pHdAxsUZIFwT9@econym.demon.co.uk>
Wasn't it How Camp who wrote:
>Mike Williams <nos### [at] econymdemoncouk> wrote:
>>
>> Are you trying to do anything remotely like this?
>> http://www.econym.demon.co.uk/isotut/isobars.htm
>
>
>Yeah, sort-of.  How would I take this pigment and 'drape' it over the top of an
>isosurface generated with the same noise3d function?  The end result would be
>an isosurface with the same contours as the plane, such that both pigments
>match up together.

#version 3.5;
#include "functions.inc"

camera {
  location  <0,3,-5>
  look_at   <0,1,0>
}

light_source {<-100,0,-100> colour rgb 1}

#declare F=function{f_noise3d(x,y,z)}

#declare P =   pigment { function{F(x,0,z)}
    colour_map {
     [0.2 rgb 4][0.2 rgb 0][0.204 rgb 0][0.204 rgb 4]
     [0.3 rgb 4][0.3 rgb 0][0.304 rgb 0][0.304 rgb 4]
     [0.4 rgb 4][0.4 rgb 0][0.404 rgb 0][0.404 rgb 4]
     [0.5 rgb 4][0.5 rgb 0][0.504 rgb 0][0.504 rgb 4]
     [0.6 rgb 4][0.6 rgb 0][0.604 rgb 0][0.604 rgb 4]
     [0.7 rgb 4][0.7 rgb 0][0.704 rgb 0][0.704 rgb 4]
     }
  }

isosurface {
  function {y-F(x,0,z)*2}
  max_gradient 5
  contained_by {box {-5,5}}
  pigment {P}
}


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: How Camp
Subject: Re: Contour map -- plane vs. isosurface
Date: 30 Jun 2008 10:20:01
Message: <web.4868ea68ea33eefc59235590@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:

> #declare P =   pigment { function{F(x,0,z)}...

> isosurface {
>   function {y-F(x,0,z)*2}...


Thanks, Mike.  This turned out to solve my problem.  I kept trying to include
the 'y-' in my pigment definition, which is silly.  Clearly, a misconception on
my part.

Much appreciated!


Post a reply to this message

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