POV-Ray : Newsgroups : povray.newusers : Transparent Objects Become Black : Re: Transparent Objects Become Black Server Time
28 Nov 2021 15:40:00 EST (-0500)
  Re: Transparent Objects Become Black  
From: Kenneth
Date: 11 Nov 2021 12:55:00
Message: <web.618d505428696f324cef624e6e066e29@news.povray.org>
Hi! Welcome to the forum.

Your sphere voids are not really 'black' but opaque (like silhouettes) due to
your light's position.

After stripping-out everything that was non-essential in your code, I
narrowed-down the problem to your 'gel' object and its differenced spheres (the
'voids'). It was only then that I realized that the problem is really with the
spheres themselves: In your code section "Add Bubble Definitions here", you need
to #declare those individual objects, then use *those* definitions in your gel
object. The sphere objects you actually used in your gel object are 'redefined'
there and have 'default' textures (which have no transparency.) So in effect,
your original five sphere definitions are not even being used; and the ones you
did use are simply opaque.

I've included my stripped-down scene to give you a better idea of what is
required, code-wise. I hope this helps you to understand the idea of #declaring
objects beforehand. Of course, it's not always necessary; you could have written
your five complete sphere definitions IN the gel object instead, without using
#declares.


[Some notes: In your own code, you used  ambient_light White. Nothing wrong with
that, but in case you don't know, ambient_light is just a *multiplier* for the
finish(ambient...} values in a scene. So here, you are simply multiplying your
ambient values by <1,1,1>, which is the White color.  Also, it looks like you
have a redundant or extra use of rotate <...> for your sphere voids. You should
eliminate one set of those, unless it's for some purpose.]

--- simplified code ---
#version 3.8;
global_settings{assumed_gamma 1.0 max_trace_level 50}

background{rgb <.1,.05,.05>}

#include "colors.inc"

#default{finish{ambient 0 emission 0 diffuse .9}}

#declare epsilon       = .0001;
#declare light_loc_x   = 0;
#declare light_loc_y   = 0;
#declare light_loc_z   = 90;

#declare tube_base    =  -55;
#declare tube_height  = 92;
#declare tube_rinner  = 13;

#declare gel_height   = 0.9*tube_height;
#declare bubble_r     = 0.8;

// [additional camera]
camera {
  perspective
  location  <-40, 19, -5>
  look_at   <0, 19,  0>
  right     x*image_width/image_height
 // rotate -180*clock*y
}

light_source {
<light_loc_x, light_loc_y,light_loc_z>
color White
  }


// Creating bubbles that go into voids of gel


// Add Bubble Definitions Here:

#declare SPH_1 =
sphere{ <4.708,7.784,4.171>, (bubble_r)
 texture {
  pigment{ color rgbt<.99,.99,.99,0.9>}
            finish { phong .001 }
              }
}

#declare SPH_2 =
sphere{ <1.862,29.796,-6.023>, (bubble_r)
 texture {
  pigment{ color rgbt<.99,.99,.99,0.9>}
  finish { phong .001 }
    }
}

#declare SPH_3 =
sphere{ <-7.205,20.129,-3.448>, (bubble_r)
 texture {
  pigment{ color rgbt<.99,.99,.99,0.9>}
  finish { phong .001 }
    } // end of texture
}

#declare SPH_4 =
sphere{ <1.424,17.806,-9.772>, (bubble_r)
 texture {
  pigment{ color rgbt<.99,.99,.99,0.9>}
  finish { phong .001 }
    } // end of texture
}

#declare SPH_5 =
sphere{ <-5.249,17.494,-3.139>, (bubble_r)
 texture {
  pigment{ color rgbt<.99,.99,.99,0.9>}
  finish { phong .001 }
    } // end of texture
}

// --- Creating gel and the bubble voids ---

difference{
 merge{
  sphere { <0,tube_base,0>, tube_rinner-epsilon}
  cylinder{<0,tube_base,0>, <0,gel_height,0>,
                                tube_rinner-epsilon}
   texture { pigment{ color rgbt<.99,.99,.99,0.9>}
   finish { phong .001 }
                      } // end of texture
  } // end merge (gel matrix)

// subtract Bubble Voids Here:

 object{SPH_1}  // bubble
 object{SPH_2}  // bubble
 object{SPH_3}  // bubble
 object{SPH_4}  // bubble
 object{SPH_5}  // bubble

 } // End difference for bubbles


Post a reply to this message

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