POV-Ray : Newsgroups : povray.advanced-users : Lunar crater with isosurfaces ? : Re: Lunar crater with isosurfaces ? Server Time
28 Jul 2024 22:23:20 EDT (-0400)
  Re: Lunar crater with isosurfaces ?  
From: Mike Williams
Date: 18 Sep 2003 16:09:57
Message: <BGas$AA+9ga$Ew0Q@econym.demon.co.uk>
Wasn't it _Light_Beam_ who wrote:
>Can somebody help me to do this ?! I've uded a cylindrical pigment to make
>it but I don't know how to make it softly (soft edges of the crater) and
>combine with anothe function to replace crater's edge by rocks or collapsed
>edge... Thanks

I'd start from a mathematical function of two variables that looked
something like this (view with fixed width font)

                     _--_
____________________-    -________

and sweep it around the origin to create the crater shape.

I'd then add noise, and multiply the noise by the function itself, so
that the flat areas, where the function is close to zero, experience
little noise effect, but the crater rim experiences the full effect of
the noise.

Here's something you might use as a starting point.

It would probably look better with several noise functions at different
scales, with some small scale noise affecting the flat bits as well.


camera { location  <4, 30, -30> look_at <0, 0, 0>}

light_source {<-100,200,-100> colour rgb 1}
#include "functions.inc"

#declare R = 20;        // radius of contained by sphere
#declare Size=1/8;      // crater radius adjuster
#declare Sharp=40;      // sharpness adjuster
#declare Amp = 2;       // amplitude adjuster

#declare NS = 0.2;      // Noise inverse scale  
#declare NA = 1.0;      // Noise amplitude

// function of two variables that looks like a bump
#declare  F = function {pow(sin(x*Size),Sharp)*Amp}
                     
isosurface {
            // sweep it found the origin
  function { y-F(sqrt(x*x+z*z),y,z)
            // add some noise to the hig places
    -f_noise3d(x*NS,0,z*NS)*NA*F(sqrt(x*x+z*z),y,z)
  }
        open
        max_gradient 2
        contained_by{sphere{0,R}}
        pigment {rgb 1}
}

//--- end ---

If you want a crater with a central peak, you could start by changing
the "sin" into a "cos" and doubling the Size parameter.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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