That worked a treat! thanks Larry! I have a quick followup question, I’ve gone through the docs pdf and it doesn’t seem to specify how are colors handled when the “automip” option is on in TextureSys/ImageCache, at the moment I have very basic needs in terms of color (just sRGB/linear) so I’m putting off adding OCIO for a couple of months until I have some more pressing stuff sorted out, do these guys automagically handle basic color for me?
Example use case, I am sampling a jpeg file with TextureSys::texture() with automip enabled, will it do the sRGB to linear conversion before generating the mips or are there some special flags I should be specifying? (like the ocio:colorspace ones in ImageInput/ImageOutput but without actual OCIO) if there isn’t I can do the linearization myself and use some ImageBuf magic later but I thought I’d ask first. Cheers! > El 14/4/2017, a las 17:58, Larry Gritz <[email protected]> escribió: > > 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 _______________________________________________ Oiio-dev mailing list [email protected] http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
