POV-Ray : Newsgroups : povray.general : Is media only sampled on an object's surface? Server Time
2 Nov 2024 17:17:55 EDT (-0400)
  Is media only sampled on an object's surface? (Message 1 to 4 of 4)  
From: Andy
Subject: Is media only sampled on an object's surface?
Date: 7 Dec 2008 02:05:01
Message: <web.493b75459e6e18765e24b24a0@news.povray.org>
Hi all,

In some renderings of a cube with interior media I just did it seems like the
media is only being sampled on the surface, even though the help file says
media get sampled in intervals throughout an object.  I tried changing the
number of intervals to 10 in case the default is erroneously 1, and while it
took longer to render I got the same result.

I'm using POV-Ray version 3.7 beta 28.

Here's my scene, it's basically a box that emits with a spherical wave pattern I
defined myself:

------------------------------------------------------


#include "colors.inc"
#include "math.inc"

#declare Wave = function(ox, oy, oz, px, py, pz, amp, wl, sp, time) { amp *
cos(2 * pi / wl * sqrt(pow(px - ox, 2) + pow(py - oy, 2) + pow(pz - oz, 2)) -
time * sp / wl * 2 * pi) };

#declare TIME = clock;

box {
  -10, 10
  hollow

  material {
    texture {
      pigment { rgb 0.15 transmit 1 }
    }

    interior_texture {
      pigment { rgb 0.15 transmit 1 }
    }

    interior {
      media {
        intervals 10
        emission 0.15
        density {
          function { Wave(10, 10, -10, x, y, z, 0.25, 5, 5, TIME) + 0.25 }
        }
      }
    }
  }
}

light_source {
  <10, 10, -30>, White
}


camera {
  location <0,0,-30>
  look_at 0
  angle 70
}

--------------------------------------------------------------------

In my renderings the spherical ripples radiating from the top right-hand corner
only appear to be emitting on the surface of the box.  Also, the back face
doesn't look dark enough in the less dense areas (I bet it would look solid
grey if there weren't ripples in front.  This seems really fishy to me.  I'd
appreciate any explanations/solutions!


Post a reply to this message

From: clipka
Subject: Re: Is media only sampled on an object's surface?
Date: 7 Dec 2008 13:50:00
Message: <web.493c1a459118521d8f4fceef0@news.povray.org>
"Andy" <nomail@nomail> wrote:
> In some renderings of a cube with interior media I just did it seems like the
> media is only being sampled on the surface, even though the help file says
> media get sampled in intervals throughout an object.  I tried changing the
> number of intervals to 10 in case the default is erroneously 1, and while it
> took longer to render I got the same result.
>
> I'm using POV-Ray version 3.7 beta 28.

I see no problems (neither with MegaPoV 1.2.1 which is based on PoV 3.6, nor
with the beta 29) here.

Maybe you just have a wrong expectation about how the image should look?

It is perfectly normal (and realistic) for media effects to show quite sharp
contrasts at the object's surface (unless you add some terms to your formula
that generates some falloff towards the container's boundaries), which are
often strong enough to hide the more subtle brightness differences in the
object's interior.

As a rule of thumb, non-uniform media effects that end abruptly at the object's
boundaries just tend to look crappy (and especially so if you use a shape with
sharp edges like a cube.


Post a reply to this message

From: Alain
Subject: Re: Is media only sampled on an object's surface?
Date: 9 Dec 2008 16:02:16
Message: <493edcd8@news.povray.org>
Andy nous illumina en ce 2008-12-07 02:03 -->
> Hi all,
> 
> In some renderings of a cube with interior media I just did it seems like the
> media is only being sampled on the surface, even though the help file says
> media get sampled in intervals throughout an object.  I tried changing the
> number of intervals to 10 in case the default is erroneously 1, and while it
> took longer to render I got the same result.
There is no eroneous value. 1 is the correct value for the default sampling method.
> 
> I'm using POV-Ray version 3.7 beta 28.
> 
> Here's my scene, it's basically a box that emits with a spherical wave pattern I
> defined myself:
> 
> ------------------------------------------------------
> 
> 
> #include "colors.inc"
> #include "math.inc"
> 
> #declare Wave = function(ox, oy, oz, px, py, pz, amp, wl, sp, time) { amp *
> cos(2 * pi / wl * sqrt(pow(px - ox, 2) + pow(py - oy, 2) + pow(pz - oz, 2)) -
> time * sp / wl * 2 * pi) };
> 
> #declare TIME = clock;
> 
> box {
>   -10, 10
>   hollow
> 
>   material {
>     texture {
>       pigment { rgb 0.15 transmit 1 }
>     }
> 
>     interior_texture {
>       pigment { rgb 0.15 transmit 1 }
>     }
> 
>     interior {
>       media {
>         intervals 10
>         emission 0.15
>         density {
>           function { Wave(10, 10, -10, x, y, z, 0.25, 5, 5, TIME) + 0.25 }
>         }
>       }
>     }
>   }
> }
> 
> light_source {
>   <10, 10, -30>, White
> }
> 
> 
> camera {
>   location <0,0,-30>
>   look_at 0
>   angle 70
> }
> 
> --------------------------------------------------------------------
> 
> In my renderings the spherical ripples radiating from the top right-hand corner
> only appear to be emitting on the surface of the box.  Also, the back face
> doesn't look dark enough in the less dense areas (I bet it would look solid
> grey if there weren't ripples in front.  This seems really fishy to me.  I'd
> appreciate any explanations/solutions!
> 
> 

