POV-Ray : Newsgroups : povray.text.scene-files : Ridged Multifractal Planet : Ridged Multifractal Planet Server Time
13 May 2024 21:49:54 EDT (-0400)
  Ridged Multifractal Planet  
From: Samuel B 
Date: 7 Oct 2023 16:00:00
Message: <web.6521b8508c5c46f716bed5696e741498@news.povray.org>
/*
 RidgedMFPlanetB.pov

 2023 Sam Benge

 Inspired by:

https://old.reddit.com/r/proceduralgeneration/comments/16y8rnz/the_wonderful_worlds_of_procedural_generation_100/

 Recommended command line options:
  +fn +f +a0.03 +am2 +r2 +w1920 +h1080

 Note: for some reason the cloud layer enhances the planet's surface normal, so
the
 planet's surface normal amount will need to be doubled when not rendering the
clouds.
*/

#version 3.7;

global_settings{ assumed_gamma 1.0 }

#default{ finish{ambient 0} }

#include "functions.inc"

camera{
 orthographic
 right x*1.77 up y
 //right x up y
 location <0, 0, -10>
 look_at <.15, .8, 0>
 angle 10
}

// sunlight
light_source{
 <1, .7, .5>*1e5, 2 * <2, 1.95, 1.9>
 #if(1)
  #declare ALRes = 2;
  #declare ALSize = .1 * 1e5;
  area_light x*ALSize, z*ALSize, ALRes, ALRes
  jitter
  adaptive 1
  area_illumination
 #end
}

// planet
#if(1)

 sphere{
  0, 1

  // first multifractal
  #local FRidged1 =
   function{
    pattern{
     function{
      f_ridged_mf(
       x, y, z,
       0.61, // H
       2.2, // Lacunarity
       15,  // Octaves
       0.42, // Offset
       90.0, // Gain
       2
      )
      }
      warp{turbulence .15 lambda 3}
     }
   }

  // second multifractal
  #local FRidged2 =
   function{
    pattern{
     function{
      f_ridged_mf(
       x, y, z,
       0.54, // H
       1.42, // Lacunarity
       15,  // Octaves
       0.3, // Offset
       100, // Gain
       2
      )
      }
      warp{turbulence .25 lambda 3 octaves 7}
      translate z*20
     }
   }

  // combine multifractals
  #local FRidged =
   function{
    min(
     FRidged1(x, y, z)
     + .02,

     #local Scale = 1;
     .03 + 1.44 * FRidged2(x*Scale, y*Scale, z*Scale)
    )
   }

  // planet texture
  texture{

   pigment{
     function{FRidged(x, y, z)}
     color_map{
      [0 rgb .025]
      [1 rgb <.8, .7, .5>]
     }
    }

    normal{
     function{FRidged(x, y, z)}
     .075/2
     accuracy .001/3
    }

    finish{diffuse 1}

    // adjustment
    scale .75
    translate 25*x

  }

  hollow
 }

#end // /planet

// clouds
#if(1)

 #local CloudHeight = 0.002;

 sphere{
  0, 1+CloudHeight

  // for cloud detail
  #local FGranite = function{pattern{granite scale .1}}

  // main clouds shape
  #local FRidged3 =
   function{
    pattern{
     function{
      max(
       0,
       min(
        1,
        f_ridged_mf(
         x, y, z,
         0.53, // H
         1.72, // Lacunarity
         15,  // Octaves
         -.16, // Offset
         15.0, // Gain
         2
        )
        - .3
       )
      )
      }
      scale 3
      warp{turbulence .5 lambda 1.5}
      scale 1
     }
   }

  // combine cloud shape with sine details
  #local FClouds =
   function{
    max(
     0,
     min(
      1,
      2 * FRidged3(x, y, z)
      - .5
      + .125*FGranite(x, y, z)
      + .25*FGranite(x*3, y*3, z*3)
     )
    )
   }

  // clouds texture
  texture{

   pigment{
     //function{FRidged3(x, y, z)}
     function{FClouds(x, y, z)}
     poly_wave 2
     color_map{
      [.2 rgbt 1]
      [1 rgb 1 transmit .65]
     }
    }

    normal{
     function{FRidged3(x, y, z)}
     .02
     accuracy .0025
    }

    finish{diffuse .6 brilliance .5}

    // adjustment
    translate 9*z
    scale .35
  }

  hollow
 }

#end // /clouds

// atmosphere
#if(1)

 #local SkyRGB     = <.2, .5, 1>;
 #local SkyThickness  = .007;
 #local SkyScattering = 30000;
 #local SkyAbsorption = 120000;

 sphere{
  0, 1+SkyThickness
  pigment{rgbt 1}
  interior{
   media{
    scattering{5, SkyRGB*SkyScattering}
    absorption SkyRGB*SkyAbsorption
    intervals 1
    samples 1, 1
    jitter .2
    density{
     spherical
     poly_wave 2
     scale 1+SkyThickness
    }
   }
  }
  hollow
 }

#end // /atmosphere


Post a reply to this message

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