Beschreibungen und Beispiele zum Raytracer POV-Ray von Friedrich A. Lohmüller
    POV-Ray Beispiele - Die Erstellung von Objekten für POV-Ray
English English English
Italiano Italiano
Français français

Home
- POV-Ray Tutorial

  - POV-Ray Beispiele
    Inhaltsübersicht
  - Geometrie
  - Architektur
    - Haus
    - Dach
    - Turm mit Zinnen
    - Schloss
    - Fenster u. Tür
    - Treppen
    - Pyramide
    - Säulen
    - Bogen
    - Zäune
    - Möbel
    - Haushalt
  - Technik
                                       
 
table

Ein Stück Käse

Objekte: "box", "sphere", "Rounded Cylinder", "shapes_lo.inc"
Methoden: "#declare", "union", "difference", "#while", "#macro"
Modell Maßstab: 1 Einheit = 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!)

regulare grid
regular grid
regulare grid
Regular grid
with added random scale and translate
cut of cheese
A cut of cheese.
cut of cheese
A cut of cheese with holes.
Click here for the scene file for POV-Ray:
".txt" file or ".pov" file
Gebrauchsferige POV-Ray Objekte als
Include-Dateien mit Beispieldateien findet man
auf der POV-Ray-Objects-Seite.
top

© Friedrich A. Lohmüller, 2009
www.f-lohmueller.de