POV-Ray : Newsgroups : povray.newusers : 'contour lines' : Re: 'contour lines' Server Time
13 May 2024 22:05:36 EDT (-0400)
  Re: 'contour lines'  
From: William F Pokorny
Date: 11 Jan 2014 14:54:23
Message: <52d1a16f$1@news.povray.org>
On 01/10/2014 10:23 PM, Tops wrote:
>
> 1. I have an undulating surface and I wish to draw a sort of 'wire frame'
> pattern on the top of it so that you can clearly see the contours.
>
>...
>
> Ps. Is it also possible to do #1 for a height_field?
>
Like Michael, not complete sure what you are after, but here is some 
code to project an X/Y grid onto an isosurface "undulating" in Z. You 
could get to a heightfield like isosurface by using an image pigment in 
place of the built in f_ripples() function below.
Bill P.

//---- Example ----
  global_settings {
     assumed_gamma 1.0
     ambient_light srgb <1.0,1.0,1.0>
}
#declare Grey85 = srgbft <0.85,0.85,0.85,0.0,0.0>;
background { color Grey85 }
#declare Camera00 = camera {
     perspective
     location <1.4,1.4,-3.001>
     sky <0.0,1.0,0.0>
     angle 35.0
     right x*(image_width/image_height)
     look_at <0.0,0.0,0.0>
}
#declare White = srgbft <1.0,1.0,1.0,0.0,0.0>;
#declare Light00 = light_source { <50.0,50.0,-30.0>, White }
#declare Red = srgbft <1.0,0.0,0.0,0.0,0.0>;
#declare CylinderX = cylinder {
     <-1.1,0.0,0.0>, <1.1,0.0,0.0>, 0.01
     pigment { color Red }
}
#declare Green = srgbft <0.0,1.0,0.0,0.0,0.0>;
#declare CylinderY = cylinder {
     <0.0,-1.1,0.0>, <0.0,1.1,0.0>, 0.01
     pigment { color Green }
}
#declare Blue = srgbft <0.0,0.0,1.0,0.0,0.0>;
#declare CylinderZ = cylinder {
     <0.0,0.0,-1.1>, <0.0,0.0,1.1>, 0.01
     pigment { color Blue }
}
#include "functions.inc"
#declare Fnct00 = function (x,y,z) {
       z-(f_ripples(x*5.0,z*5.0,y*5.0)*0.1)
}
#declare Fnct00_inv = function (x,y,z) {
     -(z-(f_ripples(x*5.0,z*5.0,y*5.0)*0.1))
}
#declare Fnct01 = function (x,y,z) {
     max((Fnct00(x,y,z)-0.01),(Fnct00_inv(x,y,z)-0.01))
}#declare Iso00 = isosurface {
     function { Fnct01(x,y,z) }
     contained_by { box { <-0.98,-0.98,-0.2>,<0.98,0.98,0.2> } }
     threshold 0.0
     accuracy 0.0005
     max_gradient 1.8
     max_trace 1
}
#declare GridMult = 10.0;
#declare Fpig00 = function (x,y,z) { f_gradientX(x,y,z) }
#declare Fpig01 = function (x,y,z) { f_gradientY(x,y,z) }
#declare Fpig03 = function (x,y,z) { min(Fpig00(x,y,z),Fpig01(x,y,z)) }
#declare Fpig04 = function (x,y,z) { Fpig03(x*GridMult,y*GridMult,z) }
#declare Black = srgbft <0.0,0.0,0.0,0.0,0.0>;
#declare Grey55 = srgbft <0.55,0.55,0.55,0.0,0.0>;
#declare ColorMap00 = color_map {
     [ 0.000 Black ]
     [ 0.050 Black ]
     [ 0.051 Grey55 ]
     [ 1.000 Grey55 ]
}
#declare Pigm00 = pigment {
     function  { Fpig04(x,y,z) }
     color_map { ColorMap00 }
}
#declare Texture00 = texture { pigment { Pigm00 } }
#declare Obj00 = object {
     object { Iso00 }
     texture { Texture00 }
}
//---------------------------
camera { Camera00 }
light_source { Light00 }
object { CylinderX }
object { CylinderY }
object { CylinderZ }
object { Obj00 }
//----------------------


Post a reply to this message

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