POV-Ray : Newsgroups : povray.binaries.images : Triplanar Mapping : Re: Triplanar Mapping Server Time19 Apr 2024 18:51:21 EDT (-0400)
 Re: Triplanar Mapping
 From: Bald Eagle Date: 16 Jan 2024 10:05:00 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.65a69a5f93092b991f9dae3025979125%40news.povray.org",
"dateCreated": "2024-01-16T15:05:00+00:00",
"datePublished": "2024-01-16T15:05:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
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)}
```

Attachments: