POV-Ray : Newsgroups : povray.general : Random textures : Re: Random textures Server Time
5 Aug 2024 04:13:05 EDT (-0400)
  Re: Random textures  
From: Tom Melly
Date: 13 Dec 2002 04:32:26
Message: <3df9a92a@news.povray.org>
"Helen" <rem### [at] nospamhotmailcom> wrote in message
news:Xns### [at] 204213191226...
> ingo <ing### [at] tagpovrayorg> wrote in news:Xns### [at] povrayorg:
>
> > in news:Xns### [at] 204213191226 Helen wrote:
> >
>

Here's your main problem - you're defining Rand_Array_Item as a new macro,
over-riding the macro in rand.inc

> #macro Rand_Array_Item(TexArray, RdmA)
>  #end

This macro doesn't do anything, so no texture is applied to your objects.

Comment out those lines and you should get something. Also, I note that you
haven't included functions.inc - aren't you getting an error from that?

Also, your MyPebble macro is a bit redundent afaics - here's a modified (and
working) version of your code:

#include "colors.inc"
#include "arrays.inc"
#include "rand.inc"
#include "functions.inc"

global_settings{  assumed_gamma 1.0}

light_source {  <-100,100,-100>      color rgb 1}


#declare Tex1 =texture{  pigment{Red}}
#declare Tex2 =texture{  pigment{Green}}
#declare Tex3 =texture{  pigment{Blue}}
#declare Tex4 =texture{  pigment{White}}
#declare Tex5 =texture{  pigment{Yellow}}
#declare Tex6 =texture{  pigment{Cyan}}
#declare Tex7 =texture{  pigment{Gold}}


camera {
  location  <0, -4.5, -12>
  look_at   <0, 0, 0>
}

//----Stone Textures array
#declare TexArray = array[7];
#declare TexArray[0] = texture {Tex1};
#declare TexArray[1] = texture {Tex2};
#declare TexArray[2] = texture {Tex3};
#declare TexArray[3] = texture {Tex4};
#declare TexArray[4] = texture {Tex5};
#declare TexArray[5] = texture {Tex6};
#declare TexArray[6] = texture {Tex7};

#declare Sphere = function(x,y,z,Radius) {
    pow(x,2) + pow(y,2) + pow(z,2) - pow(Radius,2)
}


#declare  Size = seed (6);

#declare MyPebble_count = 30;
#declare locations1 = seed(3);
#declare locations2 = seed(5);
#declare locations3 = seed(7);
#declare rotations1 = seed(1);
#declare rotations2 = seed(2);
#declare rotations3 = seed(4);
#declare scales1 = seed(2);

#while (MyPebble_count > 0)
  #declare x_loc = rand(locations1)*6-1;
  #declare z_loc = rand(locations2)*8-0.5;
  #declare y_loc = rand(locations3)*6-1;
  #declare x_rot = rand(rotations1)*90-0;
  #declare z_rot = rand(rotations2)*90-0;
  #declare y_rot = rand(rotations3)*90-0;
  #declare sca1 = rand(scales1)*5-2;
  #declare MySize = rand (Size)*0.1-1.2;

  #declare pebble =
    isosurface {
      function { Sphere(x,y,z,1)- f_noise3d(x,y,z)*MySize}
      max_gradient 2 evaluate 5, 1.2, 0.95
      texture {Rand_Array_Item(TexArray, RdmA)}
      scale 1
    }

  object {
    pebble
    translate <x_loc, y_loc, z_loc>
    rotate <x_rot, y_rot, z_rot>
    scale sca1
  }
  #declare MyPebble_count = MyPebble_count - 1;
#end


// Oh, and your indentation stinks.... ;)


Post a reply to this message

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