POV-Ray : Newsgroups : povray.binaries.scene-files : Cristal.inc : cristals (as in LiquidGlass) Server Time
2 Sep 2024 04:18:17 EDT (-0400)
  Cristal.inc : cristals (as in LiquidGlass) (Message 1 to 7 of 7)  
From: Steven Pigeon
Subject: Cristal.inc : cristals (as in LiquidGlass)
Date: 13 Jun 2002 11:48:36
Message: <3d08bed4$1@news.povray.org>
Ok

min_sides: the minimum number of sides your cristal will have
max_sides: the maximum;
diam: the edges are on a circle of diameter diam
height: the heigth of the crown
var: the variance of the points
top: the absolute topmost points
rand_seed... welll

ex:

mesh_cristal(4,7, 1, 3, 0.1, 4, s)

produces a cristal of 4 to 7 faces, contained in a cylinder of diameter 1,
that have its pointy end starting at 3 +- 0.1, and culminates at 4.


Same with the two-ended version

best,

    S.



#macro mesh_cristal(min_sides,max_sides,diam, height,var,top,rand_seed)
 #local nb_sides = min_sides+floor (0.5 +
(max_sides-min_sides)*rand(rand_seed) );
 #declare angles = array [ nb_sides ]; // angles
 #declare bases  = array [ nb_sides ];
 #declare mi_hauteurs = array [ nb_sides ];
 #declare sommets = array [ nb_sides] ;

 // some random values
 #local i=0;
 #while (i<nb_sides)
  #declare angles[i]=rand(rand_seed) * 360;
  #declare i=i+1;
 #end


 // sort them
 #local i=0;
 #while (i < nb_sides - 1 )
  #local j=i+1;
  #while (j < nb_sides )
   #if (angles[i]>angles[j])
    #local temp = angles[i];
    #declare angles[i]=angles[j];
    #declare angles[j]=temp;
   #end //if

   #declare j=j+1;
  #end // while (j

  #declare i=i+1;
 #end // while (i


 #local i=0;
 #while (i<nb_sides)

  #declare bases[i] = vrotate( < 0,0,diam>, <0,angles[i],0 >);
  #declare mi_hauteurs[i]=bases[i]+<0,height+rand(rand_seed)*var,0>;

  #declare i=i+1;
 #end

 mesh
  {
   #local i=0;
   #while (i<nb_sides)
    triangle { bases[i],mi_hauteurs[i],mi_hauteurs[mod(i+1,nb_sides)] }
    triangle { bases[i],bases[mod(i+1,nb_sides)],
mi_hauteurs[mod(i+1,nb_sides)] }
    #declare i=i+1;
   #end

   #declare sommets = bases ;
   #local random_vect = vrotate(<0,0,10>,rand(rand_seed)*360); // some
vector in the x-z plane
   #local random_angle = rand(rand_seed)*15;

   #local i=0;
   #while (i<nb_sides)
    #declare sommets[i]=vaxis_rotate(sommets[i]/2,random_vect,random_angle)
+ <0,top,0>;
    #declare i=i+1;
   #end

   #local i=0;
   #while (i<nb_sides)
    triangle { sommets[i],mi_hauteurs[i],mi_hauteurs[mod(i+1,nb_sides)] }
    triangle { sommets[i],sommets[mod(i+1,nb_sides)],
mi_hauteurs[mod(i+1,nb_sides)] }
    #declare i=i+1;
   #end

   #local i=0;
   #while (i<nb_sides)
    triangle { bases[0],bases[i],bases[mod(i+1,nb_sides)] }
    triangle { sommets[0],sommets[i],sommets[mod(i+1,nb_sides)] }
    #declare i=i+1;
   #end


  } // mesh
#end // macro


//////////////////////////////////////////////////////////////

#macro two_ended_mesh_cristal(min_sides,max_sides,diam,
height,var,top,rand_seed)
 #local nb_sides = min_sides+floor (0.5 +
