3dickulus
|
|
« Reply #45 on: August 01, 2015, 02:19:27 AM » |
|
Alpha is all 1.0 values. Does it mean alpha would take other values if present in buffer?
yes, I know what the RGBA file contains, exactly what the GL is using to create the raster image on the screen, it is directly from the rendered texture data, the second pic looks very rich, not washed out up or down, leading me to believe that the viewer that comes with the EXR installation shows a better representation than other progs, the conversion to RGBA8, done GL to Qt to screen, is bound to be a little different than an optimized 16/32 bit viewer. yes I looked at writing separate layers but there is a builtin facility for writing RGBA and the internal GL format is RGBA so this seems like a logical first step, as I learn more about the EXR code it will probably be easy to write depth stored in alpha channel as a layer named "Z", so RGBZ, one of the EXR examples demonstrates this, does your VFX software allow for loading/accessing named layers? or "knows" that a layer named "Z" is depth?
|
|
« Last Edit: August 01, 2015, 02:36:39 AM by 3dickulus, Reason: quote »
|
Logged
|
|
|
|
3dickulus
|
|
« Reply #46 on: September 18, 2015, 07:12:27 AM » |
|
I think I've got it! 3ridiculously simple, 2 lines in 3D.frag, 1 line in DE-Raytracer.frag and a few lines added to the EXR tile routine. is this what a png with zbuffer transparency should look like
|
|
|
|
3dickulus
|
|
« Reply #47 on: September 18, 2015, 07:13:41 AM » |
|
and the alpha from depth looks like this...
|
|
|
|
Patryk Kizny
|
|
« Reply #48 on: September 18, 2015, 02:33:21 PM » |
|
How to connect to EXR layers if I wanted to output from my raytracer?
|
|
|
Logged
|
Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
|
|
|
3dickulus
|
|
« Reply #49 on: September 19, 2015, 06:48:29 AM » |
|
I am only hooking up the depth as alpha for now... these adjustments are in reference to the default files 3D.frag and DE-Raytracer.frag in the files distributed with Fragmentarium... in file 3D.frag... line 87 line 129 (adds a checkbox in the "Post" tab so we can turn it on and off) uniform bool DepthToEXRAlpha; checkbox[false]; line 185 if(DepthToEXRAlpha==true) gl_FragDepth = depth; in file DE-Raytracer.frag... line 397 depth = 1.0-(totalDist - length(hit)); in C++ file Fragmentarium/GUI/DisplayWidget.cpp there are a bunch of lines commented out of the getRGBAFtile routine, the whole thing is like this now... void DisplayWidget::getRGBAFtile(Array2D<Rgba>&array, int w, int h) {
// read colour values from hiresBuffer
if (!hiresBuffer->bind()) { WARNING("Failed to bind hires FBO"); }
GLfloat myImgdata[h][w][4]; glReadPixels(0, 0, w, h, GL_RGBA, GL_FLOAT, myImgdata);
glClearColor(0.0f,0.0f,0.0f,0.0f); clearGL();
if (!hiresBuffer->release()) { WARNING("Failed to release hires FBO"); } // read depth values from previewBuffer
if (!previewBuffer->bind()) { WARNING("Failed to bind preview FBO"); }
GLfloat myDepths[h][w][1]; glReadPixels(0, 0, w, h, GL_DEPTH_COMPONENT, GL_FLOAT, myDepths);
if (!previewBuffer->release()) { WARNING("Failed to release preview FBO"); }
// put them together as RGBZ for( int i = 0; i < h; i++) { for( int j = 0; j < w; j++) { array[(h-1)-i][j] = Rgba (myImgdata[i][j][0], myImgdata[i][j][1], myImgdata[i][j][2], myDepths[i][j][0] ); } }
}
and here are the results... EDIT: should add a float slider to replace 1.0 with user offset in the "depth =" calculation
|
|
« Last Edit: September 19, 2015, 06:54:31 AM by 3dickulus, Reason: slider »
|
Logged
|
|
|
|
3dickulus
|
|
« Reply #50 on: September 19, 2015, 07:20:17 AM » |
|
@PK the next patch release 1.0.12 ? will have this enabled so that you can assign any value to depth and it will be in the EXR file alpha channel. If 3D and DE frags don't have these changes the alpha channel will be blank so old frags will still run edit: this value may or may not be the real scene depth, I did it this way so I can see it, what sort of values does your VFX software expect ?
|
|
« Last Edit: September 19, 2015, 07:28:16 AM by 3dickulus, Reason: Q »
|
Logged
|
|
|
|
3dickulus
|
|
« Reply #51 on: September 21, 2015, 08:33:33 AM » |
|
ok so it still needs a little work, you will have to tinker with your favourite DE.frag a little but it does work.
|
|
|
Logged
|
|
|
|
Patryk Kizny
|
|
« Reply #52 on: September 21, 2015, 10:54:27 AM » |
|
Answering your previous question - As long as output is 32bpp floating point, Z-depth can be output w/ out any manupulations. For my purposes i scale the image so that it reaches 0-1 scale (where white is 1 and it's the closest point to the camera).
|
|
|
Logged
|
Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
|
|
|
3dickulus
|
|
« Reply #53 on: September 21, 2015, 03:22:42 PM » |
|
hm.. scaling, would be nice to have auto scaling, I have added a depth magnitude slider, but would like to do this on C++ side so no changes will be needed in GLSL frags. I have adjusted so that reflections don't interfere with spline occlusion.
|
|
« Last Edit: September 21, 2015, 03:31:40 PM by 3dickulus »
|
Logged
|
|
|
|
3dickulus
|
|
« Reply #54 on: November 08, 2015, 08:23:59 PM » |
|
depth to alpha is now handled with a single define in user fragment, text editor, all that is needed is to add "#define DEPTH_TO_ALPHA" line before the raytracer include, this will add a checkbox to the "Post" tab, this is only useful if you intend to post process images with software that knows what EXR format is before assembling the animation. This does not work for any other format, EXR only.
|
|
|
Logged
|
|
|
|
Patryk Kizny
|
|
« Reply #55 on: November 08, 2015, 09:31:19 PM » |
|
Cool! I think there's still something not exactly right with the EXR output. Looks like a massive gamma shift to me.
|
|
|
Logged
|
Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
|
|
|
3dickulus
|
|
« Reply #56 on: November 08, 2015, 09:46:10 PM » |
|
0> screen shot from Fragmentarium window 1> screen shot from iv program showing exr file "as loaded" 2> screen shot from iv program ALPHA channel only from exr
viewed with "iv" program from OpenImageIO package edit: the image(2) is off register because I did a sloppy clip from screen, the image(1) looks a bit lighter, but again, clipped from screen from "iv" program so it is probably calculating the display from RGB+A channels, when flipped to show only RGB it is the same as the screen shot. Still not a huge difference.
|
|
« Last Edit: November 08, 2015, 10:19:05 PM by 3dickulus, Reason: inf »
|
Logged
|
|
|
|
3dickulus
|
|
« Reply #57 on: November 08, 2015, 09:54:30 PM » |
|
3> this is displayed with the desktop viewer which I don't think is accurate 4> "iv" program with Exposure = -2.0 and Gamma = +2.0 with Exposure = 0.0 and Gamma = 1.0 (default in iv?) the image displayed looks the same as Fragmentarium view 5> saved as png from "iv", viewed with desktop viewer and screengrabbed
|
|
« Last Edit: November 10, 2015, 02:43:00 AM by 3dickulus »
|
Logged
|
|
|
|
|