openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Openexr-devel] half framebuffers


From: francesca luce
Subject: [Openexr-devel] half framebuffers
Date: Wed, 26 Apr 2006 23:47:40 +0000

Hii there.

I have a little problem writing buffer of type <half>.
I'm doing a simple mentalray custom output shader
that create multiple channel openexr images from the
all buffers mentalray collected during render. I got no
problem at all implementing the multichannel thing
when the buffers are of type <float>. but I can't for the
while succeed when they are of type <half>.

is there something a newby like me should be aware of ?


for floating buffers I do something like this... let's say we
only take care of the R component of a single buffer.


[CODE]

ChannelList &channels = myheader.channels();
channels.insert (mychannel, Channel (FLOAT) );

OutputFile outfile (myfilename, myheader);
FrameBuffer fb;

Array<float> floatRpixels(height*width);
float* zPixels = floatRpixels;
for(int y=_bufferYMin; y <_bufferYMax ; y++)
{
        mi_par_aborted();
miUchar* from = miIMG_ACCESS( f, (_bufferYMax-1)-y, ch ); //mentalray scanline
        for(int x=_bufferXMin; x<_bufferXMax; x++)
        {
                *(zPixels + y*width+x) = *(float*)from;
                from += sizeof( float );
        }
}

fb.insert (ctrl_getchname(ch),
        Slice (FLOAT,
        (char *) zPixels,
        sizeof (*zPixels) * 1,
        sizeof (*zPixels) * width));

        outfile.setFrameBuffer (fb);


outfile.writePixels (height);

[/CODE]

naively I just tried to put half and HALF where I have float and FLOAT. ;-)) the image returned is roughly there but also all color pixelated. I'm stumped.
Any help will be greatly appreciated.

sorry for my english. and thanks for the great package.


ciao
francesca






reply via email to

[Prev in Thread] Current Thread [Next in Thread]