POV-Ray : Newsgroups : povray.general : Plot 3d surface for math funtion : Re: Plot 3d surface for math funtion Server Time
8 Jul 2024 12:49:21 EDT (-0400)
  Re: Plot 3d surface for math funtion  
From: MichaelJF
Date: 2 Jun 2014 02:10:00
Message: <web.538c149abb296cda8ae775cb0@news.povray.org>
"xslittlegrass" <nomail@nomail> wrote:
> I'm trying to use POV-Ray to plot some mathematical 3d functions, and I can make
> a simple plot of the function, but I don't know how to make it look beautiful.
>
> For example, I'm trying to plot this function
>
> y=Sin(x)*Cos(z)
>
> using this code:
>
> isosurface {
> function { sin(x)*sin(z)-y }
>         accuracy 0.001
>         contained_by{box{-2*pi,2*pi}} open
>         max_gradient 5
>         pigment {rgb .9}
> }
> camera {
>   location <10,10,10>
>   look_at   <0.0, 0.0,  0.0>
> }
>
> light_source { <50,50,50> 1 }
> background { rgb <0,.25,.5> }
>
> and I can get a result look like this
> http://imgur.com/jxElYiI
>
> but how can we make it look like this
>
> http://www.mitchr.me/SS/mjrcalc/lispy/exPovWaveGraph-ART_p.png
>
> Any suggestions and comments are appreciated.

You can use a scaled and translated gradient Pigment with a Color_map. Something
like this

#include "colors.inc"

isosurface {
function { sin(x)*sin(z)-y }
        accuracy 0.001
        contained_by{box{-2*pi,2*pi}} open
        max_gradient 5
        pigment {
           gradient y
           color_map {
              [ 0 Blue ]
              [ 0.5 Green ]
              [ 1 Red ]
           }
           scale 2.02 // a Little bit larger than the object
           translate <0,-1.01,0>
        }
}
camera {
  location <10,10,10>
  look_at   <0.0, 0.0,  0.0>
}

light_source { <50,50,50> 1 }
background { rgb <0,.25,.5> }

May be you will add additional entries to the Color_map.

Best regards,
Michael


Post a reply to this message

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