POV-Ray : Newsgroups : povray.general : Mesh problem... Server Time
2 Nov 2024 15:26:44 EDT (-0400)
  Mesh problem... (Message 1 to 3 of 3)  
From: Yansen
Subject: Mesh problem...
Date: 23 Feb 2004 06:04:33
Message: <4039de41@news.povray.org>
Hello.
I wrote a program that export geometry to POV file and I have a problem.
POV-Ray want something like that:

#declare Red = texture {
    pigment { color rgb<1.0, 0.0, 0.0> }
    finish { ambient 0.2 diffuse 0.5 }
  } 
mesh {
   triangle {<0, 0, 0>, <0, 10, 0>, <10, 0, 0>
   texture { Red }
  }  
 texture {
  pigment { color rgb<0.9, 0.9, 0.9> }
  finish { ambient 0.2 diffuse 0.7 }
 }}
and I don't like this becouse that mean I must know color of my triangle BEFORE i
create geometry. What I wana do is somthing similar to OpenGL commands:
glBegin(GL_TRIANGLES);
 glColor3f(something...);glNormal3f(something...);glVertex3f(something...);
 glColor3f(something...);glNormal3f(something...);glVertex3f(something...);
 glColor3f(something...);glNormal3f(something...);glVertex3f(something...);
glEnd(); 
Which mean I have color, and normal vector assigned to each vertex. How to do
something like that in POV-Ray? If someone can give me simple answer (witch mean
simple code :-) ) I be greatful.

Yansen.
PS Sorry for may poor english skill...


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: Mesh problem...
Date: 23 Feb 2004 06:56:40
Message: <4039ea78$1@news.povray.org>
> I wrote a program that export geometry to POV file and I have a problem.
> POV-Ray want something like that:
SNIP

You don't have to supply a texture for each triangle. That's optional. The
untextured triangles will then just inherit the texture applied to the mesh,
so that'd be
mesh{ triangle{...} texture{...}}
instead of
mesh{ triangle{... texture{...}} texture{...}}

Additionally, for your normal vectors, there's smooth_triangle, which
requires 6 instead of 3 vectors:
smooth_triangle{
Corner_1, Normal_Vector_1,
Corner_2, Normal_Vector_2,
Corner_3, Normal_Vector_3
}

But that's all in the docs, just read more carefully. :-)

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Email: tim.nikias (@) nolights.de


Post a reply to this message

From: Warp
Subject: Re: Mesh problem...
Date: 23 Feb 2004 08:07:49
Message: <4039fb25@news.povray.org>
By the way, I suggest taking a look at the mesh2 syntax in the
documentation.
  Besides being more compact than 'mesh', it may in many cases be more
handy way of writing the mesh from a program.
  Vertices, (optional) normal vectors, (optional) uv-vectors and (optiona)
textures are written separately before anything else, after which the
face (ie. triangle) information is written. If triangles need separate
textures (or even if each vertex of each triangle needs a separate
texture) you can write them as simple index values to the textures
(instead of writing the textures themselves along with the triangles).

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

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