POV-Ray : Newsgroups : povray.general : Plot 3d surface for math funtion : Re: Plot 3d surface for math funtion Server Time
8 Jul 2024 12:09:09 EDT (-0400)
  Re: Plot 3d surface for math funtion  
From: xslittlegrass
Date: 2 Jun 2014 18:00:06
Message: <web.538cf39cbb296cda1e36f4d20@news.povray.org>
Thanks, that's very helpful.
Does Povray have predefined color functions so that we can use them instead of
manually set the color function every time? for example, commonly used color
function such as
hue, temperature map, jet, etc?

Best,
xslittlegrass



"MichaelJF" <mi-### [at] t-onlinede> wrote:
> "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.