POV-Ray : Newsgroups : povray.bugreports : CLipka: Possible BUG Found!!! :-) : Re: CLipka: Possible BUG Found!!! :-) Server Time
19 Apr 2024 07:44:00 EDT (-0400)
  Re: CLipka: Possible BUG Found!!! :-)  
From: Sven Littkowski
Date: 13 Feb 2016 23:01:50
Message: <56bffc2e@news.povray.org>
Kenneth,

using your code, I am able to project the image into the shape of a
cylinder. But I cannot put my green pigment on it, it remains in its
gray colors (like the original image). How to change that?

I have the thread "The Colony Ship" inside the "Images" section here,
and could upload the images there. But here is the code:

-----------------------------------------------------------------

#declare Fn_1 = function
{
 pigment
 {
  image_map { jpeg "Colony Ship I - Heightfield Landscape.jpg" once
interpolate 2 }
// this image needs to be pi-units wide by 1.0 tall, NOT square.

// You can use these two modifiers to 'reverse' the imagery, to see it
// correctly on the INSIDE. HOWEVER, this does not reverse the *depth* of
// the heightfield. The only way to do that (that I know of) is to invert
// the image_map's colors (in Photoshop, for example.)
                //scale <-1,1,1>
                //translate <1,0,0>
 }
}

#declare TheLandscape = object
{
 HF_Cylinder(function { Fn_1(x,y*1.7,z).gray }, // *Needs* the function
'wrapper'
                                             1, // UseUVheight:  0 or 1
// ON-- IMPORTANT
                                             0, // UseUVtexture: 0 or 1
                             <int(100*pi),100>, // Resolution.
                                             1, // Smooth: 0 or 1
                                            "", // FileName, ""=no file,
                                       <0,0,0>, // EndA,
                                     <0,1.7,0>, // EndB-- if this
y-value is different from 1.0,
                                                // change the function's
y-value above to compensate.
                                           0.5, // Radius. Keep this at
.5 for 1:1 reproduction of
                                                // the image_map around
the circumference.
                                            0.3 // Depth
  ) //-------------------------
 scale < 0.58, 0.67, 0.58 >
 rotate < 90.0, 0.0, 0.0 >
 scale < 1500.0, 1500.0, 2500.0 >
}

#declare MyLandscape = union
{
 object { TheLandscape scale < 1.0, 1.0,  1.0 > translate < 0.0, 0.0,
0000.0 > }
 object { TheLandscape scale < 1.0, 1.0, -1.0 > translate < 0.0, 0.0,
5000.0 > }
 pigment { rgb < 0.05, 0.25, 0.0 > }
 finish { emission 0.0 }
}

-----------------------------------------------------------------

On 13.02.2016 11:21, Kenneth wrote:
>> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.