POV-Ray : Newsgroups : povray.newusers : rendering edges Server Time
8 Jul 2024 02:45:32 EDT (-0400)
  rendering edges (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Mr
Subject: rendering edges
Date: 10 Aug 2009 07:55:00
Message: <web.4a8009b2789d6f5be3f0b2880@news.povray.org>
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.


Post a reply to this message

From: clipka
Subject: Re: rendering edges
Date: 10 Aug 2009 11:06:05
Message: <4a80375d$1@news.povray.org>
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.


Post a reply to this message

From: Mr
Subject: Re: rendering edges
Date: 11 Aug 2009 08:25:01
Message: <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?


Post a reply to this message

From: Chris B
Subject: Re: rendering edges
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

From: clipka
Subject: Re: rendering edges
Date: 11 Aug 2009 16:58:35
Message: <4a81db7b$1@news.povray.org>
Mr schrieb:
> 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...)

POV-Ray *only* has "faced" meshes; there's nothing it can do (natively) 
with edges anyway. Therefore of course the program you used to design 
the mesh with assumed you wanted a "faced" mesh when it exported to 
POV-Ray format.


 > 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?

No, what you'll actually need to do is traverse the list of faces, 
connecting the vertices with edge cylinders as you go along, and make 
sure to deal with duplicates (each edge will typically be listed twice) 
by either:

(a) build an edge list from the face definitions, checking for each 
additional edge whether you already encountered it (can quickly become 
quite parsing-heavy)

(b) rely on the mesh comprising a closed surface (no "open faces"), and 
be "sane" regarding inside/outside orientation (which is defined by the 
order in which the vertices are listed), so that each edge appears 
exactly twice, with opposite ordering of vertices; you can then draw the 
edge only if the first vertex index is lower than the second (or vice 
versa, at your discretion)

(c) ignore the problem of duplicate vertices, and simlpy add the 
respective cylinder twice; if they have the same texture, there 
shouldn't be a problem regarding coincident surface artifacts.


Post a reply to this message

From: Mr
Subject: Re: rendering edges
Date: 11 Aug 2009 17:15:01
Message: <web.4a81df0e4068d214e3f0b2880@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:

>
> 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.

Actually, there should'nt be any triangles since they are just extruded vertices
forming a long uninterrupted continuous series of edges like a spline without
interpolation. (hair)
 so they should'nt be arrays of 3 edges... only pairs one after the other. I
feel it should be easier to convert those to actual geometry on blender side.
but eve if I don't make it, it's not worth the effort. It's not as if hair
didn't get exported, just some of its curlyness set up into its child
particles.


Post a reply to this message

From: Chris B
Subject: Re: rendering edges
Date: 11 Aug 2009 20:09:24
Message: <4a820834$1@news.povray.org>
"Mr" <nomail@nomail> wrote in message 
news:web.4a81df0e4068d214e3f0b2880@news.povray.org...
> ...
> Actually, there should'nt be any triangles since they are just extruded 
> vertices
> forming a long uninterrupted continuous series of edges like a spline 
> without
> interpolation. (hair)
> so they should'nt be arrays of 3 edges... only pairs one after the other. 
> I
> feel it should be easier to convert those to actual geometry on blender 
> side.
> but eve if I don't make it, it's not worth the effort. It's not as if hair
> didn't get exported, just some of its curlyness set up into its child
> particles.
>

Ah! Ok. My first assumption was all wrong then.

There definitely are triangular faces in the file snippet you posted, 
although it's not possible to see whether the triangles are degenerate, 
because you only show the first vertex and I'd need to see the first 3 
vertices to be able to say whether the first triangle is degenerate (two or 
more vertices in the same place).

I now assume you're creating a surface and extruding the vertices in 
Blender, then exporting as an 'obj' file that you convert to POV-Ray using 
the excellent PoseRay utility written by FlyerX.

If this new assumption is correct, then the sample you posted must have 
contained some sort of surface defined in Blender when you exported it, 
otherwise you wouldn't get any faces in the mesh2 object.

When you export to Wavefront-obj format from Blender, the generated 'obj' 
file contains a set of 3 and/or 4 sided faces to represent surfaces and a 
series of 2-sided faces for the straight-line segments.  If you then convert 
this to POV-Ray using the PoseRay utility that FlyerX wrote, it converts any 
3 and 4 sided faces into triangular faces within a mesh2 object and ignores 
the 2-sided faces. This means that any 'hairs' created as extruded vertices 
forming a "long uninterrupted continuous series of edges" will be lost and 
you will end up with only the original surface from which they were 
extruded.

