pre-filtered lookup without EXT_paletted_texture?

i’ve been through the forum history, and it seems like this should be possible, but there is no pseudo-code to guide me…

i am interested in doing a pre-filtered dependent texture lookup (8-bit -> RGBA), but still outputting filtered texels (exactly the behavior of EXT_paletted_texture, but using register combiners or other…). i also want to know if this is possible on NV2x hardware.

i can obviously bind the texture to one unit with NEAREST filtering, and do a dependent fetch, but then the texture is aliased and blocky, since it has not been smoothed with linear filtering. so is there a way, after the dependent fetch, to somehow filter the texture properly?

ultimately, what i am trying to do is masked multitexturing, with an arbitrary base texture in unit 0, and an 8-bit mask texture in unit 1. the result being that the mask is used to modulate on a per-pixel basis the color and opacity of the base texture.

one way to do this is to just bind an RGBA texture to unit1 and do a simple TexEnv modulate, but this is very expensive when the mask changes, and uses tons of memory unnecessarily for 3D textures.

any advice is appreciated!

actually, i seem to remember seeing somewhere in the docs or presentations on nvidia’s site an example where a texture was filtered nearest neighbor in one direction, and linear in the other (i can’t remember where i saw it! doh!). this is along the lines of what i want to do.

anyone have advice/experience/example code?

from the NV_fragmen_program spec:

DEFINE halfTexel = { 0.03125, 0 }; # 1/32 (1/2 a texel)
ADD R0, f[TEX0], -halfTexel; # coords of left sample
ADD R1, f[TEX0], +halfTexel; # coords of right sample
TEX R0, R0, TEX0, 2D; # lookup left sample
TEX R1, R1, TEX0, 2D; # lookup right sample
MUL R2.x, R0.x, 16; # scale X coords to texels
FRC R2.x, R2.x; # get fraction, filter weight
LRP R0, R2, R1, R0; # blend samples based on weight

this will only work on FX hardware, correct?

do the latest nvidia drivers support the fragment program extension yet? (i don’t think they support ARB_fragment_program…?)

do you think there is a way to do it on nv2x hardware using an offset_texture?

do the latest nvidia drivers support the fragment program extension yet? (i don’t think they support ARB_fragment_program…?)

On the GeForce FX series, yes; they have supported them since launch.

The GeForce 4, however, does not have the hardware capabilities to support either ARB_fp or NV_fp.