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'
|