POV-Ray : Newsgroups : povray.text.tutorials : no-repeat in mosaic Server Time
21 Nov 2024 08:11:07 EST (-0500)
  no-repeat in mosaic (Message 1 to 1 of 1)  
From: Wlodzimierz ABX Skiba
Subject: no-repeat in mosaic
Date: 22 Mar 2001 04:55:50
Message: <3ab9cc26@news.povray.org>
here is my macro and whole sample scene
images just sended to p.b.images

Patterns is array of textures to mix and Patterns[0] is texture of mortar
Length and Width is size of ceil without Mortar

// START ****************************
#version unofficial megapov 0.7;

#include "colors.inc"
#include "woods.inc"

#version unofficial megapov 0.7;

camera
 {
  location  <-4.0, 2, -4.0>
  direction 1.5*z
  right     4/3*x
  look_at   <0.0, 0.0,  0.0>
 }

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

#macro Mosaic(Patterns,Mortar,Length,Width)
  #if(dimensions(Patterns)!=1)
    #warning "list of patterns should be one-dimensional\n"
    #error ""
  #end
  #local Size=dimension_size(Patterns,1);
  #local counter=0;
  #local Finish=no;
  #while(!Finish)
    #if(counter>=Size)
      #local Finish=yes;
    #else
      #if(!defined(Patterns[counter]))
        #local Finish=yes;
      #else
        #local counter=counter+1;
      #end
    #end
  #end
  #if(counter<2)
    #warning "list of patterns should contains more than two patterns\n"
    #error ""
  #end
  #local Size=counter;
  #local
MosaicNoise=function{((Size-1)*noise3d(floor(x),0,floor(z))/Size)+(1/Size)}
  #local
MosaicMortarZ=function{if((z-floor(z))-(Width/(Width+Mortar)),0,MosaicNoise(x,0,
z))}
  #local
MosaicMortarX=function{if((x-floor(x))-(Length/(Length+Mortar)),0,MosaicMortarZ(
x,0,z))}
  #local MosaicOffset=function{MosaicMortarX(x+(floor(z)/2),0,z)}
  #local
MosaicRescale=function{MosaicOffset(x/(Length+Mortar),0,z/(Width+Mortar))}
  texture{
    function{MosaicRescale(x,0,z)}
    texture_map{
      #local counter=0;
      #while(counter<(Size-.5))
        [(counter/Size) Patterns[counter]]
        [((counter+1)/Size) Patterns[counter]]
        #local counter=counter+1;
      #end
    }
  }
#end

#declare List=array[1000]
#declare L=0;
#macro Add(T)
  #declare List[L]=T
  #declare L=L+1;
#end

Add(texture{pigment{color rgb 0}})
#declare counter=0;
#while (counter<31)
  Add(texture{T_Wood1 rotate y*90 translate <1,2,3>*counter scale.2})
  Add(texture{T_Wood10 rotate y*90 translate <4,5,6>*counter scale.2})
  Add(texture{T_Wood11 rotate y*90 translate <7,8,9>*counter scale.2})
  Add(texture{T_Wood13 rotate y*90 translate <1,4,7>*counter scale.2})
  #declare counter=counter+1;
#end

plane{y,-1 Mosaic(List,0.005,4.7,0.075)}

#version unofficial megapov 0.7;

// END ******************************


Post a reply to this message

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