POV-Ray : Newsgroups : povray.text.scene-files : BlobObject macro Server Time
28 Jul 2024 12:27:39 EDT (-0400)
  BlobObject macro (Message 1 to 1 of 1)  
From: Chris Huff
Subject: BlobObject macro
Date: 19 Mar 2000 18:14:11
Message: <chrishuff_99-F21491.18161219032000@news.povray.org>
#include "colors.inc"
#version unofficial MegaPov 0.4;

global_settings {
    assumed_gamma 1.8
}
background {color White}
sky_sphere {
    pigment {gradient y
        color_map {
            [0 color Blue*0.6]
            [1 color White]
        }
    }
}
// ----------------------------------------
camera {
    location <0, 3.5,-8>
    up y*image_height right x*image_width
    angle 25
    look_at <0, 0.5, 0>
}
// ----------------------------------------
plane {y, 0
    texture {
        pigment {checker color White, color rgb < 0.2, 0, 0.5>}
        finish {
            blinn 1
            metallic
            reflection 0.15
            reflect_metallic
        }
    }
}
#declare Obj =
text {
    ttf "crystal.ttf",// cyrvetic.ttf    timrom.ttf
    "POV-Ray"
    0.2, 0
    align_center
    texture {
        pigment {color rgb < 0.45, 1, 0.3>}
        finish {
            blinn 1
        }
    }
    translate y*0.6
}


#declare rs = seed(4654786);
#macro BlobObject(containerObj, compNum, Thres, Strength, Rad)
// containerObj is the object to hold all of the blob components
// compNum is the number of components
// Thres is the blob threshold
// Strength is the strength for the components
// Rad is the radius of the components
    blob {
        #declare K=0;
        #while(K<compNum)
            #declare Pos = < rand(rs), rand(rs), rand(rs)>*
                        
(max_extent(containerObj)-min_extent(containerObj))+
                        min_extent(containerObj);
            #while(eval_pattern(object {containerObj}, Pos) = 0)
                #declare Pos = < rand(rs), rand(rs), rand(rs)>*
                            
(max_extent(containerObj)-min_extent(containerObj))+
                            min_extent(containerObj);
            #end
            sphere {Pos, Rad strength Strength}
            #declare K=K+1;
        #end
        threshold Thres
    }
#end

object {
    BlobObject(Obj, 10000, 0.75, 0.5, 0.075)
    texture {
        pigment {color rgb < 0.45, 1, 0.3>}
        finish {
            blinn 1
            metallic
            reflection_min 0
            reflection_max 0.25
            reflection_type 1
            reflect_metallic
        }
    }
    interior {ior 1.22}
}
object {
    BlobObject(box{<-2, 0, 0>,<2,0.2,0.4>}, 2000, 0.75, 1, 0.1)
    texture {
        pigment {color rgb < 0.9, 1, 0.3>}
        finish {
            blinn 1
            metallic
            reflection_min 0
            reflection_max 0.25
            reflection_type 1
            reflect_metallic
        }
    }
    interior {ior 1.22}
}
// object {Obj}
// ----------------------------------------

light_source {<-20, 30,-30>*3 color White*0.45}
light_source {< 20, 10,-10>*3 color White*0.1}
light_source {< 0, 10, 30>*3 color White}

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

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