Re: Per axis filtering would be cool.

"Stephen J Baker" <[email protected]>
Newsgroups gmane.games.devel.opengl
Organization Fat City Network Services, San Diego, California
Message-ID <[email protected]>
Roadkill wrote:
> I don't think this is necessary. For your atlas program you could just 
> write the images side by side in a extra wide 2D texture.

You can't make the images wrap if you do that (well, not if you want
MIPmapping).

Besides, the texture atlas problem was just one example.  I have many other
uses for texture lookups where different filtering on each axis would
produce huge savings.

The need for this wasn't there before OpenGL had shaders - but with shader
technology, we're increasingly using textures are arbitary lookups for
all sorts of non-image applications.

> That would be 
> done when the atlas loads. Then your fragment program (or even vertex 
> program) could easily sample the different images. The image you want to 
> sample would be multiplied by the width of the image (not the gl 
> texture) and added to the x texture coordinate. To handle wrap around 
> the x texture coordinate would be calculated by taking the incoming 
> texture coordinate and modding it by the image width. Handling filtering 
> at the edges could be tricky but its worth a try.

It's beyond just 'tricky'.  If you think this is workable, I suggest you
try writing a shader that can deal with a MIPmapped/Wrapping texture atlas.
You'll soon feel my pain!

You can fix the texture coordinates to make the image wrap - that's trivial -
but with MIPmapping enabled, whenever the rendering skips from one side of
the image to the other, the underlying hardware sees a huge jump across
texture space and it'll drop your MIP level down to maybe the 2x2 or 4x4 map!
The result of that is that you get fuzzy lines around the edge of every map
repeat.

The only way to deal with that is to go with point sampling and do all
of the MIPmap generation yourself - and at that point, the overheads in the
shader become insanely expensive.

In the case of texture atlas's, this overhead more than wipes out the
benefits of using an atlas - but in other non-conventional applications
of texture, it completely kills the whole technique.

-----------------------------------------------------------------------
The second law of Frisbee throwing states: "Never precede any maneuver
by a comment more predictive than "Watch this!"...it turns out that
this also applies to writing Fragment Shaders.
-----------------------------------------------------------------------
Steve Baker                      (817)619-2657 (Vox/Vox-Mail)
L3Com/Link Simulation & Training (817)619-2466 (Fax)
Work: [email protected]           http://www.link.com
Home: [email protected]       http://www.sjbaker.org

----- 
FAQ and OpenGL Resources at:
  http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

-- 
Author: Stephen J Baker
  INET: [email protected]

Fat City Hosting, San Diego, California -- http://www.fatcity.com
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [email protected] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.