|  |  | Hello Forum,
I recently posted about about trying to simulate bubbles in a tube and received
a lot of great feedback on my scripting approach!  I've made changes to my
previous setup to clean it up, but have two outstanding questions/issues.  The
first is on the area_light function, and the second is an issue that I am having
when rendering my new script.
1) Area_light:
In my last discussion, I received some great feedback on the area_light
function, but I am still having some issues with it in concept.  In my script, I
want to create a diffuse backlight for my scene.  I am trying to recreate the
effect of having a bright light shining through transparent objects directly
into my camera.  to do this, I am beginning by defining an area_light with the
following characteristics:
     - parallel to the X-Y-plane
     - centred on the Z-axis
     - with dimensions 160x200 (x,y)
     - I then want the center translated to position <0,0,100>
     - 100 x 100 lights array
     - white light
     Firstly, can somebody confirm that I have defined this correctly, below?
     light_source {
         <0, 0,100>
         color White
         area_light <-80, -100, 0>, <80, 100, 0>, 100, 100
         adaptive 1
         jitter
       }
Next, if I understand this correctly, I would not actually see my light source
shining like I would in real life, and instead need to create an object onto
which I put the area source if I want that realistic studio light panel look.
To do this, I have used the looks_like function, defining a white rectangular
box that will act as my light panel.  Can somebody confirm that this has been
implemented correctly?
     #declare light_box = box{ <-80,-100,0>, <80,100,2>
               pigment{color White}
            } //end light box
     light_source {
         <0, 0,100>
         color White
         area_light <-80, -100, 0>, <80, 100, 0>, 100, 100
         adaptive 1
         jitter
         looks_like { light_box }
       }
     Is what I'm trying to do make sense to create this diffuse, bright,
backlighting effect?
     If my area_light dimensions do not match the dimensions my defined
looks_like{} object, will the area light stretch to accommodate the defined
object?
2). Rendering Issue and the appearance of dark regions after animation
rendering:
My next question pertains to a rendering issue I have run into.  I reformatted
my previous script with the generous input of forum users.  Here I have defined
each region of my setup in a more efficient manner that I was perviously.  In my
attached file, I am simulating air bubbles trapped in a gel housed within a
glass tube.  Outside of this tube is a cylinder of water and then a cylinder of
plexiglass.
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, and I cannot recreate the original bright region.  I also
tried turning off the fade and this did not help.
Can anyone help me troubleshoot this issue?
Thank you all for your support and insights!
Sincerely,
Bubble_person
* I have attached my code here, below, because I cannot figure out how to add a
photo and my script.  Sorry for the long post!
//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   = 90;
#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 <-80, -100, 0>, <80, 100, 0>, 100, 100
    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.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
  } // 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.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
} // 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.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
} // 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'
  
 |  |