Re: Texture 3D interpolation between layers
- From: Maik Wagner <maik-wagner@xxxxxx>
- Date: Tue, 04 Jul 2006 00:06:04 +0200
Alessandro [AkiRoss] Re wrote:
Maik Wagner ha scritto:
Thats what i meant. But i can't find a fault (maybe thats just again
some dumb thing :()
If you want to take a look to my code i can post it. It's about 250
rows and uses SDL and glew.
Well then i would need SDL and glew i think ;)
It's hard to explain. So interpolation is done right on the Quads lines,
at least i think so, but within this polygons it looks odd. (It sure is
interpolated through the polygon, but not right according to height)
I think that the best method to see how it does interpolation is to
apply a 3d texture to a vertical line :) (or a vertical triangle like
(0, 0, 0) (1, 1, 0) (0.5, 0.5, 2))
I don't think you could see this could with a line, 2 would help (see below).
I think that interpolation is made anyway per-fragment, and not
per-vertex. So even a splitting-in-triangles should works fine as well.
It is made per fragment, but as my explanation should show, it can get unexpected.
Just the former example:
(1) *
/|
+ |
/ \|
(2) * +
\ |
\ |
\|
(3) *
Now let (2) and (3) have the same texture coordinate (layer 0 for example) and (1) the next one (layer 1)
for thos lines it then looks like:
(2)--------------+--------------(1)
layer0 (layer0+layer1)/2 layer 1
(3)---------------------+---------------------(1)
layer0 (layer0+layer1)/2 layer 1
Now think of the line between both midpoints. this edge has on both endpoints the same texture value in r(z)-component (in your case color-value) even if it's different height.
At least this is what i think right now... and well, it doesn't sound to bad to me and would explain this behaviour.
If the driver splits this Quad in a way that the line from top to bottom
becomes an triangle edge (internally), ogl interpolates itself on this
edge, regardless how i set up coordinates to get these transitions.
But we (I) aren't even sure if driver splits the quad. And even if it
does, i don't think this is an acceptable result. I mean: even when
opengl clip a triangle that is half out of the screen it is splitted by
the driver, but withouth changes (i think) with the original polygon.
As discussed earlier most drivers seem to handle them as triangles (topic was about gl_polygon, but it's nothing else with quad(-strips) i think, using wrong blending settings one can see that... yeah well i used wrong settings one time and was surprised seeing triangles on my terrain ;))
Hmm hope i got it explained.
Yeah, splitting operation is quite common :)
I'm going to test my code with others terrains, textures and filled
quads, to see if it happen also to me that some texture are "badly
interpolated".
Well maybe just do a greater tesselation (means working with greater quads).
Maybe within my example it's more visible because i do not just give vertices an tex-coordinate hitting exact one layer (and let ogl interpolate), but even interpolating myself between them.
for example:
height layer
0-20 0
20-30 0-1 (linear interpolated)
30-100 1
100-120 1-2
and so on...
.
- Follow-Ups:
- Re: Texture 3D interpolation between layers
- From: Alessandro [AkiRoss] Re
- Re: Texture 3D interpolation between layers
- From: Maik Wagner
- Re: Texture 3D interpolation between layers
- References:
- Re: Texture 3D interpolation between layers
- From: Alessandro [AkiRoss] Re
- Re: Texture 3D interpolation between layers
- From: Rolf Magnus
- Re: Texture 3D interpolation between layers
- From: Alessandro [AkiRoss] Re
- Re: Texture 3D interpolation between layers
- From: Maik Wagner
- Re: Texture 3D interpolation between layers
- From: Alessandro [AkiRoss] Re
- Re: Texture 3D interpolation between layers
- From: Maik Wagner
- Re: Texture 3D interpolation between layers
- From: Alessandro [AkiRoss] Re
- Re: Texture 3D interpolation between layers
- From: Maik Wagner
- Re: Texture 3D interpolation between layers
- From: Alessandro [AkiRoss] Re
- Re: Texture 3D interpolation between layers
- Prev by Date: Re: FTGL font engine
- Next by Date: Re: FTGL font engine
- Previous by thread: Re: Texture 3D interpolation between layers
- Next by thread: Re: Texture 3D interpolation between layers
- Index(es):
Relevant Pages
|