POV-Ray : Newsgroups : povray.general : macro or include file to make rocks ?? Server Time
27 Nov 2024 20:29:50 EST (-0500)
  macro or include file to make rocks ?? (Message 1 to 7 of 7)  
From: john
Subject: macro or include file to make rocks ??
Date: 25 Jan 2008 16:27:23
Message: <npkkp3dpc44s62h9vcus2kntsel6fs2epb@4ax.com>
I want to make a base for a sculpture.  

I want to have a stone with the top surface polished and the sides
very rough as if they had just been excavated from a quarry.

Does anyone know of a macro or include file that can generate
something like this.  Ideally I would like to be able to define the
dimensions and also the roughness of the vertical surfaces while
leaving the top flat and polished.

John


Post a reply to this message

From: John VanSickle
Subject: Re: macro or include file to make rocks ??
Date: 25 Jan 2008 18:02:33
Message: <479a6a89$1@news.povray.org>
john wrote:
> I want to make a base for a sculpture.  
> 
> I want to have a stone with the top surface polished and the sides
> very rough as if they had just been excavated from a quarry.
> 
> Does anyone know of a macro or include file that can generate
> something like this.  Ideally I would like to be able to define the
> dimensions and also the roughness of the vertical surfaces while
> leaving the top flat and polished.

You could use a height field, based on a pigment pattern, adjusted so 
that the middle is fully white (for a smooth flat surface), and the 
edges have noise and gradually go to black away from the center.

Or you could use my rock maker from here:

http://www.geocities.com/evilsnack/inc.htm

and either CSG it to have a flat surface or modify the mesh so that 
points lying in a certain direction are given an upper bound, which will 
also form a flat surface.

Regards,
John


Post a reply to this message

From: Trevor G Quayle
Subject: Re: macro or include file to make rocks ??
Date: 25 Jan 2008 18:05:01
Message: <web.479a6af824083e7c2ae8612c0@news.povray.org>
john <joh### [at] worldcom> wrote:
> I want to make a base for a sculpture.
>
> I want to have a stone with the top surface polished and the sides
> very rough as if they had just been excavated from a quarry.
>
> Does anyone know of a macro or include file that can generate
> something like this.  Ideally I would like to be able to define the
> dimensions and also the roughness of the vertical surfaces while
> leaving the top flat and polished.
>
> John

Try intersecting 4 heightfields (for the sides) with a box (for the top and
bottom).  You can apply whatever pattern/scale to the heightfields to get the
look you want.  I have a macro I made up somewhere that does just this with all
six sides that could be modified easily.  I'll see if I can dig it up.  It
shouldn't be too difficult to figure out on your own if you know how to use
heightfields with internal patterns or functions.

-tgq


Post a reply to this message

From: Mike Williams
Subject: Re: macro or include file to make rocks ??
Date: 25 Jan 2008 18:37:07
Message: <BWg7HEKeDnmHFwGe@econym.demon.co.uk>
Wasn't it john who wrote:
>I want to make a base for a sculpture.
>
>I want to have a stone with the top surface polished and the sides
>very rough as if they had just been excavated from a quarry.
>
>Does anyone know of a macro or include file that can generate
>something like this.  Ideally I would like to be able to define the
>dimensions and also the roughness of the vertical surfaces while
>leaving the top flat and polished.

Isosurfaces are good for rocks. Perhaps something like this:

#declare F=function{pigment{
  agate
  scale 0.5
  }
}
isosurface {
        function { x*x +z*z -1 + F(x,y,z).grey*0.3 }
        max_gradient 3.2
        contained_by{box {<-1,-0.2,-1>,<1,0.2,1>}}
        pigment {rgb .9}
}


Or this:

#declare F=function{pigment{
  agate
  scale 0.3
  }
}
isosurface {
  function { f_rounded_box(x,y,z,0.2,0.7,0.2,0.7)+F(x,y,z).grey*0.1 }
        max_gradient 10
        contained_by{box {<-1,-0.11,-1>,<1,0.11,1>}}
        pigment {rgb .9}
        finish {phong 0.2 phong_size 10}
}



-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Trevor G Quayle
Subject: Re: macro or include file to make rocks ??
Date: 26 Jan 2008 10:10:01
Message: <web.479b4c4124083e7c2ae8612c0@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> john <joh### [at] worldcom> wrote:
> > I want to make a base for a sculpture.
> >
> > I want to have a stone with the top surface polished and the sides
> > very rough as if they had just been excavated from a quarry.
> >
> > Does anyone know of a macro or include file that can generate
> > something like this.  Ideally I would like to be able to define the
> > dimensions and also the roughness of the vertical surfaces while
> > leaving the top flat and polished.
> >
> > John
>
> Try intersecting 4 heightfields (for the sides) with a box (for the top and
> bottom).  You can apply whatever pattern/scale to the heightfields to get the
> look you want.  I have a macro I made up somewhere that does just this with all
> six sides that could be modified easily.  I'll see if I can dig it up.  It
> shouldn't be too difficult to figure out on your own if you know how to use
> heightfields with internal patterns or functions.
>
> -tgq

