POV-Ray : Newsgroups : povray.newusers : Dark Regions and Reflections Removal Server Time
25 Jan 2022 18:26:13 EST (-0500)
  Dark Regions and Reflections Removal (Message 1 to 4 of 4)  
From: bubble person
Subject: Dark Regions and Reflections Removal
Date: 9 Dec 2021 07:30:00
Message: <web.61b1f62243650b178f16f7e87c94cc22@news.povray.org>
Hello Forum,

I have been beating my head against an issue in the rendering of scene.   I have
bubbles entrained in a gel, encased in a glass tube.  This is then surrounded by
water, and another clear cylinder containing the water.  I have an area light
backlighting this setup and a camera looking directly through the setup into my
backlight.

When I first rendered my setup, everything was looking good, and so I decided to
run it as an animation, rotating the bubbles around Y axis.  However, when I ran
the animation, the boundary between the glass and water appeared to be speckled,
which immediately made me think of an overlapping surface issue.  I addressed it
by adding an "epsilon" to the radius of my water cylinder's inner surface and
ran it again.  While the speckled surface issue was resolved, a large portion of
my cylinder is being rendered as a dark region, and this region will not go away
no matter what I do.

I have tried repositioning my light, resizing my light, playing with the epsilon
between the water and glass definition, increasing the max_trace_level, and with
the material characteristics of the glass.  In all cases, there seems to be a
new dark region that obscures the outer edges of my gel region.  I think this

of the glass closest to the camera, as the dark region obscures bubbles within
the gel region.


included my code below as I can only attach a single file.

Can anyone help me troubleshoot this issue?

Thank you all for your support and insights!

Sincerely,

Bubble_person


====================
Script Below
====================

//Files with predefined colors and textures
#include "colors.inc"
#include "glass.inc"
#include "stones.inc"

 global_settings { max_trace_level 50}

#declare epsilon         = .0001;

#declare light_loc_x   = 0;
#declare light_loc_y   = 0;
#declare light_loc_z   = 100;

#declare tube_base    =  -55;
#declare tube_height  = 92;
#declare tube_rinner  = 13;
#declare tube_router  = 16;
#declare tube_lip_width = 2;

#declare tube_rotation_x = 0;
#declare tube_rotation_y =  2*clock;
#declare tube_rotation_z = 0;

#declare water_router     = 25.4;
#declare plexi_router      = 31.75;

#declare gel_height         = 0.9*tube_height;

#declare bubble_r            = 0.8;
#declare bubble_ior         = 1.0;

//Place the camera
camera {
  location  <000,000,-500>    //Camera location
  look_at   <0,0,1>     //Where camera is pointing
  angle 15       //Angle of the view--increase to see more, decrease to see less
}

//Ambient light to "brighten up" darker pictures
global_settings { ambient_light White }

//Set a background color
background { color Black }


// Set up light source from box

#declare light_box = box{ <-80,-100,0>, <80,100,2>
        pigment{color White}
       } //end light box


light_source {
    <light_loc_x, light_loc_y,light_loc_z>
    color White
    area_light 160*x, 200*y 20, 20
    adaptive 1
    jitter
    looks_like { light_box }
  }

//=====================================================================================
// Creating bubbles that go into gel
//=====================================================================================


// Create Bubbles

#declare MatBubble =
material {
  texture {
    pigment {color rgbt<.99,.99,.99,0.98>}
    normal { bumps 0 scale 0.025 }
    finish { phong .001 }
  } // end of texture
  interior{
    ior           bubble_ior
    dispersion         1.01 // this simulates dispersion caused refraction
    dispersion_samples  7
    fade_power         1001     //(0=off)  (realistic: 1~2, >=1000 ->realistic
exponential attenuation function will be used!)
  } // end of interior
} // end of material


// Add Bubble Definitions Here:
#declare Bubble_5 =sphere{ <3.94,-7.554,-4.927>, (bubble_r)
       material{MatBubble}
   }  //end sphere (bubble)
#declare Bubble_4 =sphere{ <-1.53,35.605,-2.926>, (bubble_r)
       material{MatBubble}
   }  //end sphere (bubble)
#declare Bubble_3 =sphere{ <-1.271,40.873,2.981>, (bubble_r)
       material{MatBubble}
   }  //end sphere (bubble)
#declare Bubble_2 =sphere{ <2.972,-36.206,-1.126>, (bubble_r)
       material{MatBubble}
   }  //end sphere (bubble)
