POV-Ray : Newsgroups : povray.bugreports : CLipka: Possible BUG Found!!! :-) Server Time
27 Dec 2024 02:00:09 EST (-0500)
  CLipka: Possible BUG Found!!! :-) (Message 3 to 12 of 22)  
<<< Previous 2 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Sven Littkowski
Subject: Re: CLipka: Possible BUG Found!!! :-)
Date: 12 Feb 2016 15:02:33
Message: <56be3a59$1@news.povray.org>
Not a bug? Damn.
Ah. Forget the PITA nomination for a moment. Yeah, put it aside.

I think, I really want to go ahead with your suggestion, to create a
twisted heightfield from an image. I will continue inside the GENERAL
section.


Post a reply to this message

From: dick balaska
Subject: Re: CLipka: Possible BUG Found!!! :-)
Date: 12 Feb 2016 19:04:33
Message: <56be7311$1@news.povray.org>
On 2/12/2016 3:01 PM, Sven Littkowski wrote:
> Not a bug? Damn.
> Ah. Forget the PITA nomination for a moment. Yeah, put it aside.

I think it qualifies for double secret pita.


Post a reply to this message

From: Sven Littkowski
Subject: Re: CLipka: Possible BUG Found!!! :-)
Date: 12 Feb 2016 20:53:07
Message: <56be8c83$1@news.povray.org>
He he he!

On 12.02.2016 19:04, dick balaska wrote:
> I think it qualifies for double secret pita.


Post a reply to this message

From: Kenneth
Subject: Re: CLipka: Possible BUG Found!!! :-)
Date: 13 Feb 2016 00:20:01
Message: <web.56beba7f56d165d233c457550@news.povray.org>
Sven Littkowski <jam### [at] yahoocom> wrote:

>
> But using now a heightfield, I get an error message.
>

The HF_Cylinder macro can be a bit daunting to work with when it uses an
image_map as a function. I re-worked your code, to give you a good introduction
to it. (Also take a look at 'Function Image' in the documentation.)

For everything to work correctly, start with a 'standard' cylinder size (1.0
length, with radius .5, not 1.0). To have the proper 'equalized' x and y
triangle resolutions in the heightfield (no squashing or stretching of
triangles), the macro's x-resolution needs to be int(pi)*res, not just res. You
can see what I mean by reducing the resolution to 10,10, to see the triangle
shapes.

To reproduce your image_map correctly on the cylinder, the image itself needs to
have a width-to-height ratio of pi:1.0 (using the appropriate image resolution
that you want, of course.)

--- code ---
#declare Fn_1 =
function{
 pigment{
  image_map{jpeg "your_image.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>
               }
        }

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.
                .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 >
}

Unlike a regular height_field, the image_map eats INTO the cylinder (but with
the correct 'positive' grayscale height values.) For example, if your image_map
has white values that are 1.0 in brightness, that part of the corresponding
cylindrical heightfield will by at the outer radius of the cylinder surface;
darker image colors will eat *into* the cylinder.

The HF_Cylinder macro reproduces the image_map correctly on the OUTSIDE, not the
inside. To get it to look correct on the INSIDE instead, you can 'flip' the
image left-to-right in the image_map's code as I've mentioned, OR by making the
x-value in function(x,y,z) into (-x + 1). This along with a color-INVERTED
image_map will give you the correct heightfield INSIDE the cylinder.

If you want to MAKE the cylinder taller than 1.0 (EndB above), you need to
compensate for that by increasing the triangle Y-resolution.

Have fun experimenting!


Post a reply to this message

From: Sven Littkowski
Subject: Re: CLipka: Possible BUG Found!!! :-)
Date: 13 Feb 2016 05:10:07
Message: <56bf00ff$1@news.povray.org>
Hi, big thanks. To be honest, I couldn't have worked out these
mathematics just by myself. Especially the requirements on the image.

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.

Well, this is exciting. I am making a test right now.

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

On 13.02.2016 00:17, Kenneth wrote:
>   // this image needs to be pi-units wide by 1.0 tall, NOT square.


Post a reply to this message

From: Kenneth
Subject: Re: CLipka: Possible BUG Found!!! :-)
Date: 13 Feb 2016 11:25:01
Message: <web.56bf563956d165d233c457550@news.povray.org>
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

From: Sven Littkowski
Subject: Re: CLipka: Possible BUG Found!!! :-)
Date: 13 Feb 2016 15:41:59
Message: <56bf9517$1@news.povray.org>
Yes, and that is, where my own boundaries begin: functions. That is a
field, in which I was never good (though I am excellent in some other
fields)...

But yes, I understand, that for a cylinder I have to work with 3.14, due
to its shape.

Once I manage to have the heightfield in the cylinder, I will work then
on a texture, and then on plants and finally on buildings.

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

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

From: Sven Littkowski
Subject: Re: CLipka: Possible BUG Found!!! :-)
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

From: Kenneth
Subject: Re: CLipka: Possible BUG Found!!! :-)
Date: 14 Feb 2016 04:20:00
Message: <web.56c045b056d165d233c457550@news.povray.org>
Sven Littkowski <jam### [at] yahoocom> wrote:
> 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?

That's odd. I DO see the green color, using just your code example. Did you
combine the 'MyLandscape' object with some other CSG and then apply another
different 'gray' texture?
>
> I have the thread "The Colony Ship" inside the "Images" section here,
> and could upload the images there. But here is the code:
>

Yes, post an image there.


Post a reply to this message

From: Kenneth
Subject: Re: CLipka: Possible BUG Found!!! :-)
Date: 14 Feb 2016 15:05:00
Message: <web.56c0dd1f56d165d233c457550@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

>
> Unlike a regular height_field, the image_map eats INTO the cylinder (but with
> the correct 'positive' grayscale height values.) For example, if your image_map
> has white values that are 1.0 in brightness, that part of the corresponding
> cylindrical heightfield will by at the outer radius of the cylinder surface;
> darker image colors will eat *into* the cylinder.
>

Actually, that's only half-true (which has just become clear to me-- and I've
been working with the HF_Cylinder macro for years!)

As the 'depth' value in the macro increases, the radius of the entire
height_field cylinder ALSO increases (but not the *length* of the cylinder)--
you end up with a 'fatter' cylinder, which actually distorts the 3D image_map
pattern. The pattern looks stretched-out horizontally. (You can see this by
setting 'depth' to an extreme .99.)

IDEALLY, as 'depth' increases, the cylinder should stay at the same radius, with
the image_map function simply 'eating into' it. But that's not what happens.

I'm working on some SCALE equations to compensate for this, but it's...
complicated. The first thing to do is to scale up the *length* of the cylinder,
to get the embossed pattern to look undistorted again. Then the entire cylinder
needs to be scaled *down*, to get it back to its original radius and length.

The tricky thing about this is that it all depends on the particular 'depth'
value used.


Post a reply to this message

<<< Previous 2 Messages Goto Latest 10 Messages Next 10 Messages >>>

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