POV-Ray : Newsgroups : povray.general : underwater media help! : Re: underwater media help! Server Time
25 Apr 2024 17:28:23 EDT (-0400)
  Re: underwater media help!  
From: Tom Melly
Date: 10 Jan 2003 08:36:31
Message: <3e1ecc5f@news.povray.org>
"Mike Williams" <mic### [at] quixnetnet> wrote in message
news:3e1e4d4a@news.povray.org...
> I am trying to setup a scene underwater. I am not yet good with media. Does
> anyone have ideas how to make a good underwater media?
>
> thanks
>

Here's where I got to with this...

#version 3.5;

#include "colors.inc"
#include "functions.inc"

#declare Photon_sp    = 0.2; //.2
#declare Cont_rad     = 35; // 35
#declare Sea_col      = <1,1,1,1>; //<0.5,0.9,1.0,1.0>;
#declare Sea_medcol   = <0.8,0.2,0.1>*0.75; // 0.75
#declare Dens_min     = 0.1;//.1
#declare Cam_z        = -15;

#declare Do_sea       = true;

#if(abs(Cam_z)+10>(Cont_rad))
  Camera too far away!
#end

global_settings {
  assumed_gamma 1.0
  ambient_light 0
  photons{
    spacing Photon_sp
    autostop 0 jitter 0.4
    media 100
    save_file "seabed.ph"
    //load_file "seabed.ph"
  }
}

#declare Dens_func = function(x,y,z){min(1,Dens_min + pow(x/(Cont_rad),2) +
pow(z/(Cont_rad),2))}

#declare Sea_media =
media{
  method 3
  intervals 10
  samples 3,15
  scattering {1,0.025 extinction 0.8} //0.025  0.8
  absorption Sea_medcol
  density{function{Dens_func(x,y,z)}}
}


// ----------------------------------------

camera {
  location  <0.0, 0.0, Cam_z>
  look_at   <0.0, -5.0, 35>
}

sky_sphere {
  pigment {
    wrinkles scale 0.25
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.2,0.4,0.8>]
    }
  }
}

light_source {
  <0, 0, 0>
  color rgb <1, 1, 1>*5
  media_interaction on
  media_attenuation on
  fade_distance 1500
  fade_power 2
  translate <1000, 2000, -500>
}

// ----------------------------------------

#declare Bed_func = function(x,y,z){
  y +
  5 +
  (sin(x*5 - sin(z + f_noise3d(x,0,z))*1)/20) -
  (sin((x+z)*1 -
  sin(z + f_noise3d(x,0,z))*1)/30)
}

#declare Bed_base =
difference{
  isosurface {
    function { Bed_func(x, y, z) }
    contained_by {sphere{0,Cont_rad}}
    accuracy 0.001
    max_gradient 2
    rotate y*35
  }
  plane{z,Cam_z-10}
  pigment{rgb<0.9,0.9,0.6>}
}

#declare Sea_func = function(x,y,z){y - 5}

#declare Sea_top =
difference{
  isosurface{
    function { Sea_func(x*1, y*1, z*1) }
    contained_by {sphere{0,Cont_rad}}
    accuracy 0.001
    max_gradient 5
    rotate y*25
  }
  plane{z,Cam_z-10}

  pigment{rgbf Sea_col}

  normal{bozo 5 scale 1/4}

  hollow
  photons{target refraction on reflection on}
  finish{
    reflection{fresnel on}
    ambient 0 diffuse 0 conserve_energy
  }
  interior{
    ior 1.34
    media{Sea_media}
  }
}

#declare Wall =
difference{
  sphere{0,Cont_rad}
  sphere{0,Cont_rad - 0.01}
  plane{y,-7}
  plane{-y,-7.5}
  plane{z,Cam_z-10}
  pigment{rgb 0}
  photons{collect off}
}

object{Bed_base}
object{Sea_top}
object{Wall}


sphere{
  0,4
  scale <1,1.5,1>
  pigment{rgb 0.5}
  normal{agate scale 10}
  normal{granite scale 1/4}
  translate <0,-3,0>
}


Post a reply to this message

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