POV-Ray : Newsgroups : povray.advanced-users : Media photons : Re: Media photons Server Time
29 Jul 2024 08:20:49 EDT (-0400)
  Re: Media photons  
From: Tom Melly
Date: 26 Sep 2002 08:27:11
Message: <3d92fd1f$1@news.povray.org>
"Andrew Coppin" <orp### [at] btinternetcom> wrote in message
news:3d921bfb@news.povray.org...

<snip>

Andrew, by coincidence I've been playing with the same problem, and have just
posted an image in binaries.images (code below).

BTW do you really need an iso for your water? Photons work fine with a normal.
The only reasons to use an iso IMHO would be:

a) your function is not suitable for a normal (anyone want to comment on this?)

b) you are showing the water surface where it touches another object, and you
therefore want a genuinely perturbed surface.

Here is the code to my scene if it helps (some stuff surplus to your
requirements):

// Persistence of Vision Ray Tracer Scene Description File
// File: tmland?.pov
// Vers: 3.5
// Desc: IRTC Wip
// Date: mm/dd/yy
// Auth: Tom Melly
//

#version 3.5;

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

#declare Do_photons   = true;
#declare Do_media     = true;
#declare Do_bed       = true;
#declare Do_env       = true;
#declare Do_rock      = true;
#declare Do_qrock     = false;
#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
  #if(Do_photons)
    photons{
      spacing Photon_sp
      autostop 0 jitter 0.4
      #if(Do_media)
        media 100
      #end
      save_file "tmland6.ph"
      //load_file "tmland6.ph"
    }
  #end
}

#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
  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>*2.5
  media_interaction on
  media_attenuation on
  fade_distance 1500
  fade_power 2
  translate <1000, 2000, -500>
}

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

#if(Do_bed)
  #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)
  }
#else
    #declare Bed_func = function(x,y,z){y + 5}
#end

#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
  #if(Do_photons) photons{target refraction on reflection on} #end
  finish{
    reflection{fresnel on}
    ambient 0 diffuse 0 conserve_energy
  }
  interior{
    ior 1.34
    #if(Do_media)
      media{Sea_media}
    #end
  }
}

#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}
  #if(Do_photons) photons{collect off} #end
}

#if(Do_env|Do_bed)
  object{Bed_base}
#end
#if(Do_env|Do_sea)
  object{Sea_top}
#end

object{Wall}

#declare FAgate = function {
    pigment { agate color_map { [0 rgb 0] [1 rgb 1] }}
}
#declare FGranite = function {
    pigment { granite color_map { [0 rgb 0] [1 rgb 1] }}
}

#declare Rock_func = function(x,y,z){
  (x*x + y*y + z*z)
  + f_noise3d(x,y,z)/2
  - FAgate(x,y,z).gray/5
  - FGranite(x,y,z).gray/7
  - 1/2
}

#declare Rock =
isosurface {
  function { Rock_func(x/5, y/8, z/5) }
  contained_by { box { -10, 10 } }
  accuracy 0.001
  max_gradient 10

  pigment{rgb 0.5}

  translate <0,-3,0>
}

#if(Do_rock)
  object{Rock}
#else
  #if(Do_qrock)
    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>
    }
  #end
#end


Post a reply to this message

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