POV-Ray : Newsgroups : povray.binaries.images : Underwater light beams - but how? Server Time
8 Nov 2024 08:24:30 EST (-0500)
  Underwater light beams - but how? (Message 1 to 6 of 6)  
From: Raymond Tracer
Subject: Underwater light beams - but how?
Date: 1 Feb 2013 14:50:01
Message: <web.510c1a6a1927e6d96eb3cf340@news.povray.org>
I am fairly new to raytracing, although I did dabble in the days when it took a
week to render a sphere between two mirrors. I particularly wanted underwater

example images with the strong effect I wanted. Experimenting, I found that
enough photons to hopefully give a good effect quickly exhausted my RAM, while
few enough to be manageable gave no effect. Deciding that elephants need to be
eaten one bite at a time, I turned media interaction off on my main light, and
dimmed it so I could still see what was going on, and added a cylinder light
with media interaction (coming from behind in the picture). I was hoping to get
a single light beam with some caustics, to see if the effect was worth pursuing.
Not only did this work, but the other light (coming from the left in the
picture) magically started interacting with the media, and gave me just the

still needs 3Gb for the photons rendered at 512x384). How is this working? Is it
a bug (I am using V3.7), or am I missing something about how all this works?

Source:

// Persistence of Vision Ray Tracer Scene Description File


#version 3.7;
#include "colors.inc"

//Control
#declare Photons=on;
#declare Radiosity=on;
#declare Size=5;

//Global
global_settings {
  assumed_gamma 1.0
  max_trace_level 15

  #if (Photons)
    photons {
      spacing 0.003
      media 100
    }
  #end

  #if(Radiosity)
  radiosity {
      pretrace_start 0.08
      pretrace_end   0.01
      count 150
      nearest_count 10
      error_bound 0.5
      recursion_limit 3
      low_error_factor 0.5
      gray_threshold 0.0
      minimum_reuse 0.005
      maximum_reuse 0.2
      brightness 1
      adc_bailout 0.005
    }
  #end
}

//Declarations
#declare T_Pool = texture{
    pigment { color rgb <0.9, 0.88, 0.85> }
    finish {

      #if(Radiosity)

      phong 1
      ambient 0.0
      diffuse 0.6
      specular 0.4
      roughness 0.01

      #else

      ambient 0.07

      #end
    }
}

#declare M_Water = material {
   texture {
     pigment {
       color rgbt <0.4,0.5,0.3, 0.9>
     }
     finish {
       diffuse 0.3
       ambient 0.0

       reflection {
         0.03, 1.0
         fresnel on
       }

       conserve_energy

       specular 0.4
       roughness 0.003
     }

   }
   interior {
     ior 1.3
   }
}

#declare fn_water_surface_pattern=
   function {
     pattern { bozo scale 0.025 }
   }


//Camera
camera {
  location  <-2.0,  -2.0, -0.25>
  direction y
  sky       z
  up        z
  right     (4/3)*x
  look_at   <0.0, 0.0, -0.05>
  angle 43
}

//Lights

light_source
{
 <-8, 6.2, 4.5>, 0.3
 media_interaction off
 photons { reflection off }

}

light_source {
  0*x
  color rgb <1,1,1>
  spotlight
  cylinder
  translate <-5, -5, 1>
  point_at <-1, -1, 0>
  radius 5
  tightness 50
  falloff 8

  #if (Photons)
  photons{
    refraction on
    reflection on
  }
  #end
}


//Object - water
height_field {

  function 400, 400 { fn_water_surface_pattern(x, y, 0)*0.05 + 0.5 }
  smooth

  rotate -90*x
  translate <-0.5,-0.5,0.4>
  scale <5,5,1>

  material {
    M_Water
  }

  hollow on

   #if (Photons)
   photons{
    target 1.0
    refraction on
    reflection on
   }
   #end
}


//Object - pool sides
difference {

  box { < -(Size/2+0.2), -(Size/2+0.2),-1>, <(Size/2+0.2), (Size/2+0.2),0.05> }
  box { < -(Size/2-0.1), -(Size/2-0.1),-0.99>, <(Size/2-0.1), (Size/2-0.1),0.2>
}

  texture {T_Pool}
}

//Object - pillar
cylinder { -z, z*0.35, 0.2 translate <0.2, -0.2, 0>

   texture {T_Pool}
}

//Object - pool floor
plane {
  z, -1

  texture {T_Pool}

  hollow on
}

//Object - sky fog
fog{
   fog_type 2
   fog_alt 0.4
   fog_offset 0.4
   color rgbt <0.85,0.9,1.0, 0.0>
   distance 300
   up z
}

//Object - sky
sphere {
  <0, 0, 0>, 1
  texture {
    pigment {
      gradient z
      color_map {
        [0.0 color rgb < 0.680, 0.735, 0.976 >]
        [0.2 color rgb < 0.350, 0.500, 0.950 >]
      }
    }
    finish {

      #if(Radiosity)

      diffuse 1
      ambient 0

      #else

      diffuse 0
      ambient 1

      #end
    }
  }
  scale<1000, 1000, 200>
  no_shadow
  hollow on
}

