POV-Ray : Newsgroups : povray.general : negative scale? Server Time
23 Dec 2024 08:00:39 EST (-0500)
  negative scale? (Message 1 to 8 of 8)  
From: Leroy
Subject: negative scale?
Date: 23 Dec 2018 22:50:01
Message: <web.5c20573d380e028c291eeef00@news.povray.org>
when I use this
function{pigment{image_map scale<-1,-1,1>}}
I get artifacts around the edges.
Why is this? Any one else come across this and have a work around?

Have Fun!


Post a reply to this message

From: Thomas de Groot
Subject: Re: negative scale?
Date: 24 Dec 2018 02:45:09
Message: <5c208e85$1@news.povray.org>
On 24-12-2018 4:49, Leroy wrote:
> when I use this
> function{pigment{image_map scale<-1,-1,1>}}
> I get artifacts around the edges.
> Why is this? Any one else come across this and have a work around?
> 
> Have Fun!
> 
> 

Do you intend to use this function in a height_field? I do not know if 
this is related, but I get artefacts around the edges of a image_map 
function's height_field, independently of scale by the way. I solved it 
by just intersecting away the height_field edges with a slightly smaller 
box. Like this:

//start code
#declare F_hf =
function {
   pigment {
     image_map {
       tga "My_image.tga" gamma 1.0
       map_type 0
       interpolate 2
     }
     //adding some warp
   }
}

#local CuttingKnife = 0.994;	//find minimum value experimentally
#local HF_res = 2000;

#declare HF_base =
intersection {
   height_field {
     function HF_res, HF_res {F_hf(x,y,z).hf}
     smooth
     translate <-0.5, 0, -0.5>
   }
   box {
     <-0.5, -0.5, -0.5>, <0.5, 0.5, 0.5>
     scale <CuttingKnife, 2, CuttingKnife>
   }
   scale <1/CuttingKnife, 1, 1/CuttingKnife>
   scale SomeScale
   rotate SomeAngle*y
}
//end code

However, I do not know /why/ the artefacts happen, nor if this should be 
expected or not.

Hope this helps.

-- 
Thomas


Post a reply to this message

From: clipka
Subject: Re: negative scale?
Date: 24 Dec 2018 06:52:33
Message: <5c20c881$1@news.povray.org>
Am 24.12.2018 um 08:45 schrieb Thomas de Groot:
...
> #declare F_hf =
> function {
>    pigment {
>      image_map {
>        tga "My_image.tga" gamma 1.0
>        map_type 0
>        interpolate 2
>      }
>      //adding some warp
>    }
> }
...
> However, I do not know /why/ the artefacts happen, nor if this should be 
> expected or not.

Interpolation I presume. Unless you specify the "once" keyword, at the 
edges the image is interpolated with the opposite edge.


Post a reply to this message

From: Thomas de Groot
Subject: Re: negative scale?
Date: 25 Dec 2018 02:27:36
Message: <5c21dbe8$1@news.povray.org>
On 24-12-2018 12:52, clipka wrote:
> Am 24.12.2018 um 08:45 schrieb Thomas de Groot:
> ...
>> #declare F_hf =
>> function {
>>    pigment {
>>      image_map {
>>        tga "My_image.tga" gamma 1.0
>>        map_type 0
>>        interpolate 2
>>      }
>>      //adding some warp
>>    }
>> }
> ...
>> However, I do not know /why/ the artefacts happen, nor if this should 
>> be expected or not.
> 
> Interpolation I presume. Unless you specify the "once" keyword, at the 
> edges the image is interpolated with the opposite edge.

Ah! That is an interesting thought. Never thought of it but makes sense. 
I shall investigate. I'll come back.

Thanks! and Merry Christmas!

-- 
Thomas


Post a reply to this message