(max_sides-min_sides)*rand(rand_seed) );
 #declare angles = array [ nb_sides ]; // angles
 #declare bases  = array [ nb_sides ];
 #declare mi_hauteurs = array [ nb_sides ];
 #declare mi_profondeurs = array[ nb_sides ];
 #declare sommets = array [ nb_sides ] ;
 #declare fonds   = array [ nb_sides ];

 // some random values
 #local i=0;
 #while (i<nb_sides)
  #declare angles[i]=rand(rand_seed) * 360;
  #declare i=i+1;
 #end


 // sort them
 #local i=0;
 #while (i < nb_sides - 1 )
  #local j=i+1;
  #while (j < nb_sides )
   #if (angles[i]>angles[j])
    #local temp = angles[i];
    #declare angles[i]=angles[j];
    #declare angles[j]=temp;
   #end //if

   #declare j=j+1;
  #end // while (j

  #declare i=i+1;
 #end // while (i


 #local i=0;
 #while (i<nb_sides)

  #declare bases[i] = vrotate( < 0,0,diam>, <0,angles[i],0 >);
  #declare mi_hauteurs[i]=bases[i]+<0,height+rand(rand_seed)*var,0>;
  #declare mi_profondeurs[i]=bases[i]-<0,height+rand(rand_seed)*var,0>;

  #declare i=i+1;
 #end

 mesh
  {
   #local i=0;
   #while (i<nb_sides)
    triangle {
mi_profondeurs[i],mi_hauteurs[i],mi_hauteurs[mod(i+1,nb_sides)] }
    triangle { mi_profondeurs[i],mi_profondeurs[mod(i+1,nb_sides)],
mi_hauteurs[mod(i+1,nb_sides)] }
    #declare i=i+1;
   #end

   // sommets

   #declare sommets = bases ;
   #local random_vect = vrotate(<0,0,10>,rand(rand_seed)*360); // some
vector in the x-z plane
   #local random_angle = rand(rand_seed)*15;

   #local i=0;
   #while (i<nb_sides)
    #declare sommets[i]=vaxis_rotate(sommets[i]/2,random_vect,random_angle)
+ <0,top,0>;
    #declare i=i+1;
   #end

   #local i=0;
   #while (i<nb_sides)
    triangle { sommets[i],mi_hauteurs[i],mi_hauteurs[mod(i+1,nb_sides)] }
    triangle { sommets[i],sommets[mod(i+1,nb_sides)],
mi_hauteurs[mod(i+1,nb_sides)] }
    #local i=i+1;
   #end

   #local i=0;
   #while (i<nb_sides)
    triangle { sommets[0],sommets[i],sommets[mod(i+1,nb_sides)] }
    #local i=i+1;
   #end

   // fonds

   #declare fonds = bases ;
   #local random_vect = vrotate(<0,0,10>,rand(rand_seed)*360); // some
vector in the x-z plane
   #local random_angle = rand(rand_seed)*15;

   #local i=0;
   #while (i<nb_sides)
    #declare fonds[i]=vaxis_rotate(fonds[i]/2,random_vect,random_angle) -
<0,top,0>;
    #local i=i+1;
   #end

   #local i=0;
   #while (i<nb_sides)
    triangle {
fonds[i],mi_profondeurs[i],mi_profondeurs[mod(i+1,nb_sides)] }
    triangle { fonds[i],mi_profondeurs[mod(i+1,nb_sides)],
fonds[mod(i+1,nb_sides)] }
    #local i=i+1;
   #end

   #local i=0;
   #while (i<nb_sides)
    triangle { fonds[0],fonds[i],fonds[mod(i+1,nb_sides)] }
    #local i=i+1;
   #end


  } // mesh
#end // macro


Post a reply to this message

From: Timothy R  Cook
Subject: Re: Cristal.inc : cristals (as in LiquidGlass)
Date: 13 Jun 2002 13:35:05
Message: <3D08D7C2.2020902@bellsouth.net>
...

That seems a little complex for li'l ol' me...I was hoping for a CSG
^_^;

-- 
Tim Cook
http://empyrean.scifi-fantasy.com
mirror: http://personal.lig.bellsouth.net/lig/z/9/z993126

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GFA dpu- s: a?-- C++(++++) U P? L E--- W++(+++)>$
N++ o? K- w(+) O? M-(--) V? PS+(+++) PE(--) Y(--)
PGP-(--) t* 5++>+++++ X+ R* tv+ b++(+++) DI
D++(---) G(++) e*>++ h+ !r--- !y--
------END GEEK CODE BLOCK------


Post a reply to this message

