POV-Ray : Newsgroups : povray.general : Meshes and Textures Server Time
5 Nov 2024 22:24:12 EST (-0500)
  Meshes and Textures (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Gordon
Subject: Meshes and Textures
Date: 28 Mar 1999 08:42:59
Message: <36fe31e3.0@news.povray.org>
Hi All,

Something funny happened in POV the other day!

I defined a mesh with textures applied to the individual triangles. Then I
made several copies of that mesh, rotated and translated differently. The
strange thing is, the texture is not in the same place on the copies. What
gives?

In every other case I know, if you copy an object and move it, the texture
goes with the object, you have to translate/scale/rotate the texture
independently to do anything else.

Has anyone else seen this? If so, can someone explain what is happening, and
maybe exactly what the effect on the texture is when an object is
moved/scaled/rotated.

Thanks
Gordon
<gbe### [at] birdcameroncomau>

PS I am putting textures on the blades of grass in my Grass Macro update.
The textures now follow the blades, so you can have striped blades, etc.


Post a reply to this message

From: Ken
Subject: Re: Meshes and Textures
Date: 28 Mar 1999 09:13:38
Message: <36FE37F2.B7CD9051@pacbell.net>
Gordon wrote:
> 
> Hi All,
> 
> Something funny happened in POV the other day!
> 
> I defined a mesh with textures applied to the individual triangles. Then I
> made several copies of that mesh, rotated and translated differently. The
> strange thing is, the texture is not in the same place on the copies. What
> gives?
> 
> In every other case I know, if you copy an object and move it, the texture
> goes with the object, you have to translate/scale/rotate the texture
> independently to do anything else.
> 
> Has anyone else seen this? If so, can someone explain what is happening, and
> maybe exactly what the effect on the texture is when an object is
> moved/scaled/rotated.
> 
> Thanks
> Gordon
> <gbe### [at] birdcameroncomau>
> 
> PS I am putting textures on the blades of grass in my Grass Macro update.
> The textures now follow the blades, so you can have striped blades, etc.

  Welcome to the world origin concept. If each and every one of your
triangles is created at xyz 0, textured, and then translated/rotated
into position you would preserve the state and position of the texture.
If you construct a mesh of triangles each with it's own vertice location
instead of translating/rotating it into position and then apply a texture
to it the triangle is not built at xzy 0 the texure appearance will
change according to it's offset from 0.

  If that is fuzzy to you I'll try to simplify my response.

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Rick
Subject: Re: Meshes and Textures
Date: 28 Mar 1999 09:19:02
Message: <36fe3a56.0@news.povray.org>
Yes, go, simplifiy!!, prefrable in terms the layman can understand :)

Rick

Ken wrote in message <36FE37F2.B7CD9051@pacbell.net>...
>Gordon wrote:
>>
>> Hi All,
>>
>> Something funny happened in POV the other day!
>>
>> I defined a mesh with textures applied to the individual triangles. Then
I
>> made several copies of that mesh, rotated and translated differently. The
>> strange thing is, the texture is not in the same place on the copies.
What
>> gives?
>>
>> In every other case I know, if you copy an object and move it, the
texture
>> goes with the object, you have to translate/scale/rotate the texture
>> independently to do anything else.
>>
>> Has anyone else seen this? If so, can someone explain what is happening,
and
>> maybe exactly what the effect on the texture is when an object is
>> moved/scaled/rotated.
>>
>> Thanks
>> Gordon
>> <gbe### [at] birdcameroncomau>
>>
>> PS I am putting textures on the blades of grass in my Grass Macro update.
>> The textures now follow the blades, so you can have striped blades, etc.
>
>  Welcome to the world origin concept. If each and every one of your
>triangles is created at xyz 0, textured, and then translated/rotated
>into position you would preserve the state and position of the texture.
>If you construct a mesh of triangles each with it's own vertice location
>instead of translating/rotating it into position and then apply a texture
>to it the triangle is not built at xzy 0 the texure appearance will
>change according to it's offset from 0.
>
>  If that is fuzzy to you I'll try to simplify my response.
>
>--
>Ken Tyler
>
>mailto://tylereng@pacbell.net


Post a reply to this message