#declare Bubble_1 =sphere{ <8.863,-12.984,3.351>, (bubble_r)
       material{MatBubble}
   }  //end sphere (bubble)



union {

// Add Union here
  object {Bubble_5}
  object {Bubble_4}
  object {Bubble_3}
  object {Bubble_2}
  object {Bubble_1}

  rotate <tube_rotation_x,tube_rotation_y,tube_rotation_z>
}


//=====================================================================================
//Creating Glass Tube
//=====================================================================================


//create hollow cylinder

#declare GlassTube =
merge{
 difference{
  //Create single cylinder
  cylinder { <0,(tube_base-epsilon),0>, <0,tube_height,0>,   tube_router
     } // end cylinder

  cylinder { <0,(tube_base-2*epsilon),0>, <0,tube_height+epsilon,0>,
tube_rinner
     } // end cylinder
   }  // End difference (hollow cylinder)

  //create hollow half-sphere
  difference{
   difference{
    //Create single cylinder
    sphere { <0,0,0>,   tube_router } // end sphere
    sphere { <0,0,0>,   tube_rinner} // end sphere
     } // End difference (Hollow Sphere)
   box{ <-2* tube_router ,0,-2* tube_router >,
      < 2*tube_router , 2*tube_router ,2* tube_router >
     } // End Box

    translate<0,tube_base,0>
     }   // End Difference (Half-Sphere)

 // create Lip torus at top of tube
 torus {  (tube_router+ tube_rinner)/2, tube_lip_width
  translate <0,tube_height,0>
 } // End Torus (Tube Lip)


      material{
            texture {  pigment{ color rgbt<.99,.99,.99,0.99>}
                       normal { bumps 0 scale 0.025 }
                       finish { phong .99}
                     } // end of texture
            interior{  ior        1.56
               dispersion                1.0 // this simulates dispersion caused
refraction
               dispersion_samples   7
               fade_power           1001     //(0=off)  (realistic: 1~2, >=1000
->realistic exponential attenuation function will be used!
                       caustics 0.0
                    } // end of interior
            } // end of material

 rotate<tube_rotation_x,tube_rotation_y,tube_rotation_z>

  } // End Merge (Full tube)

GlassTube

//=====================================================================================
// Creating Gel  to fill Glass Tube with voids for the bubbles
//=====================================================================================
// Creating gel to fill glass

#declare GelCyl =
 merge{
  sphere { <0,tube_base,0>,   tube_rinner-epsilon} // end sphere
  cylinder{<0,tube_base,0>, <0,gel_height,0>,   tube_rinner-epsilon}// end
cylinder
       material{
             texture {  pigment{ color rgbt<.99,.99,.99,0.98>}
                        normal { bumps 0 scale 0.025 }
                        finish { phong .001 }
                      } // end of texture
             interior{  ior        1.405
                dispersion                1.01  // this simulates dispersion
caused refraction
                dispersion_samples   7
                fade_power           1001     //(0=off)  (realistic: 1~2, >=1000
->realistic exponential attenuation function will be used!
                        caustics 0.0
                     } // end of interior
             } // end of material


  } // end merge (gel matrix)

GelCyl

//=====================================================================================
// Creating Water Cylinder around tube
//=====================================================================================

#declare WaterCyl =
difference{
 cylinder{
  <0,tube_base-tube_router,0>,<0,tube_height*.8,0>, water_router} //End outer
cylinder
 merge{
  cylinder{<0,tube_base,0>, <0,tube_height+epsilon,0>, tube_router+epsilon} //
end cylinder for glass tube

  sphere{<0,tube_base,0>, tube_router+epsilon} // end sphere (tube bottom)
  } //end merge (glass tube inside of water


    material{
             texture {  pigment{ color rgbt<.99,.99,.99,0.98>}
                        normal { bumps 0 scale 0.025 }
                        finish { phong .001 }
                      } // end of texture
             interior{  ior        1.33
                dispersion                1.01 // this simulates dispersion
caused refraction
                dispersion_samples   7
                fade_power           1001     //(0=off)  (realistic: 1~2, >=1000
->realistic exponential attenuation function will be used!
                        caustics 0.0
                     } // end of interior
             } // end of material
} // End difference of outer water tube

WaterCyl


