Re: glClipPlane precision



Dave Eberly wrote:

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 :)

Yeah, sorry, brain working on limited information, due to lack of OpenGL
shader knowledge! I guess it's an OpenGL version issue, anyway.

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.

Indeed, they do seem independent; I only mentioned the use of
vertex/texcoord arrays as an alternative to using clip-planes. But I
found that they had their own quality and performance issues.

However, I have since discovered another technique that is similar to
this, except I can leave it up to OpenGL to generate the texture
coordinates. It seems I can use the clip-plane array defined in
model-space with glTexGendv and let OpenGL decide which side of the
plane each vertex is and so calculate a texture coordinate based on
this. The main point being OpenGL may be a lot faster than doing it
myself in software. I have still to try it (this is but a part-time
activity, you see; something for the weekend no doubt).

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.

This looks promising but how does the position of the light source come
into this? It seems that the texture would need to be regenerated every
frame if the light source moves (as it does). Would you elaborate - I'm
still not sure how this works?

John Irwin.
.



Relevant Pages

  • Re: glColor
    ... have to call in the shader. ... loaded (like texture object with ID 0 in current OpenGL), ... probably with ID 0, too, doing exactly what the fixed function ...
    (comp.graphics.api.opengl)
  • Re: Texture 3D interpolation between layers
    ... Yeah, but 2 and 3 shouldn't have the same texture coordinate in this ... calculate your "fake coordinates" for texturing, giving them to opengl, ... the shader (my idea was to define a shader which takes a list or ...
    (comp.graphics.api.opengl)
  • Re: data-flow / interaction of application, vertex-shaders, pixel-shaders, cull/clip/pro
    ... >> the pixel shader apply the appropriate texture-images to triangles? ... > pixel shader samples the texture, the right texel is fetched, ... I transform to camera coordinates to cull all backface triangles ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Cello Rising
    ... Yeah (that's what I'd do given that I had to do it in opengl). ... 'here's how you can do a canvas surrounded by a toolbar and a standard ... I don't see how the texture can change unless you provide the users ... KT> I also want Cello to be as good compared to other GUIs as Lisp ...
    (comp.lang.lisp)
  • accessing constant buffers, shader resources, etc.
    ... I'm new to D3D10 and am having some trouble/confusion resolving some of the basic functionality with shader resources. ... I'd like to have a texture array and a constant buffer available from the vertex shader, then another texture array for the pixel shader. ...
    (microsoft.public.win32.programmer.directx.graphics)