From: Ken
Subject: Re: Meshes and Textures
Date: 28 Mar 1999 09:50:21
Message: <36FE4098.46BDB4DF@pacbell.net>
Rick wrote:
> 
> Yes, go, simplifiy!!, prefrable in terms the layman can understand :)
> 
> Rick

 Ok let us look at it this way. All pigment patterns in pov are 1 x 1 x 1
units in size. When you apply a pigment to a 1 x 1 x 1 scaled object that
is centred at the origin (xyz = 0) then it will be completely covered by
one repetition of the pattern (unless it is scaled). If you apply the same
pigment pattern to a 1 unit object that is say offset from the origin by
0.5 the pigment pattern will only apply to 1/2 of the object and the rest
of the object will be covered by the second repetition of the pigment
pattern.

  Think of it this way - you have a picture in your hands that is 1 x 1.
You need to paste it on to a wall that is 1 x 1. Unfortunately the picture
is stuck physically at xyz 0 but your wall is off center. Now you are going
to need a half of a second picture to cover what the first would not.

  We can get around this by translating our pigments to align with the
location of the object it's to be attached to. If the object is rotated
and not sitting at the origin and we apply the pattern without taking
this into account then when we move the object it is now covered by a
different part of the pattern. This is because they are not aligned at
origin together with respect to their rotations and transformations.

  To solve his triangle problem he needs to rotate and translate each
pigment he has applied to the individual triangles so they match in
location and the direction they are pointing. If he doesn't then when
he goes to move the object or scale it they will not act in unison and
the pattern will predictably change from one location to another. I is
a useful trick when one does not want identical looking objects but a
pain if not accounted for when you want identical objects in different
locations.

  If that is still fuzzy then I will try to provide some graphic
examples for you all later on. It should be easy with gradient
pattern to visually explain the phenomena but if you are that
curious a little experimentation on your own would probably nail
the concept home faster than what I could do for you.


-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: John VanSickle
Subject: Re: Meshes and Textures
Date: 28 Mar 1999 13:56:38
Message: <36FE7CD5.ED75698C@erols.com>
Gordon wrote:
> 
> Hi All,
> 
> Something funny happened in POV the other day!
> 
> I defined a mesh with textures applied to the individual triangles. Then I
> made several copies of that mesh, rotated and translated differently. The
> strange thing is, the texture is not in the same place on the copies. What
> gives?

It's called a bug.  According to the docs, anything textured prior to
a translate will maintain the same appearance.  In the case of individually-
textured triangles in a mesh, this is not so.  It has been made known to the
POV-Ray team at least once, but I guess it won't hurt to point it out again.

Regards,
John


Post a reply to this message

From: John VanSickle
Subject: Re: Meshes and Textures
Date: 28 Mar 1999 14:21:26
Message: <36FE82A8.76D4DEBF@erols.com>
Ken wrote:
> 
> Rick wrote:
> >
> > Yes, go, simplifiy!!, prefrable in terms the layman can understand :)
> >
> > Rick
> 
>  Ok let us look at it this way. All pigment patterns in pov are 1 x 1 x 1
> units in size. When you apply a pigment to a 1 x 1 x 1 scaled object that
> is centred at the origin (xyz = 0) then it will be completely covered by
> one repetition of the pattern (unless it is scaled). If you apply the same
> pigment pattern to a 1 unit object that is say offset from the origin by
> 0.5 the pigment pattern will only apply to 1/2 of the object and the rest
> of the object will be covered by the second repetition of the pigment
> pattern.
> 
>   Think of it this way - you have a picture in your hands that is 1 x 1.
> You need to paste it on to a wall that is 1 x 1. Unfortunately the picture
> is stuck physically at xyz 0 but your wall is off center. Now you are going
> to need a half of a second picture to cover what the first would not.
> 
>   We can get around this by translating our pigments to align with the
> location of the object it's to be attached to. If the object is rotated
> and not sitting at the origin and we apply the pattern without taking
> this into account then when we move the object it is now covered by a
> different part of the pattern. This is because they are not aligned at
> origin together with respect to their rotations and transformations.
> 
>   To solve his triangle problem he needs to rotate and translate each
> pigment he has applied to the individual triangles so they match in
> location and the direction they are pointing. If he doesn't then when
> he goes to move the object or scale it they will not act in unison and
> the pattern will predictably change from one location to another. I is
> a useful trick when one does not want identical looking objects but a
> pain if not accounted for when you want identical objects in different
> locations.

