POV-Ray : Newsgroups : povray.newusers : Problem with nested transparent objects Server Time
23 Nov 2024 04:41:12 EST (-0500)
  Problem with nested transparent objects (Message 1 to 5 of 5)  
From: kai
Subject: Problem with nested transparent objects
Date: 30 Mar 2018 18:50:01
Message: <web.5abebe5d73e4ad374d9b10120@news.povray.org>
I want to create an animation where I fade an object out and another is faded in
in order to take the place of the first one.  I thought I could do this by
keying the t field to the clock, but it turns out that the inner object, which
is supposed to start out invisible, becomes visible as soon as it is inside the
other object.  Here is a still image sample demonstrating what happens:

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

global_settings {
  max_trace_level 16
  assumed_gamma 1.0
}
camera {
  location <0, 4, 4>
  look_at <0, 0, 0>
  right     x*image_width/image_height
  angle 45
}

light_source { <0, 0, 0> color White }

background { White }

sphere {
    <0, 0, 0>, 1
    texture {
      pigment { srgbft <  1.0, 1.0, 1.0, 0.7, 0.0 > }
      finish  { Glass_Finish }
    }
    interior { Glass_Interior }
  }

  sphere {
    <0, 0, 0>, 0.75
    texture {
      pigment { srgbft <  0.9, 0.1, 0.2, 0.7, 1.0 > }
      finish  { Glass_Finish }
    }
    interior { Glass_Interior }
  }



Now, if I comment out the first sphere, then the second one is invisible, as it
should be.  If I comment out the second sphere, the first is visible, as it
should be.  BUT, if *both* spheres are rendered, the second, red one, becomes
visible inside the first one.  This happens even if I change the interior to
hollow.  Increasing the max_trace_level does not seem to make a difference
either.

So, what should I properly do to get a fade-in/fade-out of nested translucent
objects?


Post a reply to this message

From: Kenneth
Subject: Re: Problem with nested transparent objects
Date: 30 Mar 2018 21:25:00
Message: <web.5abee29733249f96a47873e10@news.povray.org>
There are some things in your test scene that are causing some visual confusion.

Your background(White} is the same color as your first sphere, so I changed the
background color to rgb .5. Then, when I render the scene with both spheres in
it, I see ONLY the 2nd (red) sphere; I don't see BOTH spheres.

Your light source is at the center of both spheres; did you mean to do that?

Max_trace_level can be left at its default of 5; that is not a problem when
there are only two translucent spheres in the scene.

I think that the use of  finish{Glass_Finish}  might be confusing the expected
result as well. That finish has  specular 1.0   in it (as well as 0.0 for both
ambient and diffuse.) Specular (and phong) highlights DO show up even on
'invisible' object surfaces. Also, I *think* that the srgbft color of your 2nd
sphere might be causing a problem:
                 srgbft <  0.9, 0.1, 0.2, 0.7, 1.0 >

The filter and transmit values *add up* to more than 1.0 here. My own test shows
that a supposedly 'invisible' sphere starts to become visible again, past that
1.0 threshold.

I reworked your scene to simplify it (and eliminated the 'filter' transparency
altogether.) Try animating this code; maybe 100 frames. The result I see is that
both spheres fade-in/fade-out the correct way.
-----------
#version 3.7;

#include "colors.inc"

global_settings {
  max_trace_level 5
  assumed_gamma 1.0
}
camera {
  location <0, 4, 4>
  look_at <0, 0, 0>
  right     x*image_width/image_height
  angle 45
}

light_source { <20,20,-40> color White }

background{rgb .4}

sphere {  // GREEN
    <0, 0, 0>, 1
    texture {
      pigment { srgbt < .5, 1.0, .5, clock > }
      finish{ambient .05 diffuse .95}
    }
  }

  sphere {  // RED
    <0, 0, 0>, 0.75
    texture {
      pigment { srgbt <  0.9, 0.1, 0.2, 1 - clock > }
      finish{ambient .05 diffuse .95}
    }
  }


Post a reply to this message

From: kai
Subject: Re: Problem with nested transparent objects
Date: 31 Mar 2018 07:20:01
Message: <web.5abf6e0433249f964d9b10120@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> There are some things in your test scene that are causing some visual confusion.
>
> Your background(White} is the same color as your first sphere, so I changed the
> background color to rgb .5. Then, when I render the scene with both spheres in
> it, I see ONLY the 2nd (red) sphere; I don't see BOTH spheres.

I think you are right.  I have now put a checkerboard behind the spheres to
better see what they do, including the refraction effects.

> Your light source is at the center of both spheres; did you mean to do that?

The final scene is to contain objects surrounding the centre, I just didn't
bother moving the light for the test.

> I think that the use of  finish{Glass_Finish}  might be confusing the expected
> result as well.

Yeah, well, but if I remove it, I don't get the translucent glass effect I want.

> That finish has  specular 1.0   in it (as well as 0.0 for both
> ambient and diffuse.) Specular (and phong) highlights DO show up even on
> 'invisible' object surfaces.

Hm, that would be a problem then.

> Also, I *think* that the srgbft color of your 2nd
> sphere might be causing a problem:
>                  srgbft <  0.9, 0.1, 0.2, 0.7, 1.0 >
>
> The filter and transmit values *add up* to more than 1.0 here.



want, but I now understand that I can get unexpected contributions from all the

it may be that I have to come up with some semiplausible physics interpretation



Post a reply to this message

From: Bald Eagle
Subject: Re: Problem with nested transparent objects
Date: 31 Mar 2018 08:35:01
Message: <web.5abf7f8d33249f965cafe28e0@news.povray.org>
Nice work puzzling this out, Kenneth  :)
I haven't had a chance to render this one yet.


Take a look at this thread where I explored this problem, and clipka gave a very
thorough explanation and solution.

http://news.povray.org/povray.binaries.images/thread/%3Cweb.57a7e643418f435e7df57c0%40news.povray.org%3E/

So, I'd set your pigment values with an equation, such that the sum of each term
never exceeds one.

You may also try using the clock to control the highlights - switch one off at
some critical fading value, and the other one on when it's starting to become
visible enough, then increase the values linearly increasing from zero to max
over the remaining clock cycle.


Post a reply to this message

From: kai
Subject: Re: Problem with nested transparent objects
Date: 16 Apr 2018 16:15:01
Message: <web.5ad5034533249f96108bf8550@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Nice work puzzling this out, Kenneth  :)
> I haven't had a chance to render this one yet.
>
>
> Take a look at this thread where I explored this problem, and clipka gave a very
> thorough explanation and solution.
>
>
http://news.povray.org/povray.binaries.images/thread/%3Cweb.57a7e643418f435e7df57c0%40news.povray.org%3E/
>
> So, I'd set your pigment values with an equation, such that the sum of each term
> never exceeds one.
>
> You may also try using the clock to control the highlights - switch one off at
> some critical fading value, and the other one on when it's starting to become
> visible enough, then increase the values linearly increasing from zero to max
> over the remaining clock cycle.


rendered the objects separately and composited the images with ImageMagick.  At

https://drive.google.com/open?id=1lCNP0vkWbThhkJKv_WktTHJfbAyM-Aw9


Post a reply to this message

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