Okay, I modified my macro.  Hope it makes sense to you, there are a few
variables.

f_stone is a predeclared function pattern for the rouhg surface.  I combined
three patterns to varying proportions (f_1, f_2, f_3).

CRN1,CRN2: corners of the overall box that the stone is made from.
BScal: scale of the bump pattern, this keeps the bumps the same size when the
size of stone is changed.
Dpth: depth of the bump pattern, as with BScal, independent of stone size.
RES: heightfield resolution (make larger for good renders, smaller for fast
renders
Smth: turn on/off heightfield smoothing (true/false)

Hope this is some use for you.  Let me know if you have any questions about it.

//START
#declare f_1= function{pattern{bumps   scale 0.5}} #declare f1=0.10*1;
#declare f_2= function{pattern{granite scale 1.0}} #declare f2=0.03*1;
#declare f_3= function{pattern{dents   scale 0.1}} #declare f3=0.02*1;

#declare f_stone =function (x,y,z,i,j,k,B,Dpth) {
  1-Dpth*( ((f_1(x*i/B,y*k/B,z)*f1 + f_2(x*i/B,y*k/B,z)*f2 +
f_3(x*i/B,y*k/B,z)*f3)/(f1+f2+f3) -0.5) + 0.5 )/j
}

#declare SBRND=seed(1);

#macro StoneBlock (CRN1,CRN2,BScal,Dpth,RES,Smth)
  #local ZX=RES/(RES-2);
  #macro HF(xx,yy,zz,OS)
    #local HF1=
      height_field{
        function RES,RES {pattern{ function {
          f_stone((2*x-1)*ZX,(2*y-1)*ZX,OS*1000,xx,yy,zz,BScal,Dpth)
        }
       }
      }
      #if (Smth) smooth #end
    }
    object{HF1 translate y*(1-max_extent(HF1).y) translate -1/2 scale
<ZX*xx,yy,ZX*zz>}
  #end
  #local Siz=CRN2-CRN1;
  intersection{
    #local xx=Siz.x;
    #local yy=Siz.y;
    #local zz=Siz.z;
    //object{HF(xx,yy,zz,rand(SBRND)) rotate x*0}  //removed for flat top
    //object{HF(xx,yy,zz,rand(SBRND)) rotate x*180}//removed for flat bottom
    object{HF(xx,zz,yy,rand(SBRND)) rotate x*90}
    object{HF(xx,zz,yy,rand(SBRND)) rotate x*270}
    object{HF(yy,xx,zz,rand(SBRND)) rotate z*90}
    object{HF(yy,xx,zz,rand(SBRND)) rotate -z*90}
    box{<-xx/2,-yy/2,-zz/2><xx/2,yy/2,zz/2>}
    translate Siz/2+CRN1
    bounded_by{box{CRN1,CRN2}}
  }
#end

object{StoneBlock(<-1,-1/2,-1>*30,<1,1/2,1>*30,100,4,100,false) pigment{rgb 1}
translate y*20}
//END


Post a reply to this message

From: Jim Charter
Subject: Re: macro or include file to make rocks ??
Date: 26 Jan 2008 11:43:21
Message: <479b6329@news.povray.org>
john wrote:
> I want to make a base for a sculpture.  
> 
> I want to have a stone with the top surface polished and the sides
> very rough as if they had just been excavated from a quarry.
> 
> Does anyone know of a macro or include file that can generate
> something like this.  Ideally I would like to be able to define the
> dimensions and also the roughness of the vertical surfaces while
> leaving the top flat and polished.
> 
> John
The other responses are probably a better fit for your task but just for 
completeness sake there is also
Bill Pragnell's brick macro:
http://www.infradead.org/~wmp/macro_bricks.html
which might be pressed into use if your stone is supposed to be a 
roughcut block.


Post a reply to this message

From: john
Subject: Re: macro or include file to make rocks ??
Date: 26 Jan 2008 16:37:07
Message: <au9np39oqcal3i9tkqve22ttn42jk7rfl3@4ax.com>
On Fri, 25 Jan 2008 21:27:22 +0000, john <joh### [at] worldcom> wrote:

Thanks very much for all the suggestions.  There should be something
in these that I can use or adapt to do what I want

John


Post a reply to this message

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