From: Steven Pigeon
Subject: Re: Cristal.inc : cristals (as in LiquidGlass)
Date: 13 Jun 2002 15:00:34
Message: <3d08ebd2@news.povray.org>
"Timothy R. Cook" <z99### [at] bellsouthnet> wrote in message
news:3D0### [at] bellsouthnet...
> ...
>
> That seems a little complex for li'l ol' me...I was hoping for a CSG

ah ah ah

well... uh.... you can toy with it anyway :)

I used to have a csg-based version but it ate up lots of
memory and was much slower than this mesh-based
version. In another scence, there are like, say, 100 000
cristals... every K you save starts to be important :)

Best,

    S.

> ^_^;
>
> --
> Tim Cook
> http://empyrean.scifi-fantasy.com
> mirror: http://personal.lig.bellsouth.net/lig/z/9/z993126
>
> -----BEGIN GEEK CODE BLOCK-----
> Version: 3.12
> GFA dpu- s: a?-- C++(++++) U P? L E--- W++(+++)>$
> N++ o? K- w(+) O? M-(--) V? PS+(+++) PE(--) Y(--)
> PGP-(--) t* 5++>+++++ X+ R* tv+ b++(+++) DI
> D++(---) G(++) e*>++ h+ !r--- !y--
> ------END GEEK CODE BLOCK------
>


Post a reply to this message

From: Dennis Miller
Subject: Re: Cristal.inc : cristals (as in LiquidGlass)
Date: 13 Jun 2002 18:30:06
Message: <3d091cee$1@news.povray.org>
Could you post a sample .pov file?
thanks,
.d

"Steven Pigeon" <pig### [at] iroumontrealca> wrote in message
news:3d08ebd2@news.povray.org...
>
> "Timothy R. Cook" <z99### [at] bellsouthnet> wrote in message
> news:3D0### [at] bellsouthnet...
> > ...
> >
> > That seems a little complex for li'l ol' me...I was hoping for a CSG
>
> ah ah ah
>
> well... uh.... you can toy with it anyway :)
>
> I used to have a csg-based version but it ate up lots of
> memory and was much slower than this mesh-based
> version. In another scence, there are like, say, 100 000
> cristals... every K you save starts to be important :)
>
> Best,
>
>     S.
>
> > ^_^;
> >
> > --
> > Tim Cook
> > http://empyrean.scifi-fantasy.com
> > mirror: http://personal.lig.bellsouth.net/lig/z/9/z993126
> >
> > -----BEGIN GEEK CODE BLOCK-----
> > Version: 3.12
> > GFA dpu- s: a?-- C++(++++) U P? L E--- W++(+++)>$
> > N++ o? K- w(+) O? M-(--) V? PS+(+++) PE(--) Y(--)
> > PGP-(--) t* 5++>+++++ X+ R* tv+ b++(+++) DI
> > D++(---) G(++) e*>++ h+ !r--- !y--
> > ------END GEEK CODE BLOCK------
> >
>
>


Post a reply to this message

From: Steven Pigeon
Subject: Re: Cristal.inc : cristals (as in LiquidGlass)
Date: 17 Jun 2002 13:41:07
Message: <3d0e1f33@news.povray.org>
"Dennis Miller" <dhm### [at] attbicom> wrote in message
news:3d091cee$1@news.povray.org...
> Could you post a sample .pov file?

Nope. Absolutely not.



But of course!!!


----------------------------------------------------------------------------
-

#include "Colors.inc"
#include "Glass.inc"


#include "cristals.inc"

#declare PHOTONS=1;


global_settings
 {

  ambient_light 0.1

  assumed_gamma 1
  /*
  radiosity
   {
    recursion_limit 3

    pretrace_start 0.08
    pretrace_end   0.01
    count 350

    nearest_count 5
    error_bound 0.2


    low_error_factor .5
    gray_threshold 0.0
    minimum_reuse 1/1024 // 0.015
    brightness 1

    adc_bailout 0.01/2
   }
  */

  photons
   {
    #if (PHOTONS=1)
     max_trace_level 5
    #else
     max_trace_level 0
    #end

    count 2000000
    spacing 0.005
    gather 40,50

    autostop 0
    jitter 0
   }

 }

//////////////////////////////////////////////////////////////

camera
 {
  location <5,15,-10>      // <5,15,-10>
  look_at <0,5,0>
 }

