POV-Ray : Newsgroups : povray.general : Transforming an image_pattern{} : Re: Transforming an image_pattern{} Server Time
26 Apr 2024 16:21:36 EDT (-0400)
  Re: Transforming an image_pattern{}  
From: Thomas de Groot
Date: 31 May 2018 02:48:49
Message: <5b0f9ad1$1@news.povray.org>
On 31-5-2018 1:36, Kenneth wrote:
> Thomas de Groot <tho### [at] degrootorg> wrote:
>> On 30-5-2018 1:37, Kenneth wrote:
>>> clipka <ano### [at] anonymousorg> wrote:
>>>>
>>>>       #local Trans = transform {
>>>>         translate <...>
>>>>         ...
>>>>       }
>>>>
>>>>       texture {
>>>>         image_pattern { ... }
>>>>         texture_map {
>>>>           [0.0 pigment { ... transform { Trans inverse } ]
>>>>           [1.0 pigment { ... transform { Trans inverse } ]
>>>>         }
>>>>         transform { Trans }
>>>>       }
>>>
>>>
>>> Thomas, try this example; it *looks* like it works--
>>
>> The first suggestion by Christoph was correct...
> 
> Yes, you're right (although with a slight change.) I had to do some more
> experimenting, to see what I did wrong.
> 
> EACH index-entry in the texture_map needs the inverse transform, as Clipka
> suggested. (I included only one, after your 2nd index-entry.) My way of coding
> the entire construct is *slightly* different, though:
> 
> #declare MyTex =
>     texture {
>       image_pattern {
>         png "My_pattern.png" gamma 1.0 use_alpha
>         ....
>         } // end of image_pattern
> 
>       transform{TRA} // THE MAIN TRANSFORM HERE
> 
>     texture_map {
>         [0.0  texture{...} or pigment{...} etc
>         transform{TRA inverse}
>         ]
>         [1.0 texture{...} or pigment...} etc
>          transform{TRA inverse}
>         ]
>                 }
>             }
> 

This is a bit different! What you do here is (1) transform the 
image_pattern, then, (2) and separately, inverse transform the 
texture_map. That will give something very different I believe. The 
transform should be moved down to the complete texture level, e.g.:

texture {
   image_map {}
   texture_map {
     [0.0 texture {} transform {TRA inverse}]
     [1.0 texture {} transform {TRA inverse}]
   }
   transform {TRA}
}

Be sure too that all the transformations do the right thing when 
'inverse' is used. In this case, unexpected results might occur I believe.

My original intention was to be able to transform the image_pattern I 
needed, without touching the texture_map I had already defined for the 
scene. Tunnel vision prevented me from seeing the obvious way to do that 
(elementary truly). ;-)

In the mean time, I have ironed out most of the remaining problems and, 
as the dust is slowly settling, I will soon be able to show the results.

> Thanks for giving me a 'push' to test this stuff (and to play around with the
> use_alpha feature-- it may have some important implications for my 'city
> buildings' scene.)

Always happy to stimulate people. Thoughts, try-outs, conundrums from 
the community are always most stimulating experiences for me, even when 
I do not understand one iota from them :-)


-- 
Thomas


Post a reply to this message

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