|
|
"Samuel B." <stb### [at] hotmailcom> wrote:
> it would appear that if you wish to rotate your objects you have to put up with
some issues.
There will always be some stretching, since not all objects will be boxes or
superellipsoids aligned to one sole direction. You have to do your
transformations before applying the triplanar mapping.
Here's the code used to make the attached image:
/*
triplanar-debugB.pov
2024 stb
+fn +f +w960 +h540
*/
#version 3.7;
global_settings{
assumed_gamma 1.0
#if(1)
radiosity{
count 1
error_bound .05
recursion_limit 1
nearest_count 10
normal on
}
#end
}
camera{
orthographic
right x*1.77 up y
location <0, 5, -10>
look_at 0
angle 33
aperture .28 focal_point 0 blur_samples 10 variance 0
}
// sunlight
#if(true)
light_source{
<1, .5, 0>*1e5, srgb <1.5, 1.25, 1>
#if(1)
#declare ALRes = 2;
#declare ALSize = .1*1e5;
area_light x*ALSize, z*ALSize, ALRes, ALRes
jitter
adaptive 1
//area_illumination
#end
}
#end
// background
#if(true)
background{rgb <.3, .5, .7>}
#end
// input image for triplanar color and normal
#declare PImg =
pigment{
image_map{
png "craters.png"
interpolate 2
}
scale 2
}
#macro Triplanar(Pigment, Sharpness)
pigment_pattern{
slope x
triangle_wave
}
pigment_map{
[0+.5*Sharpness Pigment rotate y*90]
[1-.5*Sharpness
pigment_pattern{
slope y
triangle_wave
}
pigment_map{
[0+.5*Sharpness Pigment rotate x*90]
[1-.5*Sharpness Pigment rotate z*165]
}
]
}
#end
// random objects
union{
plane{y, 0}
#local Seed = seed(1002);
#for(I, 0, 20)
superellipsoid{
<.2, .2>
scale .2+.8*rand(Seed)
rotate 360*<rand(Seed), rand(Seed), rand(Seed)>
translate 12*(<.5-rand(Seed), 0, .5-rand(Seed)>)
}
torus{
.5, .2
scale .2+.8*rand(Seed)
rotate 360*<rand(Seed), rand(Seed), rand(Seed)>
translate 12*(<.5-rand(Seed), 0, .5-rand(Seed)>)
}
sphere{
12*(<.5-rand(Seed), 0, .5-rand(Seed)>), .2+.8*rand(Seed)
}
cone{
0, .5, y, 0
scale .2+.8*rand(Seed)
translate 12*(<.5-rand(Seed), 0, .5-rand(Seed)>)
}
#end
// triplanar mapping after all transformations
texture{
pigment{
pigment_pattern{Triplanar(PImg, .75)}
color_map{
[0 rgb <.05, .1, .15>]
[1 rgb <.9, .85, .8>]
}
}
normal{
pigment_pattern{Triplanar(PImg, .75)}
bump_size 1
accuracy .01
}
}
}
Post a reply to this message
Attachments:
Download 'triplanar-debugb2m_17s.jpg' (123 KB)
Preview of image 'triplanar-debugb2m_17s.jpg'
|
|