The good news is that the 'obj' file format can give you the 'edge' data you 
would need to reconstruct the 'hairs' in POV-Ray. To display these in 
POV-Ray you'll need a script to go through the 'obj' file looking for 
2-sided face definitions and adding a POV-Ray cylinder to represent each 
'edge'. Here's a simple 'obj' file I exported from Blender, having created a 
4-sided face (a plane) and extruded the 4 vertices. I then extruded the 
first of those 4 vertices a second time (f 9 5) giving a total of 5 edges.

# Blender3D v248 OBJ File: linetest2.obj.blend
# www.blender3d.org
mtllib linetest2.mtl
v 0.970005 -0.000000 -1.014998
v 0.970005 0.000000 0.985002
v -1.029996 0.000000 0.985002
v -1.029995 -0.000000 -1.014998
v 2.334797 -0.000000 -2.424784
v 0.445084 0.000000 1.599909
v -1.554916 0.000000 1.599909
v -1.554915 -0.000000 -0.400091
v 3.969549 -0.000000 -3.174670
usemtl (null)
s off
f 1 4 3 2
f 1 5
f 2 6
f 3 7
f 4 8
f 9 5

The 'obj' file shows the resulting 9 vertices. The 4-sided face uses 
vertices 1, 4, 3 and 2 and the five extruded 'hairs' are each represented as 
a 2-sided face. Writing a simple script to create a set of straight-line 
cylinders to represent these Blender 'edges' should be fairly 
straight-forward. If you wanted to get more sophisticated it would be 
possible to match up adjacent 'edges' to create a nice smooth spline, but 
this is likely to be significantly more complex.


If you used some other way to generate the code snippet you posted, then it 
is possible that it contains a sequence of degenerate triangles representing 
just the 'edges' (the 'hairs'). This would need a different solution to be 
able to see make it visible in a POV-Ray scene.

Regards,
Chris B.


Post a reply to this message

From: Mr
Subject: Re: rendering edges
Date: 14 Aug 2009 09:55:00
Message: <web.4a856c494068d214e3f0b2880@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> "Mr" <nomail@nomail> wrote in message
> news:web.4a81df0e4068d214e3f0b2880@news.povray.org...
> > ...
> > Actually, there should'nt be any triangles since they are just extruded
> > vertices
> > forming a long uninterrupted continuous series of edges like a spline
> > without
> > interpolation. (hair)
> > so they should'nt be arrays of 3 edges... only pairs one after the other.
> > I
> > feel it should be easier to convert those to actual geometry on blender
> > side.
> > but eve if I don't make it, it's not worth the effort. It's not as if hair
> > didn't get exported, just some of its curlyness set up into its child
> > particles.
> >
>
> Ah! Ok. My first assumption was all wrong then.
>
> There definitely are triangular faces in the file snippet you posted,
> although it's not possible to see whether the triangles are degenerate,
> because you only show the first vertex and I'd need to see the first 3
> vertices to be able to say whether the first triangle is degenerate (two or
> more vertices in the same place).
>
> I now assume you're creating a surface and extruding the vertices in
> Blender, then exporting as an 'obj' file that you convert to POV-Ray using
> the excellent PoseRay utility written by FlyerX.
>
> If this new assumption is correct, then the sample you posted must have
> contained some sort of surface defined in Blender when you exported it,
> otherwise you wouldn't get any faces in the mesh2 object.
>
> When you export to Wavefront-obj format from Blender, the generated 'obj'
> file contains a set of 3 and/or 4 sided faces to represent surfaces and a
> series of 2-sided faces for the straight-line segments.  If you then convert
> this to POV-Ray using the PoseRay utility that FlyerX wrote, it converts any
> 3 and 4 sided faces into triangular faces within a mesh2 object and ignores
> the 2-sided faces. This means that any 'hairs' created as extruded vertices
> forming a "long uninterrupted continuous series of edges" will be lost and
> you will end up with only the original surface from which they were
> extruded.
>
> The good news is that the 'obj' file format can give you the 'edge' data you
> would need to reconstruct the 'hairs' in POV-Ray. To display these in
> POV-Ray you'll need a script to go through the 'obj' file looking for
> 2-sided face definitions and adding a POV-Ray cylinder to represent each
> 'edge'. Here's a simple 'obj' file I exported from Blender, having created a
> 4-sided face (a plane) and extruded the 4 vertices. I then extruded the
> first of those 4 vertices a second time (f 9 5) giving a total of 5 edges.
>
> # Blender3D v248 OBJ File: linetest2.obj.blend
> # www.blender3d.org
> mtllib linetest2.mtl
> v 0.970005 -0.000000 -1.014998
> v 0.970005 0.000000 0.985002
> v -1.029996 0.000000 0.985002
> v -1.029995 -0.000000 -1.014998
> v 2.334797 -0.000000 -2.424784
> v 0.445084 0.000000 1.599909
> v -1.554916 0.000000 1.599909
> v -1.554915 -0.000000 -0.400091
> v 3.969549 -0.000000 -3.174670
> usemtl (null)
> s off
> f 1 4 3 2
> f 1 5
> f 2 6
> f 3 7
> f 4 8
> f 9 5
>
> The 'obj' file shows the resulting 9 vertices. The 4-sided face uses
> vertices 1, 4, 3 and 2 and the five extruded 'hairs' are each represented as
> a 2-sided face. Writing a simple script to create a set of straight-line
> cylinders to represent these Blender 'edges' should be fairly
> straight-forward. If you wanted to get more sophisticated it would be
> possible to match up adjacent 'edges' to create a nice smooth spline, but
> this is likely to be significantly more complex.
>
>
> If you used some other way to generate the code snippet you posted, then it
> is possible that it contains a sequence of degenerate triangles representing
> just the 'edges' (the 'hairs'). This would need a different solution to be
> able to see make it visible in a POV-Ray scene.
>
> Regards,
> Chris B.

