Re: 3D Lut in software

Gonzalo Garramuno <[email protected]> Mon, 23 Feb 2015 16:48:40 -0300
Newsgroups gmane.comp.video.openexr.devel
Message-ID <CACmaHMtfdN8mX5vGqFJz2G2=6=0of4h1HvkFbhfSgd4u_WibHw@mail.gmail.com>
Thanks Jim.  I found the main problem.  The lut I am creating has alpha and
the Ctl::lookup3D function works with V3f vectors.   Still I am also
trashing some RAM somewhere as I fixed the above and I cannot get good
colors yet.

2015-02-23 14:34 GMT-03:00 Jim Atkinson <[email protected]>:

>
> On Feb 22, 2015, at 3:35 PM, Gonzalo Garramuno <[email protected]> wrote:
>
> > My application uses a 3D OpenGL Texture in log space for its table
> lookups, with code borrowed from playexr.  However, now I need to do the 3d
> lut lookup in software so I can display the color picker correctly showing
> the transformed colors.
> > I ask here for some help in seeing what I am doing wrong.  Sorry for the
> long code.
>
> ...
>
> > And here's my software evaluation routine which tries to mimic the
> shader code:
> >
> > void GLLut3d::evaluate( const Imath::V3f& rgb, Imath::V3f& out ) const
> > {
> >    using namespace Imath;
> >
> >    V3f pMin( lutMin, lutMin, lutMin );
> >    V3f pMax( lutMax, lutMax, lutMax );
> >    V3i size( _lutN, _lutN, _lutN );
> >
> >    out.x = lutT + lutM * log( Imath::clamp( rgb.x, lutMin, lutMax ) );
> >    out.y = lutT + lutM * log( Imath::clamp( rgb.y, lutMin, lutMax ) );
> >    out.z = lutT + lutM * log( Imath::clamp( rgb.z, lutMin, lutMax ) );
> >
> >    out = Ctl::lookup3D( (V3f*)&lut[0], size, pMin, pMax, out );
> >    out.x = exp( out.x );
> >    out.y = exp( out.y );
> >    out.z = exp( out.z );
> > }
> >
> >
> > The problem seems to be the Ctl::lookup3D function, which returns all
> negative numbers no matter what.
>
> They should be negative numbers:
>
>     0.1 == exp(-2.30259)
>     0.2 == exp(-1.60944)
>     0.3 == exp(-1.20397)
>     0.4 == exp(-0.91629)
>     0.5 == exp(-0.69315)
>     0.6 == exp(-0.51083)
>     0.7 == exp(-0.35667)
>     0.8 == exp(-0.22314)
>     0.9 == exp(-0.10536)
>     1.0 == exp( 0.00000)
>
> Unless you expect out values greater than 1.0, the values feeding into
> exp() will all be negative.
>
> - Jim
>
>


-- 
Gonzalo Garramuño
[email protected]

_______________________________________________
Openexr-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/openexr-devel