In my test, it don't look like it's comming only from the surfaces, but from the 
whole volume. A slight rotation result in a significant change in the aspect.

Increasing intarvals will greatly slow down the rendering speed, use samples 
instead and leave intervals at it's default value. 100 samples over 1 intervals 
are way faster than 30 samples over 10 intervals.

You don't need interior_texture. You only use it when you want the interior to 
have a different texture than the exterior.

You can remove that light. There is nothing for it to interact with.

Changing the container to a sphere give beter/more pleasing result.

-- 
Alain
-------------------------------------------------
   My wife's such a bad cook, the dog begs for Alka-Seltzer.
   	Rodney Dangerfield


Post a reply to this message

From: Alain
Subject: Re: Is media only sampled on an object's surface?
Date: 9 Dec 2008 17:07:19
Message: <493eec17$1@news.povray.org>
Andy nous illumina en ce 2008-12-07 02:03 -->
> Hi all,
> 
> In some renderings of a cube with interior media I just did it seems like the
> media is only being sampled on the surface, even though the help file says
> media get sampled in intervals throughout an object.  I tried changing the
> number of intervals to 10 in case the default is erroneously 1, and while it
> took longer to render I got the same result.
> 
> I'm using POV-Ray version 3.7 beta 28.
> 
> Here's my scene, it's basically a box that emits with a spherical wave pattern I
> defined myself:
> 
> ------------------------------------------------------
> 

  #include "colors.inc"
  #include "math.inc"

  #declare Wave = function(ox, oy, oz, px, py, pz, amp, wl, sp, time) { amp *
  cos(2 * pi / wl * sqrt(pow(px - ox, 2) + pow(py - oy, 2) + pow(pz - oz, 2)) -
  time * sp / wl * 2 * pi) };

  #declare TIME = clock;
#declare Sphere = 0;

#if(Sphere)
sphere {  10, 10
#else
box{<0.0001,-10,-10>,<20,10,10>
#end
   hollow

   material {
     texture {
       pigment { rgb 0.15 transmit 1 }
     }
/*
     interior_texture {
       pigment { rgb 0.15 transmit 1 }
     }
*/
     interior {
       media {
         samples 10
         emission 0.15
         density {
           function { Wave(10, 10, -10, x, y, z, 0.25, 5, 5, TIME) + 0.25 }
         }
       }
     }
   }//rotate 360*x*clock

}

#if(Sphere)
sphere {  -10, 10
#else
box{<-0.0001,-10,-10>,<-20,10,10>
#end
	texture{function{ Wave(10, 10, -10, x, y, z, 0.25, 5, 5, TIME) + 0.25 }
	texture_map{[0 pigment{ rgbt 1}finish{ambient 0.75}][0.9 pigment{ rgb 
1}finish{ambient 0.85}]}}
	
	}

  camera {
    location <0,0,-30>
   look_at 0
    angle 70
  }

> --------------------------------------------------------------------
> 
> In my renderings the spherical ripples radiating from the top right-hand corner
> only appear to be emitting on the surface of the box.  Also, the back face
> doesn't look dark enough in the less dense areas (I bet it would look solid
> grey if there weren't ripples in front.  This seems really fishy to me.  I'd
> appreciate any explanations/solutions!
> 
> 
To see the difference between sampling on the surface and sampling through the 
media, render this altered scene.
On the right, your media filled cube, on the left, another cube using your 
function as a texture pattern.
The objects have been shifted, but not the patterns, so that the patterns will 
continue from one object to the other.

By setting the variable "Sphere" to 1, you can switch to a pair of spheres.

There is a huge difference

-- 
Alain
-------------------------------------------------
Where the press is free and every man able to read, all is safe.
Thomas Jefferson


Post a reply to this message

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