POV-Ray : Newsgroups : povray.general : Physically accurate wax simulation Server Time
25 Dec 2024 14:29:46 EST (-0500)
  Physically accurate wax simulation (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Charles
Subject: Physically accurate wax simulation
Date: 1 Sep 2007 19:40:00
Message: <web.46d9f82f8e4ea8cd3489ab670@news.povray.org>
Hello everyone,

For a research project, I need to make a physically accurate simulation of
candlewax. I have taken a photo of what it looks like when I embed a small
black bead in a cube of wax and shine a light on it:

http://www.turingbirds.com/personal/random/wax.png

However, in POVRay, I cannot get the wax material to interact with the
sphere:

http://www.turingbirds.com/personal/random/nogoodrender.png
http://www.turingbirds.com/personal/random/wax.pov

Am I forgetting something, or is POVRay incapable of rendering this (without
hacks, e.g. blur)?

Thanks in advance,
Charles


Post a reply to this message

From: Tim Nikias
Subject: Re: Physically accurate wax simulation
Date: 1 Sep 2007 19:57:49
Message: <46d9fc7d$1@news.povray.org>
Charles wrote:
> Hello everyone,
> 
> For a research project, I need to make a physically accurate simulation of
> candlewax. I have taken a photo of what it looks like when I embed a small
> black bead in a cube of wax and shine a light on it:
> 
> http://www.turingbirds.com/personal/random/wax.png
> 
> However, in POVRay, I cannot get the wax material to interact with the
> sphere:
> 
> http://www.turingbirds.com/personal/random/nogoodrender.png
> http://www.turingbirds.com/personal/random/wax.pov
> 
> Am I forgetting something, or is POVRay incapable of rendering this (without
> hacks, e.g. blur)?

Basically, your CG-wax is very "thin" (density-wise), you can raise that 
simply by adding a density{rgb 10} to raise it tenfold, for example. I 
do that all the time for my clouds, so they are less translucent, and 
works best with scattering media of course.
As for the blurriness, you'd probably have to use an arealight, maybe 
even an area of point light sources to achieve what you're aiming for.

A given fact is that lightrays won't be bent inside media, so achieving 
realistic wax is, at least with the current and official povray, not 
possible by just using a simple media container.

If you make layers of objects, their surface irregular/normal-mapped, 
and use photons for the media-calculation, you might get somewhere, but 
the rendering times will skyrocket tremendously.

Just a couple thoughts right off the top of my head, probably not worth 
much. 2 cents maybe. ;-)

Regards,
Tim

-- 
aka "Tim Nikias"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Alain
Subject: Re: Physically accurate wax simulation
Date: 1 Sep 2007 20:16:26
Message: <46da00da@news.povray.org>
Charles nous apporta ses lumieres en ce 2007/09/01 19:39:
> Hello everyone,
> 
> For a research project, I need to make a physically accurate simulation of
> candlewax. I have taken a photo of what it looks like when I embed a small
> black bead in a cube of wax and shine a light on it:
> 
> http://www.turingbirds.com/personal/random/wax.png
> 
> However, in POVRay, I cannot get the wax material to interact with the
> sphere:
> 
> http://www.turingbirds.com/personal/random/nogoodrender.png
> http://www.turingbirds.com/personal/random/wax.pov
> 
> Am I forgetting something, or is POVRay incapable of rendering this (without
> hacks, e.g. blur)?
> 
> Thanks in advance,
> Charles
> 
> 
You are on the right track. You need your media MUCH dencer!
Your media as it is now:

  media
       {
           scattering { 2, 0.5 extinction 0.9}

       }

Wax works as a very dense scattering media, a color of 0.5 is just to small.
Wax does bend light going trough it: if have an index of refraction: ior.
I think that solid wax have an ior slightly higher than water, while molten wax 
is slightly lower than water.
Try:
interior{
	scattering{2, 5 }
	ior 1.4
	}