//=====================================================================================
//Creating Plexiglass Cylinder holding water
//=====================================================================================
#declare PlexCyl =
difference{
 cylinder{<0,tube_base-tube_router,0>,<0,tube_height*.9,0>, plexi_router} //End
outer cylinder
 cylinder{<0,tube_base-tube_router-epsilon,0>,<0,tube_height*.9+epsilon,0>,
water_router+epsilon} //End outer cylinder

    material{
             texture {  pigment{ color rgbt<.99,.99,.99,0.98>}
                        normal { bumps 0 scale 0.025 }
                        finish { phong .001 }
                      } // end of texture
             interior{  ior        1.495
                dispersion                1.01 // this simulates dispersion
caused refraction
                dispersion_samples   7
                fade_power           1001     //(0=off)  (realistic: 1~2, >=1000
->realistic exponential attenuation function will be used!
                        caustics 0.0
                     } // end of interior
             } // end of material

} // End difference of outer water tube


PlexCyl


Post a reply to this message


Attachments:
Download 'screenshot 2021-12-03 at 13.33.01.png' (338 KB)

Preview of image 'screenshot 2021-12-03 at 13.33.01.png'
screenshot 2021-12-03 at 13.33.01.png


 

From: Bald Eagle
Subject: Re: Dark Regions and Reflections Removal
Date: 9 Dec 2021 21:15:00
Message: <web.61b2b7b264eaca9f1f9dae3025979125@news.povray.org>
"bubble_person" <nomail@nomail> wrote:

> included my code below as I can only attach a single file.

You can attach more than one file if you use a newsreader like Thunderbird.
You can also post your scene in the scene files area with a link to it here, or
just post twice - once with the render illustrating your problem, and again with
your scene file as an attachment.

> Can anyone help me troubleshoot this issue?

I haven't done a _lot_ with your file, but I just played around with
restructuring some things and see what was where.
Take a look through what I did - I have a #switch block to use a top-down view
with simple textures to get a clear look at your objects, and did some other
things with an array and a macro for your bubbles.
Just change the value of "Render" to "Setup" or "Scene" to see how that works.

I changed some textures and made all the merges unions trying to speed it up -
so you may need to change some of those back.

With the small amount of work I did - I'm thinking that you might need to take a
look at your geometry and make sure everything is sized properly and nests the
way you think it does.

With regard to the speckles, I think what you should try is just differencing
your bubbles away from the gel instead of adding them in as objects with a whole
material definition.   You only need an interior with an ior if it's different
than air.  Think of your bubbles not air bubbles of air - but of spherical
regions where the gel has been subtracted away or excluded.


You need a version number
assumed_gamma in global_settings

doesn't make too much sense to define variables if you're only using the values
once

I find it very interesting that you successfully instantiate objects without
using the object {} wrapper!  :O
..oO(This scene is never gonna render without an error the way it's written...)
And it DID!


> Thank you all for your support and insights!

These things can always be really tricky - sometimes for quite complex reasons,
but other times for the most ridiculously simple reasons that are hard to see.

I'm thinking that you should "build up" your geometry from the center outwards,
using thickness values rather than distinct radii.   It's simpler (in my mind)
to do it that way without error, and if you ever change a value, everything else
still works because it's already "parameterized".

So,
gel_radius
gel radius + epsilon
gel_radius + epsilon + tube_thickness
gel_radius + epsilon + tube_thickness + epsilon
gel_radius + epsilon + tube_thickness + epsilon + water_thickness

etc


Post a reply to this message


Attachments:
Download 'glasstube.pov.txt' (9 KB)

From: Bald Eagle
Subject: Re: Dark Regions and Reflections Removal
Date: 9 Dec 2021 23:10:00
Message: <web.61b2d2e564eaca9f1f9dae3025979125@news.povray.org>
Looks like the placement of the light_source was a major source of your
headaches.

I putzed around with this a bit more, and it's looking much better - hopefully
you can tweak things from here.


Post a reply to this message


Attachments:
Download 'glasstube.png' (55 KB)

Preview of image 'glasstube.png'
glasstube.png


 

From: Bald Eagle
Subject: Re: Dark Regions and Reflections Removal
Date: 9 Dec 2021 23:10:00
Message: <web.61b2d30664eaca9f1f9dae3025979125@news.povray.org>
Scene file.


Post a reply to this message


Attachments:
Download 'glasstube.pov.txt' (10 KB)

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