POV-Ray : Newsgroups : povray.newusers : texture mirroring (like D3DTADDRESS_MIRROR) Server Time
24 Nov 2024 15:47:31 EST (-0500)
  texture mirroring (like D3DTADDRESS_MIRROR) (Message 1 to 4 of 4)  
From: Nils
Subject: texture mirroring (like D3DTADDRESS_MIRROR)
Date: 25 Oct 2007 10:35:01
Message: <web.4720a7c3eaa637bf687c1ed50@news.povray.org>
Is there an easy way to get pov ray to mirror a texture every time it
reaches a texture boundry?


The default way pov ray repeats a texture is wrap, looks like this:
http://www.math.uni-leipzig.de/pool/tuts/SelfDXD/DirectXGraphics/texturen/wrap.gif

The way I'd need the textures repeated should look like this:
http://www.math.uni-leipzig.de/pool/tuts/SelfDXD/DirectXGraphics/texturen/mirror.gif



I've managed to simulate texture mirroring using the image_map 4 times
(original, scaled by -1 in x, scaled in y and scaled in both x and y),
combining these using gradient x and gradient y, but now I'm stuck.
I can't interpolate my image_map (color leaks around the image borders) and
scaling the image has become a nightmare.

So is there a convenient way to achive texture mirroring?


Post a reply to this message

From: Alain
Subject: Re: texture mirroring (like D3DTADDRESS_MIRROR)
Date: 25 Oct 2007 11:44:48
Message: <4720b9f0@news.povray.org>
Nils nous apporta ses lumieres en ce 2007/10/25 10:30:
> Is there an easy way to get pov ray to mirror a texture every time it
> reaches a texture boundry?
> 
> 
> The default way pov ray repeats a texture is wrap, looks like this:
> http://www.math.uni-leipzig.de/pool/tuts/SelfDXD/DirectXGraphics/texturen/wrap.gif
> 
> The way I'd need the textures repeated should look like this:
> http://www.math.uni-leipzig.de/pool/tuts/SelfDXD/DirectXGraphics/texturen/mirror.gif
> 
> 
> 
> I've managed to simulate texture mirroring using the image_map 4 times
> (original, scaled by -1 in x, scaled in y and scaled in both x and y),
> combining these using gradient x and gradient y, but now I'm stuck.
> I can't interpolate my image_map (color leaks around the image borders) and
> scaling the image has become a nightmare.
> 
> So is there a convenient way to achive texture mirroring?
> 
> 
Very easy:
just use a warp{repeat x flip x}warp{repeat y flip y} scale Your_Scale
in your texture block.

The flip keyword in a repeat warp will cause the pattern to be inverted relative 
to a given axis.
In this case, it will repeat every unit along both x and y axis, and each 
repetition gets inverted relative to the preceding one.
You can now use interpolate, and scale after the warps.
Unless you scale it, your original image_map goes from x=0, y=0 to x=1, y=1, and 
extend infinitely along the z axis.
If you scale before the warps, you need to adjust the repeat values acording to 
the scaling that you used.

Please read the documentation about warp.

-- 
Alain
-------------------------------------------------
f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.


Post a reply to this message

From: M a r c
Subject: Re: texture mirroring (like D3DTADDRESS_MIRROR)
Date: 25 Oct 2007 16:23:02
Message: <4720fb26$1@news.povray.org>

4720b9f0@news.povray.org...
> Alain
> -------------------------------------------------
> f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.

r u sr?
Mrc


Post a reply to this message

From: Alain
Subject: Re: texture mirroring (like D3DTADDRESS_MIRROR)
Date: 25 Oct 2007 16:34:09
Message: <4720fdc1@news.povray.org>
M_a_r_c nous apporta ses lumieres en ce 2007/10/25 16:23:
> "Alain" <ele### [at] netscapenet> a écrit dans le message de news: 
> 4720b9f0@news.povray.org...
>> Alain
>> -------------------------------------------------
>> f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.
> 
> r u sr?
> Mrc 
> 
> 
nt me, th g ou rt ths

-- 
Alain
-------------------------------------------------
Fundamentalism: Shit must be born again.


Post a reply to this message

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