You may need to push the color even higher.
The surface of the wax not perfectly smooth, it's covered by tyni irregularities.
Another thing that you may try, is to use blured transparence:
Add an averaged normal statement to your cube:
#declare Scale = 0.001;// use a large (>100) or a small (<0.01) value
#declare R = seed(1);// any value will do
#declare Samples = 10;// use a larger value only if absolutely needed, as you 
cross 2 surfaces, each ray will split in 10 two times!

normal{average{normal_map{
    #while(Samples)
	[1 normal bumps translate<rand(R),rand(R),rand(R)>*Scale scale Scale]
// you use a broad pattern with large displacemen
//OR tyni pattern with small displacement.
	#declare Samples = Samples - 1;
    #end
    }
Be carefull, as this will greatly slow down the rendering speed: each ray will 
be split in 10 before it enter the media,

As your scene is set now, you probably don't need the radiosity. Remove the 
radiosity block.

By default, lights interact with the media: media_interaction on not usefull.
You use media_interaction off when you don't want a light to interact with medias.

The only include file that you realy use is color.inc.
You can remove all the other include without causing any change.

-- 
Alain
-------------------------------------------------
The tree of liberty must be refreshed from time to time with the blood of
patriots and tyrants.
Thomas Jefferson


Post a reply to this message

From: Burki
Subject: Re: Physically accurate wax simulation
Date: 2 Sep 2007 13:20:00
Message: <web.46daefb46612cd25fc8d7180@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> Charles nous apporta ses lumieres en ce 2007/09/01 19:39:
> > Hello everyone,
> >
> > For a research project, I need to make a physically accurate simulation of
> > candlewax.


Hi!

I made a demo scene with wax this spring (see below).

The material is slightly altered from the one first provided by Andy Cocker
in his posting:
http://news.povray.org/povray.text.scene-files/thread/%3C3fcddaec$1@news.povray.org%3E/?ttop=238503&toff=100
The media density is very high (seven).

Perhaps try this, should render in a few seconds.


Yours,
Bu.


Only code follows:

//////////////////////////////////////////////////////////////////////
// Persistence of Vision Ray Tracer Scene Description File
// File: ?.pov
// Vers: 3.6
// Desc: Checkered Floor Example
// Date: mm/dd/yy
// Auth: ?
//

#version 3.6;

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
  max_trace_level 5
}

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

camera {
  location  <0.0, 0.5, -4.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}

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

plane {               // checkered floor
  y, -1
  texture
  {
    pigment {
      checker
      color rgb 1
      color blue 1
      scale 0.5
    }
    finish{
      diffuse 0.8
      ambient 0.1
    }
  }
}
//
http://news.povray.org/povray.text.scene-files/thread/%3C3fcddaec$1@news.povray.org%3E/?ttop=238503&toff=100

#declare Obj_Col = <1, 0.6, 0.2>;
#declare Obj_Absorption = 1 - Obj_Col;
#declare Media_Density = 7;    //was 6.5; // must be adapted to size
#declare SSS_Tex =
     texture {
          pigment {
               rgb Obj_Col
               filter 1.2 // was 1.0
          }
          finish {
               brilliance 4 // wasn't included from Andy Cocker
               specular 0.5
               roughness 0.2
               ambient 0.2
               reflection {
                    0.0,
                    0.5
                    fresnel
               }
               conserve_energy
          }
     }
#declare SSS_Int =
     interior {
          ior  1.3 // close to water
          // Media with absorption and scattering
          media {
               absorption Obj_Absorption*2
               scattering {
                              4, // Rayleigh
                              Media_Density //see above
               }
               method 3 // adaptive sampling, is default anyway
          }
     }

#declare SSS_Material =
material {
     texture {
          SSS_Tex
     }
     interior {
          SSS_Int
     }
}



//
cylinder{
     <0, -1, 0>
     <0, 0.3, 0>
     0.3
     hollow
     material {SSS_Material}
}

//end of file


Post a reply to this message

From: Alain
Subject: Re: Physically accurate wax simulation
Date: 2 Sep 2007 15:32:53
Message: <46db0fe5$1@news.povray.org>
Burki nous apporta ses lumieres en ce 2007/09/02 13:15:
> Alain <ele### [at] netscapenet> wrote:
>> Charles nous apporta ses lumieres en ce 2007/09/01 19:39:
>>> Hello everyone,
>>>
>>> For a research project, I need to make a physically accurate simulation of
>>> candlewax.
> 
> 
> Hi!
> 
> I made a demo scene with wax this spring (see below).
> 
> The material is slightly altered from the one first provided by Andy Cocker
> in his posting:
>
http://news.povray.org/povray.text.scene-files/thread/%3C3fcddaec$1@news.povray.org%3E/?ttop=238503&toff=100
> The media density is very high (seven).
> 
> Perhaps try this, should render in a few seconds.
> 
> 
> Yours,
> Bu.
> 
> 
> Only code follows:
> 
> //////////////////////////////////////////////////////////////////////
> // Persistence of Vision Ray Tracer Scene Description File
> // File: ?.pov
> // Vers: 3.6
> // Desc: Checkered Floor Example
> // Date: mm/dd/yy
> // Auth: ?
> //
> 
> #version 3.6;
> 
> #include "colors.inc"
> 
> global_settings {
>   assumed_gamma 1.0
>   max_trace_level 5
> }
> 
> // ----------------------------------------
> 
> camera {
>   location  <0.0, 0.5, -4.0>
>   direction 1.5*z
>   right     x*image_width/image_height
>   look_at   <0.0, 0.0,  0.0>
> }
> 
> sky_sphere {
>   pigment {
>     gradient y
>     color_map {
>       [0.0 rgb <0.6,0.7,1.0>]
>       [0.7 rgb <0.0,0.1,0.8>]
>     }
>   }
> }
> 
> light_source {
>   <0, 0, 0>            // light's position (translated below)
>   color rgb <1, 1, 1>  // light's color
>   translate <-30, 30, -30>
> }
> 
> // ----------------------------------------
> 
> plane {               // checkered floor
>   y, -1
>   texture
>   {
>     pigment {
>       checker
>       color rgb 1
>       color blue 1
>       scale 0.5
>     }
>     finish{
>       diffuse 0.8
>       ambient 0.1
>     }
>   }
> }
> //
>
http://news.povray.org/povray.text.scene-files/thread/%3C3fcddaec$1@news.povray.org%3E/?ttop=238503&toff=100
> 
> #declare Obj_Col = <1, 0.6, 0.2>;
> #declare Obj_Absorption = 1 - Obj_Col;
> #declare Media_Density = 7;    //was 6.5; // must be adapted to size
> #declare SSS_Tex =
>      texture {
>           pigment {
>                rgb Obj_Col
>                filter 1.2 // was 1.0
>           }
>           finish {
>                brilliance 4 // wasn't included from Andy Cocker
>                specular 0.5
>                roughness 0.2
>                ambient 0.2
>                reflection {
>                     0.0,
>                     0.5
>                     fresnel
>                }
>                conserve_energy
>           }normal{ granite 0.2 scale 0.001}
>      }
> #declare SSS_Int =
>      interior {
>           ior  1.3 // close to water
>           // Media with absorption and scattering
>           media {
>                absorption Obj_Absorption*2
>                scattering {
>                               4, // Rayleigh
>                               Media_Density //see above
>                }
>                method 3 // adaptive sampling, is default anyway
>           }
>      }
> 
> #declare SSS_Material =
> material {
>      texture {
>           SSS_Tex
>      }
>      interior {
>           SSS_Int
>      }
> }
> 
> 
> 
> //
> cylinder{
>      <0, -1, 0>
>      <0, 0.3, 0>
>      0.3
>      hollow
>      material {SSS_Material}
> }
sphere{0,0.1 pigment{rgb 0}}
> 
> //end of file
> 
> 
Added:
normal{ granite 0.2 scale 0.001} to the texture of the cylinder.

Added:
sphere{0,0.1 pigment{rgb 0}}

Some improvement.
-- 
Alain
-------------------------------------------------
OK, so what's the speed of dark?


Post a reply to this message

From: Charles
Subject: Re: Physically accurate wax simulation
Date: 2 Sep 2007 17:20:00
Message: <web.46db289c6612cd23489ab670@news.povray.org>
Dear Everyone,

Burki: even though your candle looks very nice, it still doesn't render
embedded objects with "participating" wax. I think (read: fear) that what I
need is a full volume render, which
1) takes ages to render;
2) I don't know if povray is capable of.