//Object - ball
sphere {
 <0,0,0>, 0.5
  texture {
    pigment {
    radial color_map{[0.5 Red][0.5 Yellow]}
    frequency 10
    }
    finish {
             #if(Radiosity)
             ambient 0.0 diffuse 1.0 phong 1
             #else
             phong 1 reflection{ 0.00 metallic 0.00}
             #end
     }
  }
  scale<.1,.1,.1>  rotate<55,0,0>  translate<-1.0,-1.0,-0.2>
}

//Object - media
box { < -(Size/2-0.1), -(Size/2-0.1),-0.99>, <(Size/2-0.1), (Size/2-0.1),0.2>
        pigment { rgbt 1 }
        hollow
        interior{
                media {
                        scattering { 1, 0.4 extinction 0.4 }
                        samples 30,100
                }
        }
        photons { pass_through }
 }


Post a reply to this message


Attachments:
Download 'underwater.png' (182 KB)

Preview of image 'underwater.png'
underwater.png


 

From: MichaelJF
Subject: Re: Underwater light beams - but how?
Date: 1 Feb 2013 15:15:01
Message: <web.510c22113ef91f01957077fd0@news.povray.org>
"Raymond Tracer" <mik### [at] aolcom> wrote:

 A very good reference is

http://images.povcomp.com/entries/extras/161/161_source.zip

Best regards,
Michael


Post a reply to this message

From: Raymond Tracer
Subject: Re: Underwater light beams - but how?
Date: 1 Feb 2013 21:00:01
Message: <web.510c6ff73ef91f016eb3cf340@news.povray.org>
"MichaelJF" <mi-### [at] t-onlinede> wrote:
> "Raymond Tracer" <mik### [at] aolcom> wrote:
>
>  A very good reference is
>
> http://images.povcomp.com/entries/extras/161/161_source.zip
>
> Best regards,
> Michael

With respect, I wasn't saying that underwater light beams were impossible, I was
wondering how they could possibly come from a light source with media
interaction set to "off". If you know why, could you say so explicitly, for the
benefit of future generations, or call me a twit for missing the obvious (and
then explain why it's obvious). :)


Post a reply to this message

From: MichaelJF
Subject: Re: Underwater light beams - but how?
Date: 2 Feb 2013 12:15:01
Message: <web.510d48ca3ef91f01c0d93a4f0@news.povray.org>
"Raymond Tracer" <mik### [at] aolcom> wrote:
> "MichaelJF" <mi-### [at] t-onlinede> wrote:
> > "Raymond Tracer" <mik### [at] aolcom> wrote:
> >
> >  A very good reference is
> >
> > http://images.povcomp.com/entries/extras/161/161_source.zip
> >
> > Best regards,
> > Michael
>
> With respect, I wasn't saying that underwater light beams were impossible, I was
> wondering how they could possibly come from a light source with media
> interaction set to "off". If you know why, could you say so explicitly, for the
> benefit of future generations, or call me a twit for missing the obvious (and
> then explain why it's obvious). :)

Certainly I will not call you a twit. Underwater scenes are a real challenge. I
just posted the link to the sources of the best underwater scene I know. In fact
I'm working at the same issue at the moment. There is an other scene by Glenn
McCarter, IRTC April 2009, which is not available to the public at the moment,
but I have stored it in time. Since it is published under a cc-license I can
mail you the code in private - if you are interested. But light sources within a
media without media interaction can only lighten up the whole scene but cannot
give rays of lighting. I really propose to study the code of Johnny Yip closely
(which is a litlle bit difficult, I admit). It will answer a lot of your
questions I think.

Best regards,
Michael


Post a reply to this message

From: Raymond Tracer
Subject: Re: Underwater light beams - but how?
Date: 2 Feb 2013 12:50:00
Message: <web.510d513c3ef91f016eb3cf340@news.povray.org>
Yes, I am interested, and the code of another good underwater scene would be
very welcome, thank you. I have downloaded the code you originally mentioned,
although I haven't had time to study it in detail yet. The render of that code
is most impressive.


Post a reply to this message

From: MichaelJF
Subject: Re: Underwater light beams - but how?
Date: 2 Feb 2013 13:55:01
Message: <web.510d60e03ef91f01c0d93a4f0@news.povray.org>
"Raymond Tracer" <mik### [at] aolcom> wrote:
> Yes, I am interested, and the code of another good underwater scene would be
> very welcome, thank you. I have downloaded the code you originally mentioned,
> although I haven't had time to study it in detail yet. The render of that code
> is most impressive.

I personally think that Johnny Yips picture of the "Guardian" is the best
picture ever created with POV so far. There are a lot of other very fine
pictures especially by Jaime or Ive but "The Guardian" is superior to all IMO.
But this is only a very personal opinion.

Best regards,
Michael


Post a reply to this message

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