This is all well and good, but it doesn't really address the reported
problem.  All of POV-Ray's other objects, when textured and then rotated
or translated, maintain their appearance, most particularily the location
of the pattern relative to the object.  The sole exception is the
inidivdually-textured triangle in a mesh.

The only work-around is the one you specify, but requires a separate
texture declared for each and every patterned triangle in every mesh, and
meshes define cannot be copied, but the whole process has to be repeated
for every mesh, even if the same object is to be identically modelled.
And if the user wants to tweak the location of the mesh, every patterned
texture must be identically tweaked.  The memory requirements are huge, and
the ability to make separately translated and/or rotated but otherwise
idenical copies of a mesh, with minimal memory requirements, is one of the
chief benefits of the mesh.  Suppose the original poster wants to make
an object with 2000 triangles in it, and then use that object 2000 times
in a scene.  That's a few dozen kilobytes if the mesh transformed
as does every other object, but will take hundreds of megabytes to work
around the bug.

The only real solution is to fix the bug; translations, and rotations are
not supposed to affect the appearance of an object that is translated
*AFTER* the texture is applied, and this is stated explicitly in the docs.
They slipped up on the mesh.

Regards,
John


Post a reply to this message

From: Gordon
Subject: Re: Meshes and Textures
Date: 29 Mar 1999 02:20:15
Message: <36ff29af.0@news.povray.org>
Ken wrote in message <36FE37F2.B7CD9051@pacbell.net>...
>Gordon wrote:
>>
>> Hi All,
>>
>> Something funny happened in POV the other day!
>>
>> I defined a mesh with textures applied to the individual triangles. Then
I
>> made several copies of that mesh, rotated and translated differently. The
>> strange thing is, the texture is not in the same place on the copies.
What
>> gives?
>>
>> In every other case I know, if you copy an object and move it, the
texture
>> goes with the object, you have to translate/scale/rotate the texture
>> independently to do anything else.
>>
>> Has anyone else seen this? If so, can someone explain what is happening,
and
>> maybe exactly what the effect on the texture is when an object is
>> moved/scaled/rotated.
>>
>> Thanks
>> Gordon
>> <gbe### [at] birdcameroncomau>
>>
>> PS I am putting textures on the blades of grass in my Grass Macro update.
>> The textures now follow the blades, so you can have striped blades, etc.
>
>  Welcome to the world origin concept. If each and every one of your
>triangles is created at xyz 0, textured, and then translated/rotated
>into position you would preserve the state and position of the texture.
>If you construct a mesh of triangles each with it's own vertice location
>instead of translating/rotating it into position and then apply a texture
>to it the triangle is not built at xzy 0 the texure appearance will
>change according to it's offset from 0.
>
>  If that is fuzzy to you I'll try to simplify my response.
>
>--
>Ken Tyler
>
>mailto://tylereng@pacbell.net

Thanks Ken, but I think you may of misunderstood my description. I will
illustrate with an example.

#declare Fred = mesh{
triangle { <1,1,1>, <1,1,1.5>,<1,1.5,1> texture {T0} }
triangle { <2,1,1>, <2,1,1.5>,<2,1.5,1> texture {T1} }
}

object { Fred } // This one is OK
object { Fred rotate <0,0,45> } // This one is not the same as the other
one! The textures have rotated (I think) 45 degrees the oposite direction to
the mesh.

Does this make sense?

Gordon
<gbe### [at] birdcameroncomau>





I


Post a reply to this message

From: Ken
Subject: Re: Meshes and Textures
Date: 29 Mar 1999 07:59:02
Message: <36FF5BEE.125FA5AA@pacbell.net>
********  Welcome to the world origin concept.  ********** 

