POV-Ray : Newsgroups : povray.binaries.images : film, spline triangle test (213 kb) : film, spline triangle test (213 kb) Server Time
9 Aug 2024 03:23:57 EDT (-0400)
  film, spline triangle test (213 kb)  
From: Jaap
Date: 18 Mar 2005 18:40:01
Message: <web.423b66404b8d670ea8399d8d0@news.povray.org>
testing a macro to subdivide triangles along two splines, with UV mapping.
(no smooth triangles where used)

jaap.
---------------------------------------------------------
#declare splineBot = spline {
  cubic_spline
 -1, <  60, -20,0>
  0, <  40, -70,0>
  1, <   0,-110,0>
  2, < -60, -90,0>
  3, <-100, -40,0>
  4, <-110,  30,0>
  5, < -60, 100,0>
  6, <  10,  70,0>
  7, <  20,  30,0>
}
#declare splineTop = spline {
  cubic_spline
 -1, <  60, -20,30>
  0, <  40, -70,30>
  1, <   0,-110,30>
  2, < -60, -90,30>
  3, <-100, -40,30>
  4, <-110,  30,30>
  5, < -60, 100,30>
  6, <  10,  70,30>
  7, <  20,  30,30>
}
//   -0-------1-------2-------3-------4-------5-------6- =splineTop
// V   1 1---2 1 1---2 1 1---2 1 1---2 1 1---2 1 1---2
// ^   |\ \ B| |\ \ B| |\ \ B| |\ \ B| |\ \ B| |\ \ B|
// |   | \ \ | | \ \ | | \ \ | | \ \ | | \ \ | | \ \ |
// |   |A \ \| |A \ \| |A \ \| |A \ \| |A \ \| |A \ \|
// |   2---3 3 2---3 3 2---3 3 2---3 3 2---3 3 2---3 3
//   -0-------1-------2-------3-------4-------5-------6- =splineBot
//
// 0   ------> U
#declare frames= 6;   // number of frames
#declare parts = 1;  // parts per frame (1..10 1=no sub devision)

mesh{
  #local frameNr = 0.0;
  #while(frameNr < frames)
    #local part = 0.0;
    #while(part < parts)
      #local partStart = part/parts;
      #local partEnd   = partStart+(1/parts);
      triangle { // A:
        splineTop(frameNr+partStart),
        splineBot(frameNr+partStart),
        splineBot(frameNr+partEnd  )
        uv_vectors <partStart,1>, <partStart,0>, <partEnd,0>
      }
      triangle { // B:
        splineTop(frameNr+partStart),
        splineTop(frameNr+partEnd  ),
        splineBot(frameNr+partEnd  )
        uv_vectors <partStart,1>, <partEnd  ,1>, <partEnd,0>
      }
      #local part = part + 1.0;
    #end
    #local frameNr = frameNr + 1.0;
  #end
  texture {
    uv_mapping
    pigment { image_map { png "frame.png" interpolate 2 filter all 1.0 } }
    finish {
      diffuse    0.8
      reflection 0.2
    }
  }
}


Post a reply to this message


Attachments:
Download 'film.jpg' (213 KB)

Preview of image 'film.jpg'
film.jpg


 

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