AWS Thinkbox Discussion Forums

NAN renders as black not white

NAN exr values render as Black. They should render as white.

I’m not sure I follow what you mean, as Draft doesn’t display anything… do you mean NAN values are getting converted to black instead of white?

I tried looking in the OpenEXR spec, and couldn’t find what colour NAN should be treated as. Could you send us a sample input image and script, and let us know what output you expect, vs what you’re getting? Thanks!

When rendering an H264 or JPEG etc if you have a NAN pixel it’ll be a black pixel in the quicktime. I would expect it to be infinite aka white. 1/0.000000000000001 > 0. That’s how nuke treats it and I would say Nuke is the closest thing to the EXR spec available. :smiley:

mediafire.com/?ur9nu69paiocp … ujnusza564

It appears that it’s not the EXR spec that’s choosing how the NAN pixels are treated, it’s the output format… exporting the image to jpg and tiff both give me (near) white pixels where the NAN pixels were. However, encoding the image as a video using H264 does indeed give black pixels, from what I can tell.

Would you like us to add a wishlist item for this?

Yes please! Maybe a NAN color op.

So you could do something like

image.NanColor = color(1,0,0,0)

If you wanted a debug mode. Then all outputs would be identical and it would be user serviceable.

Added!

New feature request on this front. NAN filtering. I have a BLINK script which I’m using now which does an awesome job on a filter setting of 0.8.

image.NanFilter(0.8)

[code] void init() {
src.setRange(-1,-1,1,1);
}

void process(int2 pos) {

    float sum = 0.0f;

    for (int j = -1, index = 0; j <= 1; j++) {
       for (int i = -1; i <= 1; i++, index++) {
          if (i == 0 && j == 0 ) {} else 
          {
              sum += src(i, j);
          }
       }
    }

    if  (src(0,0) < 10000000.0) dst() = src(0,0); else dst() = sum / 8.0;

}
};[/code]

What is BLINK, and what does the 0.8 mean on the NAN filter?

Oops, I got confused in my scripts, that was for a firefly remover (the 0.8) palm to face.

BLINK is the new CUDA/CPU scripting language for Nuke. The script just takes a 3x3 block (8 pixels) around every NAN value and averages the surrounding pixels. That way your NAN values are just filtered out entirely instead of being black or white. We’re doing this to almost all of our renders now due to NAN fireflies in Vray.

NAN pixel =
[[+ + +]
[+ 0 +]
[+ + +]]/8.0

Ah, okay. I’ll add this to the request list.

If there’s another NAN in the neighbouring pixels, I assume you don’t include those in the average?

Correct.

Privacy | Site terms | Cookie preferences