POV-Ray : Newsgroups : povray.newusers : mesh of triangles: how to specify the back side? Server Time
28 Jul 2024 16:32:44 EDT (-0400)
  mesh of triangles: how to specify the back side? (Message 1 to 9 of 9)  
From: MelR
Subject: mesh of triangles: how to specify the back side?
Date: 13 Mar 2009 01:40:00
Message: <web.49b9f076390cef57cc96b2a20@news.povray.org>
How do you make a mesh of triangles with one set of textures on one side, and an
entirely different set of textures on the other side.  The mesh does NOT make an
enclosing surface (it is not a shape with an inside and an outside).

For purpose of this discussion, you can consider the mesh to represent a
rectangle oriented in space.  As part of this simplified example. I'd like one
side to be red and the other side blue.  How is this specified?

(If you have a link to where this has already been discussed, or you can suggest
search terms that will lead to the answer, such help is also greatly
appreciated.)

Thank you for your help!


Post a reply to this message

From: Mike Williams
Subject: Re: mesh of triangles: how to specify the back side?
Date: 13 Mar 2009 04:34:09
Message: <3IA7E0A9phuJFwYk@econym.demon.co.uk>
Wasn't it MelR who wrote:
>How do you make a mesh of triangles with one set of textures on one 
>side, and an
>entirely different set of textures on the other side.  The mesh does 
>NOT make an
>enclosing surface (it is not a shape with an inside and an outside).
>
>For purpose of this discussion, you can consider the mesh to represent a
>rectangle oriented in space.  As part of this simplified example. I'd like one
>side to be red and the other side blue.  How is this specified?
>
>(If you have a link to where this has already been discussed, or you 
>can suggest
>search terms that will lead to the answer, such help is also greatly
>appreciated.)
>
>Thank you for your help!

The documentation says:

All surfaces have an exterior and interior surface. The interior_texture 
simply allows to specify a separate texture for the interior surface of 
the object. For objects with no well defined inside/outside 
(bicubic_patch, triangle, ...) the interior_texture is applied to the 
backside of the surface. Interior surface textures use exactly the same 
syntax and should work in exactly the same way as regular surface 
textures, except that they use the keyword interior_texture instead of 
texture.

Note: Do not confuse interior_texture {} with interior {}: the first one 
specifies surface properties, the second one specifies volume 
properties.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Chris B
Subject: Re: mesh of triangles: how to specify the back side?
Date: 13 Mar 2009 05:20:10
Message: <49ba254a$1@news.povray.org>
"Mike Williams" <nos### [at] econymdemoncouk> wrote in message 
news:3IA### [at] econymdemoncouk...
> Wasn't it MelR who wrote:
>>How do you make a mesh of triangles with one set of textures on one side, 
>>and an
>>entirely different set of textures on the other side.  The mesh does NOT 
>>make an
>>enclosing surface (it is not a shape with an inside and an outside).
>  ... snip ...
> All surfaces have an exterior and interior surface. The interior_texture 
> simply allows to specify a separate texture for the interior surface of 
> the object. ... snip ...

Yes. What Mike said. So long as the mesh normals are correctly defined you 
can apply one texture to the inside and one to the outside, and this can be 
a complex layered texture, if that's what you mean by a 'set of textures'.

If you mean a set of uv-mapped textures (map different textures to different 
parts of the mesh) then I think you can only uv-map the outside surface. 
There are still some 'tricks' you may be able to use to get round this 
limitation if this is what you want to do.

Regards,
Chris B.


Post a reply to this message

From: Leroy Whetstone
Subject: Re: mesh of triangles: how to specify the back side?
Date: 13 Mar 2009 14:45:45
Message: <49BAA989.4090101@joplin.com>
I'd put the inside_vector at the rough center of the Mesh.
Then use:
   texture {TEXTURE Blue}
   interior_texture {TEXTURE Red}