Gordon wrote:
> Thanks Ken, but I think you may of misunderstood my description. I will
> illustrate with an example.
> 
> #declare Fred = mesh{
> triangle { <1,1,1>, <1,1,1.5>,<1,1.5,1> texture {T0} }
> triangle { <2,1,1>, <2,1,1.5>,<2,1.5,1> texture {T1} }
> }
> 
> object { Fred } // This one is OK
> object { Fred rotate <0,0,45> } // This one is not the same as the other
> one! The textures have rotated (I think) 45 degrees the oposite direction to
> the mesh.
> 
> Does this make sense?
> 
> Gordon
> <gbe### [at] birdcameroncomau>
> 
> I

   No I understood you completely. If you take the time to
 render the following example I believe you will find that
 it unquestionably supports my earlier claims. I rearranged
 your two triangle example because your triangle mesh didn't
 have any common vertice locations. The way they are positioned
 now is in keeping with your problem and shows the only method
 I know of to adhere to the present system of a zero origin
 and not have your textures move when translated, rotated, or
 both.

  I am not saying that it is a perfect system but if you adhere
 to it's rules it will perform reliably and predictably.

  camera{location<0,.5,-6>look_at<0,.5,0>}

  light_source{<0,0,-10>rgb 1}

  #declare T1 = 
  texture{ pigment { gradient x+y color_map {
  [0.00 rgb<1,1,1>][0.40 rgb<1,1,1>][0.40 rgb<1,0,0>]
  [0.60 rgb<1,0,0>][0.60 rgb<1,1,1>][1.00 rgb<1,1,1>]}scale 0.5}
  finish{ambient 0.35 diffuse 0.35}}

  // The method you were using
  #declare Fred1 = 
  mesh     {
  triangle { <-1,1,0>,<0,0,0>,<1,1,0> texture{T1}}
  triangle { <-1,1,0>,<0,2,0>,<1,1,0> texture{T1}}
           }

  // By the book method
  #declare Fred2 = 
  union    {
  triangle { <-1, 0.5,0>,<0,-0.5,0>,<1, 0.5,0>texture{T1}translate y*-0.5}
  triangle { <-1,-0.5,0>,<0, 0.5,0>,<1,-0.5,0>texture{T1}translate y* 0.5}
           }

  object   { Fred1 rotate  0*y translate < 0.0,-1.75,0> }
  object   { Fred1 rotate 45*x translate <-2.5,-1.75,0> }
  object   { Fred1 rotate 65*y translate < 2.5,-1.75,0> }

  object   { Fred2 rotate  0*y translate < 0.0, 1.75,0> }
  object   { Fred2 rotate 45*x translate <-2.5, 1.75,0> }
  object   { Fred2 rotate 65*y translate < 2.5, 1.75,0> }


Regards,

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Gordon
Subject: Re: Meshes and Textures
Date: 29 Mar 1999 11:03:21
Message: <36ffa449.0@news.povray.org>
Thanks Ken, but I am not using unions of traingles, but a mesh object. Can
you recast your answer to use meshes? Please don't take this the wrong way,
but I do know about the world origin principle. The fact that the triangles
don't touch isn't relevant. What I am doing is creating a complete mesh
object, each of which has a texture assigned to it. Then I want to use LOTS
of copies of that object. I would assume that like any other object type, if
I make copies and rotate them the texture goes along.

If you render the following, you will see what I mean. The two objects,
declared in the same way, and used in the same way, don't behave the same.
The texture is "stuck" to the object in the case of a cube, in the case of
the mesh, it isn't.

Regards
Gordon

camera {
        location <0, 0, -4>
        look_at  <0, 0,  0>
}

light_source {   // Light1
  <-986.689, 1003.370, -1011.881>
  color rgb <1.000, 1.000, 1.000>
}

#declare T0 =
texture {
        pigment {
                gradient x
                colour_map {
                        [ 0.0 colour rgb <0.15,0.6,0.17>]
                        [ 0.5 colour rgb <1,0.1,0.17>]
                        [ 1.0 colour rgb <0.15,0.6,0.17>]
                        }
                        frequency 5
                }
        finish {
                ambient 0.3
                diffuse 0.65
                phong 0.3
                phong_size 20
                }
        }

#declare Obj = mesh{
        triangle { <0,0,0>, <1,0,0>, <0,1,0> texture{ T0 } }
}

object { Obj translate <-1,1,0> }
object { Obj rotate <0,0,30> translate <1,1,0> }

#declare Obj2 = box { <-0.5,-0.5,-0.5>, <0.5,0.5,0.5> texture { T0 } }

object { Obj2 translate <-1,-1,0> }
object { Obj2 rotate <0,0,30> translate <1,-1,0> }



