|
![](/i/fill.gif) |
Hi POV-Rayers,
I'm making a figure for my book that demonstrates the distorting effects of a
*vergence* measure of distance, i.e. expressing distance as the vergence angle
between two eyes in a binocular system (things very far away all get "squashed"
to vergence zero, at infinity, which is why the sun, moon, and distant mountains
all appear at the same depth perceptually)
(see http://cns-alumni.bu.edu/~slehar/cartoonepist/cartoonepist1.html )
I define my vergence measure, or actually its inverse function
// Inverse vergence function: Does the inverse of the vergence function.
// This is used to compute the distance x for a given vergence, that is
// used to define the sinusoidal pigment of the cylinder.
#declare invergence = function(x) {
1.0/(2.0*tan((-x + pi)/2))
};
Then I define a color function as a sinusoidal pattern of red and green, that is
squashed by the inverse vergence function
// sinusoidal color pattern for the cylinder
#declare ColorFunc = function (x) {
0.5 * (sin(invergence(x)*2*pi*freq)) + 0.5
}
Finally, I define a cylinder whose surface is painted with a pigment of that
function:
// cylinder painted with squashed sinusoidal pattern
cylinder {
<-3.14159, 0, 0> <3.14159, 0, 0> 0.5 // coords of opposite cap points
pigment {
function { ColorFunc (x) }
color_map { // color map
[0 color red 1] // density 0 maps to red
[1 color green 1] // density 1 maps to green
}
}
rotate y*20
}
The full source code and the picture it makes can be downloaded here:
http://cns-alumni.bu.edu/~slehar/POV-Ray/ResonanceVergence.pov
http://cns-alumni.bu.edu/~slehar/POV-Ray/ResonanceVergence.bmp
*** MY QUESTION ***
Is it possible to apply a nonlinear distortion, like my vergence measure, to the
<x,y,z> space itself so as to distort all objects in the scene? What I'd really
like to do is apply my vergence distortion to some of the pre-defined patterns
already available in POV-Ray, such as checker, wood, brick, hexagon, and apply
the same vergence distortion to them.
// cylinder painted with checker pattern
cylinder {
<-3.14159, 0, 0> <3.14159, 0, 0> 0.5 // coords of opposite cap points
pigment {
checker
}
}
You can't do it with the matrix transformation, because you can't put
<x,y, or z> as elements in the matrix itself...
ERROR >>>
matrix < x*(pi - 2 * atan(1/(2*pi))), 0, 0,
0, y*(pi - 2 * atan(1/(2*pi))), 0,
0, 0, z*(pi - 2 * atan(1/(2*pi))),
0, 0, 0>
rotate y*20
<<< ERROR Float expected but vector or color expression found
How do I apply my vergence distortion to the <x,y,z> space that the pre-defined
patterns like checker work on? Is this even possible?
Many thanks in advance for your kind help,
Steve Lehar
Post a reply to this message
|
![](/i/fill.gif) |