If the normals of all the triangles point away from the inside_vector 
then the outside will be Blue and the other side Red.
If some of the triangle normals point toward the inside_vector then the 
textures will be reversed.
Both can be used, it depends on what effect you want.

So the NORMAL of each triangle controls how the textures are placed.
The way a triangle is made will effect the normal. Triangle <A,B,C> will
have a different normal the the same Triangle <A,C,B>. What is neat is 
that those normal vectors will be exactly oppsite. So if a triangle's 
normal is pointing the wrong direction all you have to do is trade B&C.
The fun part,in a large mesh of triangles,is finding the BAD triangle.

Using <A,B,C>, the formula to calculate a normal:
       Normal = vcross(A-C,A-B);

Hope this helps.

Have Fun!


Post a reply to this message

From: MelR
Subject: Re: mesh of triangles: how to specify the back side?
Date: 13 Mar 2009 20:50:00
Message: <web.49bafe1a41fc54a2aa31c2b90@news.povray.org>
Thank you to all who replied.  Leroy, how a normal is defined by the given
sequence of triangle corners is something I've been looking for and have not
previously been able to find.  Your definition is clear except for one detail:
is the vector cross product a right or left-handed operation?  (Based on my
limited familiarity with povray, I'm assuming it is a left-handed operation
unless "right" has been specified, but I'm not certain.)

I will try the texture definitions as you've described.  Here, too, I've not
been successful in discovering where in the documentation these issues are
clearly discussed as they relate to triangles with both front and back textures
as part of a mesh.  I appreciate your effort to address this directly.

So far I have been using (flat) triangles and not "smooth triangles".  In my
efforts to far, povray has detected some compilation?/syntax? errors, but I
don't know yet if these are due to errors in my expressions or errors in my
understanding as to how an interior_texture applies to a (flat) triangle.  If
you are aware that these discussion do not apply to a (flat) triangle and I
must use a "smooth triangle" instead, please let me know.

I appreciate your assistance.
Mel



Leroy Whetstone <lrw### [at] joplincom> wrote:
> I'd put the inside_vector at the rough center of the Mesh.
> Then use:
>    texture {TEXTURE Blue}
>    interior_texture {TEXTURE Red}
>
> If the normals of all the triangles point away from the inside_vector
> then the outside will be Blue and the other side Red.
> If some of the triangle normals point toward the inside_vector then the
> textures will be reversed.
> Both can be used, it depends on what effect you want.
>
> So the NORMAL of each triangle controls how the textures are placed.
> The way a triangle is made will effect the normal. Triangle <A,B,C> will
> have a different normal the the same Triangle <A,C,B>. What is neat is
> that those normal vectors will be exactly oppsite. So if a triangle's
> normal is pointing the wrong direction all you have to do is trade B&C.
> The fun part,in a large mesh of triangles,is finding the BAD triangle.
>
> Using <A,B,C>, the formula to calculate a normal:
>        Normal = vcross(A-C,A-B);
>
> Hope this helps.
>
> Have Fun!


Post a reply to this message

From: clipka
Subject: Re: mesh of triangles: how to specify the back side?
Date: 14 Mar 2009 12:05:00
Message: <web.49bbd54941fc54a24c2c4c080@news.povray.org>
"MelR" <nomail@nomail> wrote:
> For purpose of this discussion, you can consider the mesh to represent a
> rectangle oriented in space.  As part of this simplified example. I'd like one
> side to be red and the other side blue.  How is this specified?

Front/Back is controlled by the order in which you specify the corner points. So
given a triangle with the corner points A,B and C, the following are equivalent:

  triangle { A, B, C }
  triangle { B, C, A }
  triangle { C, A, B }

while these have front and back flipped:

  triangle { C, B, A }
  triangle { B, A, C }
  triangle { A, C, B }

I'm not sure right now whether the side from which the points appear to be
arranged clockwise is the front or the back - I'd have to test; I can also
imagine that it differs depending on whether you use a left- or right-handed
co-ordinate system. However, it will be consistent throughout your scene
(unless you use mirroring transformations of course).

Specifying the different colors is done using "texture" and "inside_texture",
even if your mesh is not fully closed and therefore does not have an "inside"
in the strict sense.

Note that within a single mesh object, you can only specify a single front/back
texture pair. Any texture specified for an individual mesh triangle (or even
vertex) will be applied to both sides (POV doesn't accept "inside_texture" at
this level), and override both any "texture" and "inside_texture" statements at
mesh object level.


Post a reply to this message

From: clipka
Subject: Re: mesh of triangles: how to specify the back side?
Date: 14 Mar 2009 13:55:00
Message: <web.49bbeef241fc54a24c2c4c080@news.povray.org>
Leroy Whetstone <lrw### [at] joplincom> wrote:
> I'd put the inside_vector at the rough center of the Mesh.

The inside_vector is just a direction, not a point, so you can't "put it at the
rough center of the mesh".

It's the direction in which POV shoots a ray from points to test whether they
are inside the mesh or not (which is something POV needs for CSG).
Theoretically, any direction should do for a closed mesh, but it's exposed to
the user to allow for tweaking in case artifacts show up. As a matter of fact,
it doesn't make sense to specify it at all for a non-closed mesh.


Post a reply to this message

From: Leroy Whetstone
Subject: Re: mesh of triangles: how to specify the back side?
Date: 14 Mar 2009 14:08:08
Message: <49BBF238.2040504@joplin.com>
MelR wrote:
> Thank you to all who replied.  Leroy, how a normal is defined by the given
> sequence of triangle corners is something I've been looking for and have not
> previously been able to find.  Your definition is clear except for one detail:
> is the vector cross product a right or left-handed operation?  (Based on my
> limited familiarity with povray, I'm assuming it is a left-handed operation
> unless "right" has been specified, but I'm not certain.)

To tell the truth I don't know. I could never get my head around left or 
right handed operation when turning it into code. I remember spining a 
day or so playing with my figers,tring to turn them into triangles. It 
was silly. I said to myself forget it, the code it what I need. So by 
trial and error I got the code I needed for normals.
  Going over my old code I think with a triangle laying flat in the y=0 
plane that starting at one point and going anticlockwise gathering 
points the normal will point in the positive y direction.

> 
> I will try the texture definitions as you've described.  Here, too, I've not
> been successful in discovering where in the documentation these issues are
> clearly discussed as they relate to triangles with both front and back textures
> as part of a mesh.  I appreciate your effort to address this directly.
> 
3.4.2.3.1  Solid Mesh  in pov help file has a little.
I know there are some web sites out there that can be of help but I lost 
all my bookmarks in a computer meltdown, sorry.

> So far I have been using (flat) triangles and not "smooth triangles".  In my
> efforts to far, povray has detected some compilation?/syntax? errors, but I
> don't know yet if these are due to errors in my expressions or errors in my
> understanding as to how an interior_texture applies to a (flat) triangle.  If
> you are aware that these discussion do not apply to a (flat) triangle and I
> must use a "smooth triangle" instead, please let me know.
> 
The most common error with Mesh is dropping commas. When you drop one 
inside a vector sometimes, not always, Pov will expand the vector. That 
is if ya have <4.5,6.7> you'll get <4.5,6.7,0>.

There no difference when it comes to inside_vector between Flat and 
smooth triangle meshs.


Have Fun!













> I appreciate your assistance.
> Mel
>


Post a reply to this message

From: Leroy Whetstone
Subject: Re: mesh of triangles: how to specify the back side?
Date: 16 Mar 2009 14:38:30
Message: <49BE9C53.8080004@joplin.com>
Your Right!
  I was shooting from the hip.
Some times when you shoot that way ya hit the baby. :)


Post a reply to this message

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