What seems to be the problem is that POVRay treats a material as a single
entity instead of rendering it as thousands if not millions of particles
(think of smoke). The obvious solution here is a #while-loop to dynamically
generate as many of these micro-particles as gives a good render result.
This post is a last cry for something more decent. Some sort of mapping?

Thanks,
Charles

PS. Alain, I'm not sure this is what your code attempts to do. I couldn't
get it parsed (latest POVRay version).


Post a reply to this message

From: Alain
Subject: Re: Physically accurate wax simulation
Date: 2 Sep 2007 23:12:37
Message: <46db7ba5$1@news.povray.org>
Charles nous apporta ses lumieres en ce 2007/09/02 17:18:
> Dear Everyone,
> 
> Burki: even though your candle looks very nice, it still doesn't render
> embedded objects with "participating" wax. I think (read: fear) that what I
> need is a full volume render, which
> 1) takes ages to render;
> 2) I don't know if povray is capable of.
> 
> What seems to be the problem is that POVRay treats a material as a single
> entity instead of rendering it as thousands if not millions of particles
> (think of smoke). The obvious solution here is a #while-loop to dynamically
> generate as many of these micro-particles as gives a good render result.
> This post is a last cry for something more decent. Some sort of mapping?
> 
> Thanks,
> Charles
> 
> PS. Alain, I'm not sure this is what your code attempts to do. I couldn't
> get it parsed (latest POVRay version).
> 
> 
> 
> 
Where is the error? And what does it say?
Try this one:

#include "colors.inc"

global_settings {
   assumed_gamma 1.0
   max_trace_level 5
   photons{spacing 0.1}
}

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

camera {
   location  <0.0, 0.5, -4.0>
   direction 1.5*z
   right     x*image_width/image_height
   look_at   <0.0, 0.0,  0.0>
}

sky_sphere {
   pigment {
     gradient y
     color_map {
       [0.0 rgb <0.6,0.7,1.0>]
       [0.7 rgb <0.0,0.1,0.8>]
     }
   }
}

light_source {
   <0, 0, 0>            // light's position (translated below)
   color rgb <1, 1, 1>  // light's color
   translate <-30, 30, -30>
}

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

plane {               // checkered floor
   y, -1
   texture
   {
     pigment {
       checker
       color rgb 1
       color blue 1
       scale 0.5
     }
     finish{
       diffuse 0.8
       ambient 0.1
     }
   }
}

#declare Obj_Col = <1, 0.6, 0.2>;
#declare Obj_Absorption = 1 - Obj_Col;
#declare Media_Density = 7;    //was 6.5; // must be adapted to size
#declare SSS_Tex =
      texture {
           pigment {
                rgb Obj_Col
                filter 1.2 // was 1.0
           }
           finish {
                brilliance 4 // wasn't included from Andy Cocker
                specular 0.5
                roughness 0.2
                ambient 0.2
                reflection {
                     0.0,
                     0.5
                     fresnel
                }
                conserve_energy
           }
	normal{ granite 0.2 scale 0.00041}
      }
#declare SSS_Int =
      interior {
           ior  1.3 // close to water
           // Media with absorption and scattering
           media {
                absorption Obj_Absorption*2
                scattering {
                               4, // Rayleigh
                               Media_Density //see above
                }
           }
      }

