POV-Ray : Newsgroups : povray.general : Help - using rgb colors with triangles Server Time
5 Nov 2024 09:23:13 EST (-0500)
  Help - using rgb colors with triangles (Message 1 to 10 of 17)  
Goto Latest 10 Messages Next 7 Messages >>>
From: David Arcoleo
Subject: Help - using rgb colors with triangles
Date: 18 Jun 1999 17:21:17
Message: <376AB846.B4E3005A@njmedicine.com>
Hi all, I'm writing an application that takes graphs in Mathematica and
converts them to povray source.  I construct the objects using triangles
and am including an option to do an exact color match.  How do I give a
triangle an rgb?  Everything I try doesn't seem to work.

Thanks,
-Dave


Post a reply to this message

From: Ken
Subject: Re: Help - using rgb colors with triangles
Date: 18 Jun 1999 20:51:20
Message: <376AE69B.B42DCC46@pacbell.net>
David Arcoleo wrote:
> 
> Hi all, I'm writing an application that takes graphs in Mathematica and
> converts them to povray source.  I construct the objects using triangles
> and am including an option to do an exact color match.  How do I give a
> triangle an rgb?  Everything I try doesn't seem to work.
> 
> Thanks,
> -Dave

There are a couple ways of adding pigments to triangles.

 Both you can do with and without the union or mesh wrapper -

  union  {
triangle { <...>,<...>,<...> pigment { rgb<...> }}
triangle { <...>,<...>,<...> pigment { rgb<...> }}
triangle { <...>,<...>,<...> pigment { rgb<...> }}
triangle { <...>,<...>,<...> pigment { rgb<...> }}
         }

or

#declare T1 = texture { pigment { rgb<...> }}
#declare T2 = texture { pigment { rgb<...> }}
#declare T3 = texture { pigment { rgb<...> }}
#declare T4 = texture { pigment { rgb<...> }}

    mesh {
triangle { <...>,<...>,<...> texture {T1}}
triangle { <...>,<...>,<...> texture {T2}}
triangle { <...>,<...>,<...> texture {T3}}
triangle { <...>,<...>,<...> texture {T4}}
         }





-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Nieminen Mika
Subject: Re: Help - using rgb colors with triangles
Date: 19 Jun 1999 11:16:56
Message: <376bb468@news.povray.org>
The mesh version is more recommendable since meshes render much faster
than a union of triangles.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: David Arcoleo
Subject: Re: Help - using rgb colors with triangles
Date: 19 Jun 1999 18:02:52
Message: <376C1384.268BF03B@njmedicine.com>
> #declare T1 = texture { pigment { rgb<...> }}
> #declare T2 = texture { pigment { rgb<...> }}
> #declare T3 = texture { pigment { rgb<...> }}
> #declare T4 = texture { pigment { rgb<...> }}
> 
>     mesh {
> triangle { <...>,<...>,<...> texture {T1}}
> triangle { <...>,<...>,<...> texture {T2}}
> triangle { <...>,<...>,<...> texture {T3}}
> triangle { <...>,<...>,<...> texture {T4}}
>          }
> 

Thank you.  I already have everything in a mesh, and it is more
efficient that way.  However, because I'm using tens/hundreds of
thousands of triangles (I'm converting Mathematica-based graphics to
povray) I would like to be able to define the pigment on the same line
as the triangle, and thus avoid #declaring thousands of textures.  Is
this possible in a mesh?

-Dave


Post a reply to this message

From: Ken
Subject: Re: Help - using rgb colors with triangles
Date: 19 Jun 1999 20:53:22
Message: <376C3899.B9FFCF9B@pacbell.net>
David Arcoleo wrote:
> 
> > #declare T1 = texture { pigment { rgb<...> }}
> > #declare T2 = texture { pigment { rgb<...> }}
> > #declare T3 = texture { pigment { rgb<...> }}
> > #declare T4 = texture { pigment { rgb<...> }}
> >
> >     mesh {
> > triangle { <...>,<...>,<...> texture {T1}}
> > triangle { <...>,<...>,<...> texture {T2}}
> > triangle { <...>,<...>,<...> texture {T3}}
> > triangle { <...>,<...>,<...> texture {T4}}
> >          }
> >
> 
> Thank you.  I already have everything in a mesh, and it is more
> efficient that way.  However, because I'm using tens/hundreds of
> thousands of triangles (I'm converting Mathematica-based graphics to
> povray) I would like to be able to define the pigment on the same line
> as the triangle, and thus avoid #declaring thousands of textures.  Is
> this possible in a mesh?
> 
> -Dave

