Re: glClipPlane precision
- From: "Dave Eberly" <dNOSPAMeberly@xxxxxxxxxxxxxxx>
- Date: Wed, 19 Apr 2006 20:19:50 GMT
"John Irwin" <no.spam@xxxxxxxxx> wrote in message
news:44468A9E.4B645FC8@xxxxxxxxxxxx
By 'vertex program' do you mean use vertex arrays or use a vertex
shader? You probably have the latter in mind but, unfortunately, my
graphics hardware does not support such things. Maybe I should have
mentioned I am only working with OpenGL upto version 1.2.
Yes, I am referring to vertex shaders.
Can shaders be use in software?
Not clear where you are headed with this. Do you mean
will something like Mesa work? As long as it supports the
shader programming extensions, sure. Given your later
comments about concern for performance, I doubt you
would want to do this in software. (For large data sets
like you have, my shader-based software renderer performance
is measured in seconds-per-frame, not frames-per-second :)
I've tried a vertex array in conjunction with a 1D-texture coordinate
array and 2-colour texture map (a la toon shading) but I found my
application slowed down more than I was happy with. My ellipsoids are
modelled at quite a high resolution for smoothness (about 10,000
vertices each) and there are typically about a dozen or more ellipsoids
in a scene. This means there are something like 150,000 texture
coordinates to calculate per frame in software. Reducing the resolution
helps but then the underlying geometry begins to show along the
lit/unlit line. Just letting OpenGL clip the geometry (twice) seems to
be a lot faster, which is why I'd perfer to stick with the glClipPlane
approach is at all possible.
Maybe I misunderstand your set up. It seems to me that the
precision issue with glClipPlane and the computation time for
constructing vertex attributes are independent things. Yet
your last paragraph makes it sound as if somehow they are
related.
Regarding how you "assign" color to the vertices. You have to do
*something* each frame. In your 1D-texture coordinate generation,
I imagine you are using the dot product of vertex normal with the
vector from vertex to light position to generate the coordinate.
If you were to construct vertex colors each frame, you still
have to work with the vertex normals. Any way you look at it,
your vertex attributes are dynamically changing, so you must
recompute them each frame. The attribute construction is independent
of selecting the clip-plane. And the performance issue is of concern
independently of the clip-plane precision problem. [Consider the
construction of vertex attributes on the CPU as your "software
shader" solution.]
Some possible alternatives:
(1) Use a volume texture. The 3-dimensional texture coordinates
are the model-space vertex normals transformed by the rotation
that oriented the ellipsoid. This transformation gets pushed onto
the texture matrix stack.
(2) Use a cube map with the same idea of treating the rotated
normals as the texture coordinates.
As long as the texture coordinate transformation is implemented
in the graphics hardware (or using SIMD support on the CPU),
you might get reasonable performance.
--
Dave Eberly
http://www.geometrictools.com
.
- Follow-Ups:
- Re: glClipPlane precision
- From: John Irwin
- Re: glClipPlane precision
- References:
- glClipPlane precision
- From: John Irwin
- Re: glClipPlane precision
- From: Dave Eberly
- Re: glClipPlane precision
- From: John Irwin
- glClipPlane precision
- Prev by Date: Re: glClipPlane precision
- Next by Date: Re: Anti aliasing
- Previous by thread: Re: glClipPlane precision
- Next by thread: Re: glClipPlane precision
- Index(es):
Relevant Pages
|