POV-Ray : Newsgroups : povray.general : Weird artifacts from two superposed boxes perspective view Server Time
5 Nov 2024 01:22:01 EST (-0500)
  Weird artifacts from two superposed boxes perspective view (Message 1 to 9 of 9)  
From: Mike
Subject: Weird artifacts from two superposed boxes perspective view
Date: 14 Jan 2009 16:55:01
Message: <web.496e5e11b6ff9551c9b9f9f00@news.povray.org>
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}}}


Post a reply to this message

From: Alain
Subject: Re: Weird artifacts from two superposed boxes perspective view
Date: 14 Jan 2009 18:43:50
Message: <496e78b6$1@news.povray.org>
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

From: Mike
Subject: Re: Weird artifacts from two superposed boxes perspective view
Date: 14 Jan 2009 19:20:00
Message: <web.496e807d620d6c00cb45af7a0@news.povray.org>
I actually did this and it still did not work.  I also tried overlapping the two
and using the merge operation and that did not work either.

-Mike

Alain <ele### [at] netscapenet> wrote:
> 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

From: clipka
Subject: Re: Weird artifacts from two superposed boxes perspective view
Date: 15 Jan 2009 05:50:00
Message: <web.496f1483620d6c00af8dfc8f0@news.povray.org>
"Mike" <win### [at] hotmailcom> wrote:
> #declare AlcoholRegion=
> box { <-1.899, 0.2, -1.899>, <1.899, 3, 1.899>
> ...
> #declare HeavyLiquidRegion=
> box { <-1.899, 3, -1.899>, <1.899, 5, 1.899>
> ...

Avoid coincident surfaces - it's a known problem in POV-Ray. Give the boxes a
tiny bit of spacing in between, or have them overlap a tiny bit.


Post a reply to this message

From: Dan Connelly
Subject: Re: Weird artifacts from two superposed boxes perspective view
Date: 15 Jan 2009 11:17:09
Message: <496f6185$1@news.povray.org>
clipka wrote:
> "Mike" <win### [at] hotmailcom> wrote:
>> #declare AlcoholRegion=
>> box { <-1.899, 0.2, -1.899>, <1.899, 3, 1.899>
>> ...
>> #declare HeavyLiquidRegion=
>> box { <-1.899, 3, -1.899>, <1.899, 5, 1.899>
>> ...
> 
> Avoid coincident surfaces - it's a known problem in POV-Ray. Give the boxes a
> tiny bit of spacing in between, or have them overlap a tiny bit.


A cumbersome problem..... when constructing compound objects analytically, to keep
track of displacing surfaces to avoid coincidences tends to really obfuscate the code.
 I suppose a general addition of a random offset would be simple enough, but then the
threshold of coincidence is sufficiently large that this wouldn't be reliable.


Post a reply to this message

From: Mike
Subject: Re: Weird artifacts from two superposed boxes perspective view
Date: 15 Jan 2009 12:35:01
Message: <web.496f71e0620d6c00c9b9f9f00@news.povray.org>
I actually have known all about not having coincident surfaces.  I was trying a
bunch of different things to make the object look correct, even with a small
spacing it does not work.  It seems like it might be blowing out the max trace
level in the bottom box which is supposed to be clear, but only the top half
is.  Then it seems this problem creates a weird shadow in the top box.  I guess
I accidentally posted the code in which the two are coincident.  Here is the one
where they are not.  This should work, but it does not look right?  Is there any
way to post a picture here rather than you all having to compile it to see what
I am saying.

Thanks,
Mike

#include "colors.inc"
#include "textures.inc"

global_settings{max_trace_level 255}
camera {
     location  <0, 3, 260>
    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.001, -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}}}


Post a reply to this message

From: clipka
Subject: Re: Weird artifacts from two superposed boxes perspective view
Date: 15 Jan 2009 12:45:00
Message: <web.496f75c0620d6c009b4043b60@news.povray.org>
"Mike" <win### [at] hotmailcom> wrote:
> Is there any way to post a picture here rather than you all having to
> compile it to see what I am saying.

You may want to post it in povray.binaries.images. We'll find it there.


Post a reply to this message

From: Reactor
Subject: Re: Weird artifacts from two superposed boxes perspective view
Date: 15 Jan 2009 15:45:01
Message: <web.496f9fd4620d6c00eeb950fe0@news.povray.org>
"Mike" <win### [at] hotmailcom> wrote:
> I actually have known all about not having coincident surfaces.  I was trying a
> bunch of different things to make the object look correct, even with a small
> spacing it does not work.  It seems like it might be blowing out the max trace
> level in the bottom box which is supposed to be clear, but only the top half
> is.  Then it seems this problem creates a weird shadow in the top box.  I guess
> I accidentally posted the code in which the two are coincident.  Here is the one
> where they are not.  This should work, but it does not look right?  Is there any
> way to post a picture here rather than you all having to compile it to see what
> I am saying.
>
> Thanks,
> Mike

I tried your scene.  It is kind of neat, I am having fun with it.  I see the
black parts your are talking about, and they are max_trace_level artifacts.
There are two separate patches that are not rendering correctly.  To
troubleshoot this scene, I first commented out the HeavyLiquidRegion object to
work with the alcohol region.  The alcohol region is hovering above the plane,
presumably to avoid the coincident surfaces issue.  I think the scene is more
correct when you extend that part below the plane. I changed the AlcoholRegion
declaration to this:

#declare AlcoholRegion=
box { <-1.899, -0.2, -1.899>, <1.899, 3, 1.899>
material { MaterialAlcohol }
  interior {
  ior 1.3800
}
 }

The -0.2 y value puts the bottom edge below the plane, and the AlcoholRegion now
renders more correctly.

I did the same thing for the HeavyLiquidRegion  object, changed it to:
#declare HeavyLiquidRegion=
box { <-1.899, 2.9999, -1.899>, <1.899, 5, 1.899>
material { HeavyLiquid }
 interior {
    ior 1.4
}
}

I also changed the diffuse component and the roughness value from 0 to 1 in both
of their finishes.  These changes looks more correct to me, as they remove the
black bars.  I am now adding photons, and it looks pretty cool.

HTH,
-Reactor


Post a reply to this message

From: Mike
Subject: Re: Weird artifacts from two superposed boxes perspective view
Date: 15 Jan 2009 19:30:01
Message: <web.496fd434620d6c00c9b9f9f00@news.povray.org>
> I tried your scene.  It is kind of neat, I am having fun with it.  I see the
> black parts your are talking about, and they are max_trace_level artifacts.
> There are two separate patches that are not rendering correctly.  To
> troubleshoot this scene, I first commented out the HeavyLiquidRegion object to
> work with the alcohol region.  The alcohol region is hovering above the plane,
> presumably to avoid the coincident surfaces issue.  I think the scene is more
> correct when you extend that part below the plane. I changed the AlcoholRegion
> declaration to this:
>
> #declare AlcoholRegion=
> box { <-1.899, -0.2, -1.899>, <1.899, 3, 1.899>
> material { MaterialAlcohol }
>   interior {
>   ior 1.3800
> }
>  }
>
> The -0.2 y value puts the bottom edge below the plane, and the AlcoholRegion now
> renders more correctly.
>
> I did the same thing for the HeavyLiquidRegion  object, changed it to:
> #declare HeavyLiquidRegion=
> box { <-1.899, 2.9999, -1.899>, <1.899, 5, 1.899>
> material { HeavyLiquid }
>  interior {
>     ior 1.4
> }
> }
>
> I also changed the diffuse component and the roughness value from 0 to 1 in both
> of their finishes.  These changes looks more correct to me, as they remove the
> black bars.  I am now adding photons, and it looks pretty cool.
>
> HTH,
> -Reactor

Yeah, it looks much better.  Actually, when I try changing the ior of the heavy
liquid from 1.4 to 1.5 it looks a bit weird again.  This is actually around the
ior I will need I just made a simplified test.  It seems if I turn merge on when
the regions overlap a bit it seems to fix it with even 1.5 ior.  I still however
see what I think are weird shadows of the heavy liquid inside the clear alcohol
region and weird shadows on the top of the heavy liquid box.  I am not too sure
how much I want to play with the diffuse and roughness settings because I am
actually trying to simulate two liquids in a tank and think the settings should
be zero.  They do not seem to change too much anyway.  Some of the extra shadows
are weird though, I wonder where they come from?

-Mike


Post a reply to this message

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