From: Thomas de Groot
Subject: Re: negative scale?
Date: 25 Dec 2018 03:50:17
Message: <5c21ef49@news.povray.org>
On 25-12-2018 8:27, Thomas de Groot wrote:
> On 24-12-2018 12:52, clipka wrote:
>> Am 24.12.2018 um 08:45 schrieb Thomas de Groot:
>> ...
>>> #declare F_hf =
>>> function {
>>>    pigment {
>>>      image_map {
>>>        tga "My_image.tga" gamma 1.0
>>>        map_type 0
>>>        interpolate 2
>>>      }
>>>      //adding some warp
>>>    }
>>> }
>> ...
>>> However, I do not know /why/ the artefacts happen, nor if this should 
>>> be expected or not.
>>
>> Interpolation I presume. Unless you specify the "once" keyword, at the 
>> edges the image is interpolated with the opposite edge.
> 
> Ah! That is an interesting thought. Never thought of it but makes sense. 
> I shall investigate. I'll come back.
> 
> Thanks! and Merry Christmas!
> 

Back again. The answer is yes and no. Yes, because interpolation 
definitely creates artefacts from the opposite side of the image_map / 
height_field; no, because adding the "once" keyword only makes the 
artefacts in the x-axis direction disappear, but /not/ in the z-axis 
direction.

To illustrate this, I add a test file with image_map. Run with "once" 
(at line 65) commented out or not to see the difference.

-- 
Thomas


Post a reply to this message


Attachments:
Download 'hf_image_map_test.7z.zip' (3673 KB)

From: Stephen
Subject: Re: negative scale?
Date: 25 Dec 2018 03:53:57
Message: <5c21f025$1@news.povray.org>
On 25/12/2018 07:27, Thomas de Groot wrote:
> Thanks! and Merry Christmas!


And Merry Christmas from me. :-D

-- 

Regards
     Stephen


Post a reply to this message

From: Leroy
Subject: Re: negative scale?
Date: 25 Dec 2018 16:25:00
Message: <web.5c229f9afbbfc375d335880@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> On 24-12-2018 4:49, Leroy wrote:
> > when I use this
> > function{pigment{image_map scale<-1,-1,1>}}
> > I get artifacts around the edges.
> > Why is this? Any one else come across this and have a work around?
> >
> > Have Fun!
> >
> >
>
> Do you intend to use this function in a height_field? I do not know if
> this is related, but I get artefacts around the edges of a image_map
> function's height_field, independently of scale by the way. I solved it
> by just intersecting away the height_field edges with a slightly smaller
> box.
> Thomas

Merry Christmas :)
 I was using the function to make a color palette from any image.
I use that palette to convert the image into a 'pcx' file.
Then use the 'pcx' file to make a 'cin' video file.
Using POV  all the while.
 The function works fine if don't scale it negatively.

 Thanks for you input.

Have Christmas fun!


Post a reply to this message

From: Alain
Subject: Re: negative scale?
Date: 26 Dec 2018 16:23:36
Message: <5c23f158$1@news.povray.org>
Le 18-12-25 à 16:22, Leroy a écrit :
> Thomas de Groot <tho### [at] degrootorg> wrote:
>> On 24-12-2018 4:49, Leroy wrote:
>>> when I use this
>>> function{pigment{image_map scale<-1,-1,1>}}
>>> I get artifacts around the edges.
>>> Why is this? Any one else come across this and have a work around?
>>>
>>> Have Fun!
>>>
>>>
>>
>> Do you intend to use this function in a height_field? I do not know if
>> this is related, but I get artefacts around the edges of a image_map
>> function's height_field, independently of scale by the way. I solved it
>> by just intersecting away the height_field edges with a slightly smaller
>> box.
>> Thomas
> 
> Merry Christmas :)
>   I was using the function to make a color palette from any image.
> I use that palette to convert the image into a 'pcx' file.
> Then use the 'pcx' file to make a 'cin' video file.
> Using POV  all the while.
>   The function works fine if don't scale it negatively.
> 
>   Thanks for you input.
> 
> Have Christmas fun!
> 
> 
> 
> 
> 
In that case, you can «scale» the location instead of the image_map :
#declare Loc=Loc*<-1,-1,1>;


Post a reply to this message

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