POV-Ray : Newsgroups : povray.general : any hidden line rendering api? : Re: any hidden line rendering api? Server Time
29 Jul 2024 22:31:47 EDT (-0400)
  Re: any hidden line rendering api?  
From: clipka
Date: 23 Dec 2010 20:06:45
Message: <4d13f225$1@news.povray.org>
Am 23.12.2010 23:44, schrieb optima:

> I dont necessarily have to use povray to accomplish this goal, povray is already
> doing the heavy lifting by producing beautiful 3d textured images.
> I just need a way to produce simple(?) hidden lines of models as depicted in
> some images I posted.

Then maybe you're better off asking for this in a XNA forum?

I have no idea what tools XNA provides in this respect; but if I had to 
design an outlining algorithm, I'd proceed as follows:

(1) For each triangle of the mesh, determine the three adjacent triangles.

(2) Draw all the triangles in Z-order (or using a Z-buffer) as follows:

- draw the triangle itself in plain white

- for each of the three edges, examining the neighbor triangle

- if any neighbor triangle is missing, draw the respective edge in plain 
black (this draws the "rim" of non-closed meshes)

- if the dot product of the viewing direction and the surface normal of 
a neighbor triangle has a different sign than the same value for the 
current triangle, draw the respective edge in plain black (this draws 
the outline of the mesh)

- if the dot product of the neighbor triangle's and current triangle's 
normalized suface normals is below a certain threshold, draw the 
respective edge in plain black or grey (this draws sharp edges)

This would normally require a mix of triangle-based and wireframe-based 
rendering; in case XNA doesn't provide such a mode, you could work 
around by implementing a pixel shader that colors the pixels depending 
on the distance to the edge(s) that need to have a line drawn. You might 
need to do the triangle examination beforehand though, and mark the 
respective vertices, too, to avoid artifacts near the vertices.


Post a reply to this message

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