Home
- POV-Ray Tutorial
- POV-Ray Examples
Index of Content
- Geometry
- Architecture
- Houses
- Roof
- Tower
- Castle
- Window + Door
- Stairs
- Pyramid
- Columns
- Arch
- Fences
- Furnitur
- Houshold
- Engineering
|
|
A Piece of Cheese
Objects: "box", "sphere", "Rounded Cylinder", "shapes_lo.inc"
Methods: "#declare", "union", "difference", "#while", "#macro"
Model scale: 1 unit = 1.00 meter
|
First we arange some spheres in a rectangular grid:
#declare Cheese_R_ = 0.30; // width in x
#declare Cheese_H_ = 0.14; // width in y
#local Max_D = Cheese_H_/4; // distance
#local Max_Num_X = int(Cheese_R_/Max_D)-0.5;
#local Max_Num_Y = max(1,int(Cheese_H_/Max_D)-0.5);
//-------------------------------------------------
#local NrX = 0.75; // outer loop x
#while (NrX < Max_Num_X)
#local NrY = 0.5; // inner loop y
#while (NrY < Max_Num_Y)
sphere{ <0,0,0>,Max_D/2
translate<(NrX+0.5),(NrY+0.5),0>*Max_D
pigment{color rgb<1,0.7,0.3>} finish{phong 1}
} // ------- end sphere
#local NrY = NrY + 1; // next Nr y
#end // --------------- end of inner loop y
// end inner loop
#declare NrX = NrX + 1; // next Nr x
#end // --------------- end of outer loop x |
Than we add some random in scale and position.
We add before the loop
#declare Rnd_ = seed( 18926 ); |
and replace the sphere by this:
sphere{ <0,0,0>,Max_D/2
scale<1+0.5*(rand(Rnd_)),
1-0.5*(rand(Rnd_)),
1+0.5*(0.5-rand(Rnd_))>
translate<(NrX+0.5)+0.85*(0.5-rand(Rnd_)),
(NrY+0.5)+0.85*(0.5-rand(Rnd_)),
0.15*(0.5-rand(Rnd_))> * Max_D
pigment{ color rgb<1,0.7,0.3>}
} // ------- end sphere
|
Now we cut a piece of cheese using
the macro Round_Cylinder and my macro Segment_of_Object(Object,Angle) :
For download see "Step 2" here shapes_lo.inc.
#include "shapes_lo.inc"
#declare Cheese_R_ = 0.30; // radius
#declare Cheese_H_ = 0.15; // height
#declare Cheese_Border_R_ = 0.05;
#declare Cut_Angle_ = 30; // degrees
//------------------------------------
#declare Cheese_Shape_ =
object{ Round_Cylinder(
<0,0,0>,<0,Cheese_H_,0>,
Cheese_R_ , Cheese_Border_R_, 0) }
object{ Segment_of_Object(Cheese_Shape_,Cut_Angle_)
texture{ Cheese_Texture }
} // ----------------------------------------
|
Now all we have to do is to subtrakt the holes
from the front and backside of this cheese shape!
(See the scene file for the details!)
|
Regular grid
Regular grid with added random scale and translate
A cut of cheese.
A cut of cheese with holes.
Click here for the scene file for POV-Ray:
".txt" file or
".pov" file
|
Ready-made POV-Ray objects as
include files and example files you'll find
at the POV-Ray Objects Page
|