#if (PHOTONS=0)
 light_source { <10,10,10> color White }
#end

light_source
 {
  <0,5,0> color White*5

  //fade_power 2
  //fade_distance 4

  #if (PHOTONS=1)
   photons
    {
     refraction on
     reflection on
    }
  #end
 }

/*
light_source
 {
  <10,10,10>
  color White
  spotlight
  point_at <0,7,0>
  radius 2
  falloff 3


  #if (PHOTONS=1)
   photons
    {
     refraction on
     reflection on
    }
  #end
 }
*/

plane { y, 0 pigment { rgb <0.5,0.5,1.0> } finish { reflection 0.1 } photons
{ collect on } }

//////////////////////////////////////////////////////////////

#macro CRISTAL()

  texture { pigment { color rgbf<0.7, 0.7, 1, 0.8> } } // slightly bluish


  interior
   {
    ior 2.5

    dispersion 1.10
    dispersion_samples 20
   }

  finish
   {
    ambient 0
    diffuse 0
    reflection 0.25
    phong 0.3
    phong_size 60
   }

  #if (PHOTONS=1)
   photons
    {
     target
     reflection on
     refraction on
     collect on

    }
  #end


#end // macro CRISTAL


//////////////////////////////////////////////////////////////

#declare rand_seed = seed(1);

//////////////////////////////////////////////////////////////


#declare ECHELLE = 40;

blob
 {
  #local i=0;
  #while (i<200)
   #local _x = (rand(rand_seed)-rand(rand_seed))*ECHELLE;
   #local _z = (rand(rand_seed)-rand(rand_seed))*ECHELLE;
   #local _y = log( _x * _x + _z * _z );
   #local _d = 1 + sqrt( _x * _x + _z * _z )/5.5;

   //component _d, _d, <_x,_y,_z>
   sphere { <_x,_y,_z> , _d, _d }


   #local i=i+1;
  #end

  threshold 0.5


  //pigment { Yellow }
  //texture { T_Glass2 }
  CRISTAL()

  normal { wrinkles }
  normal { ripples scale 0.5 }
 }



 //////////////////////////////////////////////////////////////

object
 {
  two_ended_mesh_cristal(5,5,1, 2,1,4,seed(2))

  translate <0, 5, 0>


  //texture { pigment { Green }  }


  CRISTAL()
 }


Post a reply to this message

From: Philippe Lhoste
Subject: Re: Cristal.inc : cristals (as in LiquidGlass)
Date: 30 Jul 2002 07:56:59
Message: <3d467f0b@news.povray.org>
"Steven Pigeon" <pig### [at] iroumontrealca> wrote:
>
> "Dennis Miller" <dhm### [at] attbicom> wrote in message
> news:3d091cee$1@news.povray.org...
> > Could you post a sample .pov file?
>
> Nope. Absolutely not.
>
>
>
> But of course!!!

Thank you, I render it now, but it is verrry slow :-) Even with PHOTONS=0.
BTW, on this side of the pond, in English we write crystals, in French we
write cristaux...

Regards.

-- #=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=# --
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/


Post a reply to this message

From: Steven Pigeon
Subject: Re: Cristal.inc : cristals (as in LiquidGlass)
Date: 12 Aug 2002 16:57:28
Message: <3d582138$1@news.povray.org>
"Philippe Lhoste" <Phi### [at] GMXnet> wrote in message
news:3d467f0b@news.povray.org...
> "Steven Pigeon" <pig### [at] iroumontrealca> wrote:
> >
> > "Dennis Miller" <dhm### [at] attbicom> wrote in message
> > news:3d091cee$1@news.povray.org...
> > > Could you post a sample .pov file?
> >
> > Nope. Absolutely not.
> >
> >
> >
> > But of course!!!
>
> Thank you, I render it now, but it is verrry slow :-) Even with PHOTONS=0.

The glass texture is very slow as soon as you specify refraction /
diffraction.
Something to optimize in new versions of pov ?

> BTW, on this side of the pond, in English we write crystals, in French we
> write cristaux...





    S.

>
> Regards.
>
> -- #=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=# --
> Philippe Lhoste (Paris -- France)
> Professional programmer and amateur artist
> http://jove.prohosting.com/~philho/
>
>


Post a reply to this message

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