POV-Ray : Newsgroups : povray.newusers : Problems with photon mapping and transparancy Server Time
24 Nov 2024 12:41:16 EST (-0500)
  Problems with photon mapping and transparancy (Message 1 to 6 of 6)  
From: Killroy Quartermaine
Subject: Problems with photon mapping and transparancy
Date: 11 Jul 2008 01:00:01
Message: <web.4876e86e5eef6c304cdc498c0@news.povray.org>
OK, so a little background.

POVRay is my first ray tracer, and with no background in three-dimensional
design or code-writing, and basically poor math skills, I've been having a
heckuva time teaching myself.

That said, what progress I've made, I've made just about entirely on my own, and
I've done some pretty snazzy stuff with simple abstracts using CSG. Just now I'm
working on building non-abstract objects, and I decided to start with a simple
task: A spherical bottle holding a quantity of clear water.

I had previously played a bit with ior values, and this time decided to play
with photon mapping as well.

So I build my bottle as a CSG object: a difference of two spheres merged with a
difference of two cylinders, with a torus for the lip. Then I chop a cut-to-
interior sized half sphere using a difference of a sphere and box.

The bottle renders perfectly on it's own. The "water" renders just fine on it's
own as well. Just about perfectly clear, with the right diffraction and
whatnot.

But when I render the two together, the water appears more like crude oil, and
while it makes a very pretty pattern with the  diffracted light from the
bottle, I was aiming for clear water.

Any help that you can offer would be much appreciated.

Oh, uh, here's the code... messy as it is:

//bottle 1. An attempt to create glass objects with properties of refraction,
hollow interiors, and whatnot.

include "colors.inc"
include "woods.inc"
include "metals.inc"
include "stones.inc"

 global_settings {
   photons {
     count 90000
     autostop 0
     jitter .4
   }
 }


camera {location<-5,3,-5> look_at<0,0,1>}

light_source {<-10,10,0>
         White
         area_light <1,0,0>, <0,0,1> 3,3 adaptive 1 jitter
         photons{area_light}
         }
light_source {<-10,10,0>
         White
         area_light <1,0,0>, <0,0,1> 3,3 adaptive 1 jitter
         photons{area_light}
         }

plane {<0,1,0>, -2 texture {T_Grnt11a} photons {target collect on}}

#declare ClosedBell = difference {
        sphere {<0,0,0>, 2}
        sphere {<0,0,0>, 1.85}
        }
#declare OpenBell = difference {
        object {ClosedBell}
        cylinder {<0,0,0> <0,2.1,0> .5 }
        }
#declare Stem = difference {
        cylinder {<0,1.9,0> <0,3.5,0> .5}
        cylinder {<0,1.89,0> <0,3.6,0> .35}
        }
#declare FinishStem = merge {
        object {Stem}
        torus {.5, .1399 translate <0,3.45,0>}
        }
#declare Bottle1 = merge {
        object {FinishStem}
        object {OpenBell}
        }
#declare Water1 = difference {
        sphere {<0,0,0>, 1.8499}
        box {<2,0,2> <-2,2,-2>}
        }

object {Water1
         pigment {rgbf <1,1,1,.9999>}
         interior {ior 1.01}
         photons {target reflection on refraction on}
         finish {ambient 2}
         }

object {Bottle1
         pigment {rgbf <.98,.90,.94,1>}
         finish {reflection .1 specular .3 roughness .01 diffuse.02}
         interior {ior 1.5 dispersion 1.1}
         photons { target reflection on refraction on}
         rotate <45,0,0>}


Post a reply to this message

From: Chris B
Subject: Re: Problems with photon mapping and transparancy
Date: 11 Jul 2008 04:32:03
Message: <48771a83@news.povray.org>
"Killroy Quartermaine" <iam### [at] yahoocom> wrote in message 
news:web.4876e86e5eef6c304cdc498c0@news.povray.org...
> ...
> I build my bottle as a CSG object: a difference of two spheres merged with 
> a
> difference of two cylinders, with a torus for the lip. Then I chop a 
> cut-to-
> interior sized half sphere using a difference of a sphere and box.
>
> The bottle renders perfectly on it's own. The "water" renders just fine on 
> it's
> own as well. Just about perfectly clear, with the right diffraction and
> whatnot.
>
> But when I render the two together, the water appears more like crude oil, 
> and
> while it makes a very pretty pattern with the  diffracted light from the
> bottle, I was aiming for clear water.
>

You'll need to increase the max_trace_level in your global_settings block. 
A ray is traced from your camera to the glass, through the shell, across the 
tiny gap to your water, through the water, then the same out the other side, 
so '7' should do it, but you might like to go higher (maybe '12') to avoid 
black spots appearing if you choose a camera angle that takes you through 
elements of the bottle neck and then down through the bottle and water.

The message stream also shows that the four #include statements at the start 
of your example are missing the '#' symbol.

Regards,
Chris B.


Post a reply to this message