#declare SSS_Material =
material {
      texture {
           SSS_Tex
      }
      interior {
           SSS_Int
      }
}



//
cylinder{
      <0, -1, 0>
      <0, 0.3, 0>
      0.3
      hollow
      material {SSS_Material}
      //photons{target refraction on}
}
sphere{<-0.1, -0.3, -0.1>,0.1 pigment{rgb 0}}
// an imbeded black sphere.
//end of file


-- 
Alain
-------------------------------------------------
Just because someone doesn't love you the way you want them to, doesn't mean 
they don't love you with all they have.


Post a reply to this message

From: Charles
Subject: Re: Physically accurate wax simulation
Date: 3 Sep 2007 07:25:01
Message: <web.46dbeeb46612cd21550d7f0@news.povray.org>
Dear Alain,

I was referring to the snipped you posted earlier:

#declare Scale = 0.001;// use a large (>100) or a small (<0.01) value
#declare R = seed(1);// any value will do
#declare Samples = 10;// use a larger value only if absolutely needed, as
you
cross 2 surfaces, each ray will split in 10 two times!

normal{average{normal_map{
    #while(Samples)
 [1 normal bumps translate<rand(R),rand(R),rand(R)>*Scale scale Scale]
// you use a broad pattern with large displacemen
//OR tyni pattern with small displacement.
 #declare Samples = Samples - 1;
    #end
    }

This gives me a syntax error.

Another way to state the issue, by the way, is that a single material cannot
cast a shadow upon itself. I think I'm going to try simulating a few
thousand microscopic spheres and see what results that gives me.

Kind regards,
Charles


Post a reply to this message

From: Alain
Subject: Re: Physically accurate wax simulation
Date: 3 Sep 2007 14:10:09
Message: <46dc4e01@news.povray.org>
Charles nous apporta ses lumieres en ce 2007/09/03 07:23:
> Dear Alain,
> 
> I was referring to the snipped you posted earlier:
> 
> #declare Scale = 0.001;// use a large (>100) or a small (<0.01) value
> #declare R = seed(1);// any value will do
> #declare Samples = 10;// use a larger value only if absolutely needed, as
> you
> cross 2 surfaces, each ray will split in 10 two times!
> 
> normal{average{normal_map{
>     #while(Samples)
>  [1 normal bumps translate<rand(R),rand(R),rand(R)>*Scale scale Scale]
> // you use a broad pattern with large displacemen
> //OR tyni pattern with small displacement.
>  #declare Samples = Samples - 1;
>     #end
>     }
> 
> This gives me a syntax error.
> 
> Another way to state the issue, by the way, is that a single material cannot
> cast a shadow upon itself. I think I'm going to try simulating a few
> thousand microscopic spheres and see what results that gives me.
> 
> Kind regards,
> Charles
> 
> 
The problem is that a comment line was split in 2. The error comes from that 
second part whitch is NOT proper SDL syntax ;-)

-- 
Alain
-------------------------------------------------
Lutheran: If shit happens, don't talk about it.


Post a reply to this message

From: Charles
Subject: Re: Physically accurate wax simulation
Date: 9 Sep 2007 09:15:00
Message: <web.46e3f13d6612cd23489ab670@news.povray.org>
Hello,

I've made some progress:

http://www.turingbirds.com/personal/random/wax_trial_2_render.png
http://www.turingbirds.com/personal/random/wax_trial_2.pov

However, despite the end of the cylinder being inside the box, it is not
getting "blurry", just darker. It looks like povray is treating the
scattering media as a single entity, rather than a near-infinite number of
particles which it's supposed to represent. Kasuga_Kyousuke on povray irc
advised me that radiosity will not fix this scene, because of the same
reason: looking at the media as a single entity. Does anyone know of a way
to make this work?

Thanks,
Charles

PS. Intended result: candle wax with black bead embedded
(http://www.turingbirds.com/personal/random/wax.png)
PS2. adding absorption does not work; it only makes everything evenly darker


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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