No I am afraid that simply is just not possible.

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Glen Berry
Subject: Re: Help - using rgb colors with triangles
Date: 19 Jun 1999 22:00:15
Message: <376d4a12.26452409@news.povray.org>
On Sat, 19 Jun 1999 17:40:57 -0700, Ken <tyl### [at] pacbellnet> wrote:
>
>David Arcoleo wrote:
>> 
>> Thank you.  I already have everything in a mesh, and it is more
>> efficient that way.  However, because I'm using tens/hundreds of
>> thousands of triangles (I'm converting Mathematica-based graphics to
>> povray) I would like to be able to define the pigment on the same line
>> as the triangle, and thus avoid #declaring thousands of textures.  Is
>> this possible in a mesh?
>> 
>> -Dave
>
>No I am afraid that simply is just not possible.

Why not? I have seen mesh files where each triangle had a unique
pigment definition. Each line of the mesh file had a triangle
definition followed by a pigment definition. This makes for a much
larger mesh file, and it takes longer to parse than an uncolored mesh,
but it does work. One doesn't *have* to #declare pigments or textures
in advance if using something like "rgb <0.8, 0.4, 0.2>" to define the
colors on each line is acceptable.

Later,
Glen Berry


Post a reply to this message

From: Ken
Subject: Re: Help - using rgb colors with triangles
Date: 19 Jun 1999 22:12:15
Message: <376C4B14.F36F08AE@pacbell.net>
Glen Berry wrote:

> >No I am afraid that simply is just not possible.
> 
> Why not? I have seen mesh files where each triangle had a unique
> pigment definition. Each line of the mesh file had a triangle
> definition followed by a pigment definition. This makes for a much
> larger mesh file, and it takes longer to parse than an uncolored mesh,
> but it does work. One doesn't *have* to #declare pigments or textures
> in advance if using something like "rgb <0.8, 0.4, 0.2>" to define the
> colors on each line is acceptable.
> 
> Later,
> Glen Berry

Sorry you are wrong this time and I jsut tried it to make sure of my earlier
statment.

===> From the docs:
  Any number of triangle and/or smooth_triangle statements can be used and
each of those triangles can be individually textured by assigning a texture
identifier to it. The texture has to be declared before the mesh is parsed.
It is not possible to use texture definitions inside the triangle or smooth
triangle statements. This is a restriction that is necessary for an efficient
storage of the assigned textures. See " Triangle and Smooth Triangle" for
more information on triangles.

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Ken
Subject: Re: Help - using rgb colors with triangles
Date: 20 Jun 1999 02:33:58
Message: <376C886B.FA6393F0@pacbell.net>
Nieminen Mika wrote:
> 
>   The mesh version is more recommendable since meshes render much faster
> than a union of triangles.


I disagree with your statement. I just ran three tests of unions vs. meshs
of triangles and the unions in all three cases parsed and rendered faster.
Meshs seem to only have the advantage of memory optimization when using
multiple copies of the same mesh object.

Triangle object 1 - 200 triangles

union parse   render
       0      22 sec
mesh   0      26 sec

Triangle object 2 - 1000 triangles

      parse   render
union  2      25 sec
mesh   2      30 sec

Triangle object 3 - 6000 triangles

      parse   render
union   9     32 sec
mesh   10     39 sec


-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Nieminen Mika
Subject: Re: Help - using rgb colors with triangles
Date: 20 Jun 1999 04:09:39
Message: <376ca1c3@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
: I disagree with your statement. I just ran three tests of unions vs. meshs
: of triangles and the unions in all three cases parsed and rendered faster.
: Meshs seem to only have the advantage of memory optimization when using
: multiple copies of the same mesh object.

  This test seems extremely strange since my experience states the contrary.
  The lparser program produces a union of triangles. The parsing time
usually blows up in the "creating light buffers" stage (several minutes
in my old 486; not tested in my new P-II). Substituting "union" with "mesh"
reduced that stage to seconds.
  Also the faster rendering time seems strange since AFAIK povray generates
an efficient octree (or a similar data structure) from the mesh while it
can't do that with a union of objects. Testing ray-triangle intersections
is much more faster with that kind of data structure.
  I have to test this by myself...

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Nieminen Mika
Subject: Re: Help - using rgb colors with triangles
Date: 20 Jun 1999 04:13:41
Message: <376ca2b5@news.povray.org>
Glen Berry <7no### [at] ezwvcom> wrote:
: Why not? I have seen mesh files where each triangle had a unique
: pigment definition. Each line of the mesh file had a triangle
: definition followed by a pigment definition. This makes for a much
: larger mesh file, and it takes longer to parse than an uncolored mesh,
: but it does work. One doesn't *have* to #declare pigments or textures
: in advance if using something like "rgb <0.8, 0.4, 0.2>" to define the
: colors on each line is acceptable.

  As Ken replied, it's not possible.
  However, I can hardly believe that you had to declare a pigment for each
triangle. I don't think each triangle has a unique color. Those meshes you
are describing sound to me like they had just a few hundreds of colors.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

Goto Latest 10 Messages Next 7 Messages >>>

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