POV-Ray : Newsgroups : povray.general : Toroidal warp Server Time
4 Nov 2024 19:17:29 EST (-0500)
  Toroidal warp (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: SharkD
Subject: Toroidal warp
Date: 27 Jun 2008 19:45:00
Message: <web.48657b48df8531631d9045be0@news.povray.org>
I'm having trouble mapping an image to a torus. The patter seems to be mirrored
above and below the torus's "equator". Is there a way to get this to stop?

-Mike

torus
{
 #local Width = 64;
 #local Height = 64;
 #local Radius = Width/2/acos(pi/4);
 Width, Radius
// clipped_by {cylinder {0,y*Height,Width}}
 texture
 {
  pigment
  {
   image_map {png "texture_bowels_test.png"}
   warp
   {
    toroidal
    orientation y
    dist_exp 0
    major_radius Width
   }

  }
  scale Width
 }
 translate y*Height/2
 translate Left_Vector*+1/2
}


Post a reply to this message

From: SharkD
Subject: Re: Toroidal warp
Date: 27 Jun 2008 20:35:00
Message: <web.4865871da2e11e9c1d9045be0@news.povray.org>
"SharkD" <nomail@nomail> wrote:
> I'm having trouble mapping an image to a torus. The patter seems to be mirrored
> above and below the torus's "equator". Is there a way to get this to stop?
>
> -Mike

I managed to fix it. However, I would like to apply a toroidal warp to the
"lemon" portion of torus whose minor radius is greater than its major radius. I
am wondering how the mapping is applied in this case? Since the torus intersects
itself, there are two possible versions of the pigment that could get applied.
How does POV-Ray behave in this case? Here's what I've got so far and am having
trouble making sense of it:

torus
{
 #local Width = 64;
 #local Height = 64;
 #local Radius = Width/2/cos(pi/4);
 Width/2, Radius
// rotate x * 90
 clipped_by {cylinder {-y*Height/2,y*Height/2,Width}}
 texture
 {
  pigment
  {
   image_map {png "texture_bowels_test.png"}
   translate y * 1/2
   rotate x * 180
   scale 1/4
   warp
   {
    toroidal
    orientation z
    dist_exp 0
    major_radius -Width
   }
  }
 }
 translate y*Height/2
 translate Left_Vector*+1/2
}


Post a reply to this message

From: Warp
Subject: Re: Toroidal warp
Date: 28 Jun 2008 05:38:59
Message: <486606b3@news.povray.org>
SharkD <nomail@nomail> wrote:
> I managed to fix it. However, I would like to apply a toroidal warp to the
> "lemon" portion of torus whose minor radius is greater than its major radius. I
> am wondering how the mapping is applied in this case? Since the torus intersects
> itself, there are two possible versions of the pigment that could get applied.

  The torus warp doesn't "know" which object you are applying it to
(it doesn't really care). It always does the same thing, regardless of
which object you are using (it could be a box or a julia fractal for all
that it cares).

  Thus it probably won't do what you want if the torus is not a "pure"
torus.

-- 
                                                          - Warp


Post a reply to this message

From: Chris B
Subject: Re: Toroidal warp
Date: 28 Jun 2008 06:54:31
Message: <48661867$1@news.povray.org>
"SharkD" <nomail@nomail> wrote in message 
news:web.4865871da2e11e9c1d9045be0@news.povray.org...
> "SharkD" <nomail@nomail> wrote:
> I would like to apply a toroidal warp to the
> "lemon" portion of torus whose minor radius is greater than its major 
> radius. I
> am wondering how the mapping is applied in this case? Since the torus 
> intersects
> itself, there are two possible versions of the pigment that could get 
> applied.

In this case with the overlapping bit of the torus I think it just merges 
the two possible pigments onto the interior surface.
I tried an image map and a brick pattern with your code and both worked, 
after a fashion, but were obviously quite distorted as I think one would 
expect. Would I be right in thinking that your image file 
"texture_bowels_test.png" is quite a random sort of texture? If so you may 
be able to 'see' the distortion easier with a more regular image or pattern.

In any case it may be easier to get what you seek using a simple cylindrical 
or spherical warp.
Indeed, if it's an image map then just using map_type 2 or 1 should deliver 
a result with far less distortion.

Regards,
Chris B.


Post a reply to this message

From: SharkD
Subject: Re: Toroidal warp
Date: 28 Jun 2008 10:25:00
Message: <web.486648aaa2e11e9cb891a1db0@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> In this case with the overlapping bit of the torus I think it just merges
> the two possible pigments onto the interior surface.
> I tried an image map and a brick pattern with your code and both worked,
> after a fashion, but were obviously quite distorted as I think one would
> expect. Would I be right in thinking that your image file
> "texture_bowels_test.png" is quite a random sort of texture? If so you may
> be able to 'see' the distortion easier with a more regular image or pattern.

Just as I suspected. I will try a more regular pattern to see how it is
affected. And, yes, the texture is a tiling, repeating texture made using
TexRD.

> In any case it may be easier to get what you seek using a simple cylindrical
> or spherical warp.
> Indeed, if it's an image map then just using map_type 2 or 1 should deliver
> a result with far less distortion.

I have to use a toroidal warp because the particular piece (actually a
difference object) is being adjoined to other pieces that use regular toroidal
warps as well as cylindrical warps. Since the pieces are smoothly adjoining, a
seam in the texture between the different pieces would be noticable.

-Mike


Post a reply to this message

From: SharkD
Subject: Re: Toroidal warp
Date: 28 Jun 2008 17:45:00
Message: <web.4866afd9a2e11e9cfa138a830@news.povray.org>
Can I create the pigment from scratch using a function, and then clip it to the
desired region?

-Mike


Post a reply to this message

From: SharkD
Subject: Re: Toroidal warp
Date: 6 Jul 2008 00:10:01
Message: <web.48704526a2e11e9c1a157cba0@news.povray.org>
I'm having a separate problem now with the same warp. This problem applies to a
regular toruse, not the "lemon" I was having problems with earlier. I can't
figure out how to put the seam of the texture at the outside (farthest from the
origin) of the torus as opposed to the inside (closest to the origin). Even if I
reverse the orientation the seam is still on the inside.

Here's an example:


 #local Orient_Direct = 1; // 0 or 1
 #local Torus_Radius = 64;
 texture
 {
  pigment
  {
   image_map {png "GSprites_Tech_Texture_Test.png"}
   translate x/2
   #if (Orient_Direct = 1)
    translate y*0.7
   #else
    translate y*0.5
   #end
   rotate x * 180
   scale 1/3.2
   warp
   {
    toroidal
    #if (Orient_Direct = 1)
     orientation -z
    #else
     orientation z
    #end
    dist_exp 0
    major_radius Torus_Radius
   }
  }
 }

I would appreciate any help.

-Mike


Post a reply to this message

From: Chris B
Subject: Re: Toroidal warp
Date: 6 Jul 2008 04:06:43
Message: <48707d13$1@news.povray.org>
"SharkD" <nomail@nomail> wrote in message 
news:web.48704526a2e11e9c1a157cba0@news.povray.org...
> I'm having a separate problem now with the same warp. This problem applies 
> to a
> regular toruse, not the "lemon" I was having problems with earlier. I 
> can't
> figure out how to put the seam of the texture at the outside (farthest 
> from the
> origin) of the torus as opposed to the inside (closest to the origin). 
> Even if I
> reverse the orientation the seam is still on the inside.
>

The code below should place the horizontal seam on the outside. The warps 
take the image from the square <0,0,0> to <1,1,0>, so moving it up by 0.5*y 
causes the seam to be positioned where the middle of the image was before. 
The bottom half is filled in because the image_map generates an infinite 
number of copies butted end to end, so you end up seeing the top half of one 
copy and the bottom half of the original.

I don't think the orientation setting does what you think it does. When you 
change it from z to -z, I think it just makes it look at the image from the 
other side. You also seemed to have a lot more translations and rotations 
than you need. Just by translating the image you can move both the 
horizontal and vertical seams around the torus.

Regards,
Chris B.

camera {location <0,28,-204> look_at 0 }
light_source {<-1,30 ,-400>, rgb 3}

#local Torus_Radius = 64;
torus {Torus_Radius,20
  pigment {
    image_map {png "yourimage.png"}
    translate y*0.5
    warp { toroidal
      major_radius Torus_Radius
    }
  }
}


Post a reply to this message

From: SharkD
Subject: Re: Toroidal warp
Date: 6 Jul 2008 14:45:00
Message: <web.4871128da2e11e9c8c88ff560@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> The code below should place the horizontal seam on the outside. The warps
> take the image from the square <0,0,0> to <1,1,0>, so moving it up by 0.5*y
> causes the seam to be positioned where the middle of the image was before.
> The bottom half is filled in because the image_map generates an infinite
> number of copies butted end to end, so you end up seeing the top half of one
> copy and the bottom half of the original.
>
> I don't think the orientation setting does what you think it does. When you
> change it from z to -z, I think it just makes it look at the image from the
> other side. You also seemed to have a lot more translations and rotations
> than you need. Just by translating the image you can move both the
> horizontal and vertical seams around the torus.
>
> Regards,
> Chris B.
>
> camera {location <0,28,-204> look_at 0 }
> light_source {<-1,30 ,-400>, rgb 3}
>
> #local Torus_Radius = 64;
> torus {Torus_Radius,20
>   pigment {
>     image_map {png "yourimage.png"}
>     translate y*0.5
>     warp { toroidal
>       major_radius Torus_Radius
>     }
>   }
> }

Sorry, I wasn't clear enough in my previous post. I meant the seam of the warp
itself, not the texture. Consider the case where the image map is scaled first
by a non-integer value. The result is that the image gets wrapped around the
torus in such a way that it doesn't repeat by an amount equal to a whole
number. There will be portions where the texture is "split" and meets at points
other than the image's edges. Using the example you gave, consider this:

#local Torus_Radius = 64;
torus {Torus_Radius,20
  pigment {
    image_map {png "yourimage.png"}
    // integer scaling
    // scale 1/3
    // non-integer scaling
    scale 1/3.1
    warp { toroidal
      major_radius Torus_Radius
    }
  }
}

If you'll notice along the inner edge of the torus, you'll see that the "edge"
of the image appears twice in close proximity, accounting for the 0.1
difference in the scaling factor. What I would like to do is move this edge
where the image meets itself to the outside of the torus. I haven't yet figured
out a way of doing this.

-Mike


Post a reply to this message

From: Chris B
Subject: Re: Toroidal warp
Date: 6 Jul 2008 17:45:53
Message: <48713d11$1@news.povray.org>
"SharkD" <nomail@nomail> wrote in message 
news:web.4871128da2e11e9c8c88ff560@news.povray.org...

> I meant the seam of the warp itself, not the texture.

Ah. Slightly more tricky :-).
I don't see any control on the warp itself that would do that for you 
(unless I'm wrong about the meaning of the orientation attribute), so I 
think you'll need a workaround.

> Consider the case where the image map is scaled first
> by a non-integer value.

The only thing that I can think of that will do this is to use a pigment_map 
with two copies of the pigment. One where the repeating scaled image_map is 
aligned to the origin (the default) and one where it's aligned to y=1. You 
can then use the pigment_map to join them wherever you want. In the example 
below I've placed the half-cut image at y=0.5 so that it appears around the 
outer rim of the torus. In this example I've cut a corner out of the torus 
just so that the inner rim and outer rim are both visible at the same time.

Regards,
Chris B.

camera {location <0,0,-124> look_at 0 }
light_source {<-1,30 ,-400>, rgb 3}

#local Torus_Radius = 64;
#local Scale_Factor = 1/10.5;

#declare MyPigment = pigment {
  image_map {png "YourImage.png"}
  scale Scale_Factor
}

difference {
  torus {Torus_Radius,20
    pigment {
      gradient y
      pigment_map {
        [0.0 MyPigment]
        [0.5 MyPigment]
        [0.5 MyPigment translate -y*Scale_Factor/2]
        [1.0 MyPigment translate -y*Scale_Factor/2]
      }
      warp { toroidal
        major_radius Torus_Radius
      }
    }
  }
  box {-y*30,<90,30,-90> pigment {rgbt 1}}
}


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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