|
![](/i/fill.gif) |
Mike nous illumina en ce 2009-01-14 16:50 -->
> I have been trying to model an experiment with two different liquids with
> different indicies of refraction with one on top of the other. With help from
> this forum I am nearly able to get it modeled nicely. However, It still does
> not look correct when looking from a perspective view. I have made a very
> simple approximation. Two objects with different refractive indices on top of
> each other. Looking at it from a perspective view has some weird artifacts and
> does not look correct. I have been scratching my head for a while on this one.
> I tried merging, shifting up and down, etc. I have posted my code below,
> please take a look.
>
> Thanks,
> Mike
>
> #include "colors.inc"
> #include "textures.inc"
>
> global_settings{max_trace_level 255}
> camera {
> location <0, 3, 160>
> look_at <0, 3, 0>
> angle 2.5
> rotate <-30*1,-30*1,0>
> }
> #declare MaterialAlcohol =
> material {
> texture {
> pigment {
> color rgbf<1, 1, 1,1>
> }
> finish {
> ambient 0.0
> diffuse 0.0
> reflection {
> 0.0, 1.0
> fresnel on
> }
> conserve_energy
> specular 0
> roughness 0
> }
> }
> }
>
> #declare HeavyLiquid =
> material {
> texture {
> pigment {
> color rgbf<0.6, 0.5, 0,1>
> }
> finish {
> ambient 0.0
> diffuse 0.0
> reflection {
> 0.0, 1.0
> fresnel on
> }
> conserve_energy
> specular 0
> roughness 0
> }
> }
> }
>
>
> #declare AlcoholRegion=
> box { <-1.899, 0.2, -1.899>, <1.899, 3, 1.899>
> material { MaterialAlcohol }
> interior {
> ior 1.3800
> }
> }
>
> #declare HeavyLiquidRegion=
> box { <-1.899, 3, -1.899>, <1.899, 5, 1.899>
> material { HeavyLiquid }
> interior {
> ior 1.4
> }
> }
>
> //merge{
> object{AlcoholRegion}
> object{HeavyLiquidRegion}
> //}
> light_source {
> <4, 8, 10>
> color White
> }
> plane{y,0 texture{pigment{White}finish{ambient 0 diffuse 1}}}
>
>
>
The two objects with the different ior have a coincident surface. That's 2 faces
that are exactly at the same location. When a ray reatch those, it can't readily
chose between whitch one is encountered first. Then, you have rounding errors
from the FP number crunching.
The cure is to move one object a very little bit.
The best way may be to have the two objects overlap by a small value:
change "HeavyLiquidRegion" dimentions as follow
box { <-1.899, 2.9999, -1.899>, <1.899, 5, 1.899>
OR, you can do it the other way and create a small gap:
box { <-1.899, 3.0001, -1.899>, <1.899, 5, 1.899>
--
Alain
-------------------------------------------------
There will always be beer cans rolling on the floor of your car when the boss
asks for a ride home from the office.
Post a reply to this message
|
![](/i/fill.gif) |