POV-Ray : Newsgroups : povray.general : scattering media oddities : Re: scattering media oddities Server Time
30 Jul 2024 00:28:14 EDT (-0400)
  Re: scattering media oddities  
From: Alain
Date: 14 Mar 2010 16:07:15
Message: <4b9d41f3$1@news.povray.org>

> To model a foam plastic object (like
> http://de.wikipedia.org/wiki/Datei:Haushaltsschwaemme.jpg ) I tried a
> appropriate surface texture combined with a dense scattered media.
>
> The results are good, except when some feature is placed in the foam object.
> Such a feature should only be visible on a very short distance below the
> surface, but it's visible throughout the whole object. I've tracked down this
> issue to the scattering media.
>
> In the following sample scene the blue cylinder should disappear quickly, but
> it's visible through the whole media filled box. If the box is divided into
> parts (just set fogDivisions>  1), the visibility issue get's better. With
> subdivisions one get's band artifacts, however, and for more complex objects
> this wouldn't be of much help anyhow. I'm using povray Unix 3.6.1.
>
> Are there better alternatives to model this case?
>
>
> #include "colors.inc"
>
> #declare aR = 0.15;
>
> #declare fogDepth = 10;
> #declare fogDivisions = 1; // 1, 2, 4, 8
>
> camera {
>     location<15, 15, -25>
>     look_at<0, 5,  0>
>     angle 45
> }
>
> light_source {
>     <60, 50, -40>, color White
>     parallel
>     point_at<0, 5, 0>
> }
>
> plane {
>     y, 0
>     texture {
>        pigment {
>    color White
>        }
>        finish {
>    ambient aR
>    diffuse 0.6
>        }
>     }
> }
>
> #declare M_fog =
> material {
>     texture { pigment { color rgbf<1,1,1,1>  } }
>     interior {
>        media {
>    scattering { 1,
>       White*0.8
>    }
>        }
>     }
> }
>
> #declare i = 0;
> #declare fogStep = fogDepth/fogDivisions;
> #while(i<  fogDivisions)
>     box {
>        <-5, 0.01, -5 + i*fogStep>,<10, 13, -5 + (i+1)*fogStep - 0.01>
>        hollow
>        material { M_fog }
>     }
> #declare i = i + 1;
> #end
>
> cylinder {
>     <-4, 5,-8>,<-4, 5, 50>, 1
>     texture {
>        pigment { color<0.5, 0.5, 1>  }
>        finish { diffuse 0.6 ambient aR }
>     }
> }
>
>
>

You want to model a lump of foam, but you model a box filled with smoke. 
That's not the same thing.
Despite the dimention of your object, your media is not what I call dense.

You should try with an isosurface using some function that have 
repeating holes, like leopard. Use "all_intersections. Use a material 
with some transparency, an interior with an ior of about 1.4 to 1.7, 
fade_color fade_distance and fade_power 1 or fade_power 1001.
The texture should have some transparency:
  rgbf<Red_Value, Green_Value, Blue_Value, 0.7>
Add some specular to the finish: specular 0.5 roughness 0.01.

If you want, you can keep your media, but you probably don't need it.

In the global_settings set max_trace_level to a relatively large value, 
like 90 to 255 and increase adc_bailout to something like 0.01 to 0.05.
max_trace_level allows you to dig deeper into the object and prevent 
black spots.
adc_bailout keep the render time under controll at the price of a little 
less precision.


Alain


Post a reply to this message

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