Ken wrote in message <36FF5BEE.125FA5AA@pacbell.net>...
>********  Welcome to the world origin concept.  **********
>
>Gordon wrote:
>> Thanks Ken, but I think you may of misunderstood my description. I will
>> illustrate with an example.
>>
>> #declare Fred = mesh{
>> triangle { <1,1,1>, <1,1,1.5>,<1,1.5,1> texture {T0} }
>> triangle { <2,1,1>, <2,1,1.5>,<2,1.5,1> texture {T1} }
>> }
>>
>> object { Fred } // This one is OK
>> object { Fred rotate <0,0,45> } // This one is not the same as the other
>> one! The textures have rotated (I think) 45 degrees the oposite direction
to
>> the mesh.
>>
>> Does this make sense?
>>
>> Gordon
>> <gbe### [at] birdcameroncomau>
>>
>> I
>
>   No I understood you completely. If you take the time to
> render the following example I believe you will find that
> it unquestionably supports my earlier claims. I rearranged
> your two triangle example because your triangle mesh didn't
> have any common vertice locations. The way they are positioned
> now is in keeping with your problem and shows the only method
> I know of to adhere to the present system of a zero origin
> and not have your textures move when translated, rotated, or
> both.
>
>  I am not saying that it is a perfect system but if you adhere
> to it's rules it will perform reliably and predictably.
>
>  camera{location<0,.5,-6>look_at<0,.5,0>}
>
>  light_source{<0,0,-10>rgb 1}
>
>  #declare T1 =
>  texture{ pigment { gradient x+y color_map {
>  [0.00 rgb<1,1,1>][0.40 rgb<1,1,1>][0.40 rgb<1,0,0>]
>  [0.60 rgb<1,0,0>][0.60 rgb<1,1,1>][1.00 rgb<1,1,1>]}scale 0.5}
>  finish{ambient 0.35 diffuse 0.35}}
>
>  // The method you were using
>  #declare Fred1 =
>  mesh     {
>  triangle { <-1,1,0>,<0,0,0>,<1,1,0> texture{T1}}
>  triangle { <-1,1,0>,<0,2,0>,<1,1,0> texture{T1}}
>           }
>
>  // By the book method
>  #declare Fred2 =
>  union    {
>  triangle { <-1, 0.5,0>,<0,-0.5,0>,<1, 0.5,0>texture{T1}translate y*-0.5}
>  triangle { <-1,-0.5,0>,<0, 0.5,0>,<1,-0.5,0>texture{T1}translate y* 0.5}
>           }
>
>  object   { Fred1 rotate  0*y translate < 0.0,-1.75,0> }
>  object   { Fred1 rotate 45*x translate <-2.5,-1.75,0> }
>  object   { Fred1 rotate 65*y translate < 2.5,-1.75,0> }
>
>  object   { Fred2 rotate  0*y translate < 0.0, 1.75,0> }
>  object   { Fred2 rotate 45*x translate <-2.5, 1.75,0> }
>  object   { Fred2 rotate 65*y translate < 2.5, 1.75,0> }
>
>
>Regards,
>
>--
>Ken Tyler
>
>mailto://tylereng@pacbell.net


Post a reply to this message

From: Ken
Subject: Re: Meshes and Textures
Date: 29 Mar 1999 11:52:36
Message: <36FF92AE.4B39F0D0@pacbell.net>
Gordon wrote:
> 
> Thanks Ken, but I am not using unions of traingles, but a mesh object. Can
> you recast your answer to use meshes? Please don't take this the wrong way,
> but I do know about the world origin principle. The fact that the triangles
> don't touch isn't relevant. What I am doing is creating a complete mesh
> object, each of which has a texture assigned to it. Then I want to use LOTS
> of copies of that object. I would assume that like any other object type, if
> I make copies and rotate them the texture goes along.

  The point is that I don't think it will work with meshes period.
What you need is uv mapping or a similar workaround which pov does
not currently support. I may be wrong but this behavior goes back
as long as the mesh object has been in exsistance. You might take
a look at Chris Colefax's tricolor.inc file and see what he does
to apply a different color to each corner of a triangle. I haven't
looked at it myself but it may provide a clue to the  the answer
you seek.

http://www.geocities.com/SiliconValley/Lakes/1434/otherincludes.html

 Other than that I really have no more to offer. I am not trying to
be argumentative or contrary for the sake of it. I personaly feel
the behaviour you are seeing is correct for the model but I have
been wrong before and it might even happen again someday.


  On a side note there really is nothing wrong with using a union of
triangles unless you plan on making a million copies of them. They
were the only thing going before Pov v3.0x came out.

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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