|
|
Sven Littkowski <jam### [at] yahoocom> wrote:
>
> If I understand correctly, the side ratio of the image has to be 3.14 x
> 1.0, correct? If I have an image 10,000 pixels high, the width needs to
> be 31,400 pixels.
>
Yes. But you don't need to be 'locked in' to that ratio. Once you understand the
HF_Cylinder behavior better, you can change that. For example, in the code I
posted, I deliberately made the cylinder 1.7-units high (not 1.0) while also
using a 'standard' pi:1-ratio image-- to show how you can get the 'image
function' to still look correct on the heightfield. But if you really want a
taller cylinder than 1.0, the original image_map should be *created* taller as
well-- then you would likewise change the scale somewhere in the HF_Cylinder to
make sure everything looks correct.
By the way, if you want to apply the same image_map as a PIGMENT to your
heightfield, turn on 'UseUVtexture' in the macro. To save on memory and parse
time, pre-#declare the image_map like this...
#declare CYL_PIGMENT =
pigment{
image_map{jpeg "my_image.jpg" once interpolate 2}
};
Then you can use it as your HF function...
#declare Fn_1 =
function{
pigment{
CYL_PIGMENT
//scale <-1,1,1>
//translate <1,0,0>
}
}
..... and also in your texture definition.
An interesting fact: When using the 'once' keyword in the image_map, AND also
applying it as a texture/pigment, the HF_Cylinder only shows up where the
pigment is applied-- any remaining part of the cylinder disappears. It's as if
the other parts of the cylinder have a totally transparent texture on them (even
though the original image has no alpha-channel.)
By the way: In my code example, I wrote this code line...
HF_Cylinder( function{Fn_1(x,y*1.7,z).gray}
If you haven't worked with functions before, what that *really* means is
<x,y/1.7,z>
Multiplication and division are written the *opposite way* in functions (or
'inverse' way) of what you would normally write.
Post a reply to this message
|
|