POV-Ray : Newsgroups : povray.binaries.images : Triplanar Mapping : Re: Triplanar Mapping Server Time
5 Nov 2024 15:45:13 EST (-0500)
  Re: Triplanar Mapping  
From: Bald Eagle
Date: 16 Jan 2024 10:05:00
Message: <web.65a69a5f93092b991f9dae3025979125@news.povray.org>
I gave it a go, since I had to visualize the rotations, lest it bother me for
the rest of the day.  I use a helper macro to choose the waveform, and cubic
seemed to work really nicely.  I'd suggest trying it with different images to
see if the smoothness is a result of just using one test image.

Rotating the superellipsoid doesn't seem to have too much effect - the line
artefacts might be more to do with the linear travertine image?

- BW

#declare IM = pigment {image_map { "YourImage.png" interpolate 2}}

#macro WaveType (N)
 #switch (N)
 #case (0)
  ramp_wave
 #break
 #case (1)
  triangle_wave
 #break
 #case (2)
  sine_wave
 #break
 #case (3)
  scallop_wave
 #break
 #case (4)
  cubic_wave
 #break
 #case (5)
  poly_wave 0.5
 #break
 #end
#end

#macro TP (P, N)
pigment {
 average
 pigment_map {
  [ 1.0
   pigment_pattern {
    slope x
    WaveType (N)
   }
   pigment_map {
    // When 100% aligned with x
    [0 IM rotate -y*90]
    // vector can rotate away from x in either the y or z direction
    [ 1.0
     pigment_pattern {
      // arbitrarily choose z axis for primary pattern
      slope z
      WaveType (N)
     }
     pigment_map {
      // 100% aligned with z
      [0 IM ]
      // 100 aligned with y
      [1 IM rotate x*90]
     }
    ]
   }
  ]
  [ 1.0
   pigment_pattern {
    slope y
    WaveType (N)
   }
   pigment_map {
    // When 100% aligned with y
    [0 IM rotate x*90]
    // vector can rotate away from x in either the y or z direction
    [ 1.0
     pigment_pattern {
      // arbitrarily choose z axis for primary pattern
      slope x
      WaveType (N)
     }
     pigment_map {
      // 100% aligned with x
      [0 IM rotate -y*90]
      // 100 aligned with z
      [1 IM]
     }
    ]
   }
  ]
  [ 1.0
   pigment_pattern {
    slope z
    WaveType (N)
   }
   pigment_map {
    // When 100% aligned with z
    [0 IM]
    // vector can rotate away from x in either the y or z direction
    [ 1.0
     pigment_pattern {
      // arbitrarily choose x axis for primary pattern
      slope z
      WaveType (N)
     }
     pigment_map {
      // 100% aligned with x
      [0 IM rotate -y*90]
      // 100 aligned with y
      [1 IM rotate x*90]
     }
    ]
   }
  ]
 }
}
#end

#declare Round = 0.125;
#declare Rounded_Box = superellipsoid { <Round, Round> rotate -y*30}

object {Rounded_Box TP (IM, 3)}


Post a reply to this message


Attachments:
Download 'tpmapping.png' (485 KB)

Preview of image 'tpmapping.png'
tpmapping.png


 

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