POV-Ray : Newsgroups : povray.newusers : rendering edges : Re: rendering edges Server Time
6 Oct 2024 02:41:37 EDT (-0400)
  Re: rendering edges  
From: Chris B
Date: 11 Aug 2009 11:14:40
Message: <4a818ae0$1@news.povray.org>
"Mr" <nomail@nomail> wrote in message 
news:web.4a8161934068d214e3f0b2880@news.povray.org...
> clipka <ano### [at] anonymousorg> wrote:
>> Mr schrieb:
>> > What's the easiest way to render faceless edges and give them any 
>> > material or
>> > texture.
>> > Best would be if the solution allows me to insert its code into the 
>> > object block
>> > because of the way the exporter works.
>>
>> Usually thin cylinders are used for this purpose, combined with spheres
>> at the vertices to prevent artifacts.
>
> Hmm... but how can I find the right vertices pairs in such an output mesh:
>
>
> vertex_vectors {1108,<-0.0582308,0.879374,-0.00541553>,[ETC...] }
> normal_vectors {1108,<-0.489174,-0.0570892,0.870316>,[ETC...]}
> face_indices 
> {2208,<0,1,2>,<2,3,0>,<4,5,6>,<6,7,4>,<8,9,10>,<11,12,13>,[ETC...]
> normal_indices { 2208,<0,1,2>,<2,3,0>,<4,5,6>,<6,7,4>,<8,9,10>,[ETC...]}
>
>
> (I don't get why there are face indices whereas the mesh is only edges but
> anyway...) Should I assume that vertices are exported consecutively on a 
> same
> edgeloop? Since I have a constant n number of verts over these edgeloops 
> should
> I chop these coordinates by such amounts of n vectors to use in 
> spheresweeps?

I get the impression that you're asking about rendering a sort of wire-frame 
view of the mesh2 object where the edges are shown, but where the faces are 
not. This is not all that straight-forward because, when adding a mesh or 
mesh2 object to a scene POV-Ray draws triangular faces to construct the 
surface of the object. The face data contains values which index the vertex 
data to tell it where to draw each triangular face, so the first face in 
your example <0,1,2> uses the first three vectors defined as vertex_vectors 
etc. Edges don't really come into it in any direct way when you simply 
render such an object.

If you do want to create a sort of wire-frame view, then the easiest way is 
probably to #declare the vertices and the faces as two arrays of 3-element 
vectors:

#declare MyVectors = array [1108] 
{<-0.0582308,0.879374,-0.00541553>,[ETC...] };
#declare MyFaces = array [2208] 
{<0,1,2>,<2,3,0>,<4,5,6>,<6,7,4>,<8,9,10>,<11,12,13>,[ETC...]};

Then you can quite easily loop through the faces and draw 3 cylinders for 
each edge of each triangular face, giving those cylinders more or less any 
texture you want.

If this is what you want to do then I'd be happy to post an example of a 
simple #while loop that would do this sort of thing for you.

Regards,
Chris B.


Post a reply to this message

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