From: Killroy Quartermaine
Subject: Re: Problems with photon mapping and transparancy
Date: 11 Jul 2008 05:40:00
Message: <web.487729cc5199265b4cdc498c0@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> "Killroy Quartermaine" <iam### [at] yahoocom> wrote in message
> news:web.4876e86e5eef6c304cdc498c0@news.povray.org...
> > ...
> > I build my bottle as a CSG object: a difference of two spheres merged with
> > a
> > difference of two cylinders, with a torus for the lip. Then I chop a
> > cut-to-
> > interior sized half sphere using a difference of a sphere and box.
> >
> > The bottle renders perfectly on it's own. The "water" renders just fine on
> > it's
> > own as well. Just about perfectly clear, with the right diffraction and
> > whatnot.
> >
> > But when I render the two together, the water appears more like crude oil,
> > and
> > while it makes a very pretty pattern with the  diffracted light from the
> > bottle, I was aiming for clear water.
> >
>
> You'll need to increase the max_trace_level in your global_settings block.
> A ray is traced from your camera to the glass, through the shell, across the
> tiny gap to your water, through the water, then the same out the other side,
> so '7' should do it, but you might like to go higher (maybe '12') to avoid
> black spots appearing if you choose a camera angle that takes you through
> elements of the bottle neck and then down through the bottle and water.
>
> The message stream also shows that the four #include statements at the start
> of your example are missing the '#' symbol.
>
> Regards,
> Chris B.

Thanks for your help! You know, you'd think I'd have caught that max-trace-level
thing. it seems to be the solution to a great many problems.

also, that whole leaving out the pound sign thing is a nasty habit that I know
I've got to break.


Post a reply to this message

From: Chris B
Subject: Re: Problems with photon mapping and transparancy
Date: 11 Jul 2008 06:24:18
Message: <487734d2$1@news.povray.org>
"Killroy Quartermaine" <iam### [at] yahoocom> wrote in message 
news:web.487729cc5199265b4cdc498c0@news.povray.org...

> Thanks for your help! You know, you'd think I'd have caught that 
> max-trace-level
> thing. it seems to be the solution to a great many problems.

It's almost like the POV-Ray equivalent of "have you tried switching it off 
and on again" for Windows support :-)


Post a reply to this message

From: Reactor
Subject: Re: Problems with photon mapping and transparancy
Date: 11 Jul 2008 20:20:00
Message: <web.4877f85d5199265b1c70c0cf0@news.povray.org>
"Killroy Quartermaine" <iam### [at] yahoocom> wrote:
>
> The bottle renders perfectly on it's own. The "water" renders just fine on it's
> own as well. Just about perfectly clear, with the right diffraction and
> whatnot.
>
> But when I render the two together, the water appears more like crude oil, and
> while it makes a very pretty pattern with the  diffracted light from the
> bottle, I was aiming for clear water.
>
> Any help that you can offer would be much appreciated.
>

A few things I noticed that might help (in addition to the max_trace_level
issue):

In the code for your water, the ior is 1.01.  The ior for water is actually
closer to 1.33.  I would set the dispersion to 1.01 though, like
    interior {ior 1.33 dispersion 1.01}
This requires a fairly high max_trace_level, around 30
(if you prefer your values, then please disregard)

When I ran your scene, I tested it with a light background to ensure that the
max_trace_level was not being hit (so I could distinguish a black patch from
what could be the background).  During that, I noticed that the texture for the
plane is actually translucent.  If you are not going to place any objects
beneath the plane, I recommend using a different texture or modifying that
texture for a possible speed boost.


You have two identical light sources in the same location.  You can actually use
one but make the intensity greater than one, like:

light_source {<-10,10,0>
         White * 2
         area_light <1,0,0>, <0,0,1> 3,3 adaptive 1 jitter
         photons{area_light}
         }

Using a multiplier of 2 would make it twice as bright, which would be equivalent
to your code.

    HTH

-Reactor

P.S. Have fun!


Post a reply to this message

From: Alain
Subject: Re: Problems with photon mapping and transparancy
Date: 11 Jul 2008 22:25:00
Message: <487815fc$1@news.povray.org>
Killroy Quartermaine nous illumina en ce 2008-07-11 00:58 -->
> OK, so a little background.
> 
> light_source {<-10,10,0>
>          White
>          area_light <1,0,0>, <0,0,1> 3,3 adaptive 1 jitter
>          photons{area_light}
>          }
> 
A technical note:

You use adaptive 1 on an area_light that use a 3x3 aray. As adaptive 1 START 
with a 3x3 aray, you don't get any benefit from using adaptive.
You can use a 33x33 aray and get almost the same gendering speed, and MUCH 
smoother shadows.
When using adaptive, you usualy start with adaptive 0. If you get artefacts in 
the shadoes, then you try adaptive 1, then adaptive 2 if you still get artefacts.
With adaptive, there is no real gain in using an aray of less than 9x9.
The optimum values are 5, 9, 17, 33, 65, 129, 257,...
With values of 33 and larger, jitter becomes about useless in most cases.

You can add "circular" to simulate a disk shaped area_light.
You can add "circular orient" to simulate a spherical area_light.

-- 
Alain
-------------------------------------------------
You know you've been raytracing too long when a co-worker nearly kills himself 
over losing an hour's worth of work after a computer crash, and you just calmly 
shrug your shoulders and say, "Is that all?"
Taps a.k.a. Tapio Vocadlo


Post a reply to this message

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