There isn't a direct way to ask for texture lookup by mipmap level, and if you
think about it, that doesn't make much sense, since knowing WHICH mip levels it
needs and knowing the blending factor between them is all tied up together.
You can sort of fake it: if you use MipModeOneLevel and InterpBilinear, then
you can force a particular MIP level from a texture lookup by setting
derivatives:
dsdx = 1.0/desired_xres + epsilon
dsdy = 0
dtdx = 0
dtdy = 1.0/desired_yres + epsilon
where desired_xres and desired_yres are the resolutions of the MIP level you
are interested in, and epsilon is just a tiny nudge (say, 1e-6) to make sure
that numeric rounding isn't causing you to accidentally sample one mip level
off.
> On Apr 14, 2017, at 4:17 AM, Javier Edo Meseguer <[email protected]> wrote:
>
> Hi there,
>
> I’m doing a little experiment where I’d like to do texture lookups on
> axis-aligned, square POT images by specifying directly the mip level that I
> want sampled but I wouldn’t want to miss out on the benefit of TextureSys
> doing the blending between two mip levels, so doing an ImageCache lookup with
> a explicit mip level doesn’t seem appealing to me.
>
> From reading the docs and having a quick look at the headers & source it
> looks like the derivatives always need to be specified but unfortunately as
> my use case is fairly different from the general rendering use cases I don’t
> have derivatives to start with.
>
> Is there a quick way to apply the reverse formula? it looks like
> ellipse_axes() calculates the lengths (in my case should be the same) and in
> turn compute_miplevels() uses these to get the actual mip level used, I guess
> I can’t bypass these steps so I was wondering if there is anything that I’m
> missing, any obvious way to turn my mip level number into something sensible
> that could be used to do the TextureSys::texture() call.
>
> Btw, this is my first email to the list so I’d like to say thanks a lot for
> this amazing library, it’s great being able to use it everywhere (including
> iOS!)
>
>
> Cheers,
>
> -Javier
>
--
Larry Gritz
[email protected]
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org