Thanks For this very well explained tip on faceless edges in obj format.
Although I'm using Blend2Pov instead of the Obj export, the problem seems to be
much more simple: after checking up again, what I had copied was another mesh
of the scene. The faceless mesh didn't get  exported at all.


Post a reply to this message

From: Chris B
Subject: Re: rendering edges
Date: 14 Aug 2009 10:58:07
Message: <4a857b7f$1@news.povray.org>
"Mr" <nomail@nomail> wrote in message 
news:web.4a856c494068d214e3f0b2880@news.povray.org...
>
> Thanks For this very well explained tip on faceless edges in obj format.
> Although I'm using Blend2Pov instead of the Obj export, the problem seems 
> to be
> much more simple: after checking up again, what I had copied was another 
> mesh
> of the scene. The faceless mesh didn't get  exported at all.
>

Ah ok! So my second guess was wrong too then :-)

I didn't know about Blend2Pov. That looks like a very interesting project. 
It looks as though it will generate more than just mesh2 objects, but I 
didn't find anything describing what it does with Blender edges that don't 
form part of a face. Is there a document somewhere to describe what it 
generates?

Regards,
Chris B.


Post a reply to this message

From: Mr
Subject: Re: rendering edges
Date: 14 Aug 2009 13:40:00
Message: <web.4a85a04f4068d214e3f0b2880@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> "Mr" <nomail@nomail> wrote in message
> news:web.4a856c494068d214e3f0b2880@news.povray.org...
> >
> > Thanks For this very well explained tip on faceless edges in obj format.
> > Although I'm using Blend2Pov instead of the Obj export, the problem seems
> > to be
> > much more simple: after checking up again, what I had copied was another
> > mesh
> > of the scene. The faceless mesh didn't get  exported at all.
> >
>
> Ah ok! So my second guess was wrong too then :-)
>
> I didn't know about Blend2Pov. That looks like a very interesting project.
> It looks as though it will generate more than just mesh2 objects, but I
> didn't find anything describing what it does with Blender edges that don't
> form part of a face. Is there a document somewhere to describe what it
> generates?
>
> Regards,
> Chris B.

No document, I don't know how the original patch by RCRuiz is commented:
http://code.google.com/p/blend2pov/
JMS won't release the current modified source, but I'll just ask him about those
faceless edges. If you speak french and are interested in this tool here is the
forum of JMS.
http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Pov-Ray


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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