Logo by kr0mat1k - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Visit the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. March 28, 2024, 07:09:01 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: 1 2 3 [4]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Exporting Z-buffer and transparency  (Read 10149 times)
0 Members and 1 Guest are viewing this topic.
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« 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 wink

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

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« 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 huh?


* test.png (246 KB, 640x360 - viewed 209 times.)
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #47 on: September 18, 2015, 07:13:41 AM »

and the alpha from depth looks like this...


* testz.png (37.98 KB, 640x360 - viewed 211 times.)
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« 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
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« 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
Code:
float depth;
line 129 (adds a checkbox in the "Post" tab so we can turn it on and off)
Code:
uniform bool DepthToEXRAlpha; checkbox[false];
line 185
Code:
  if(DepthToEXRAlpha==true) gl_FragDepth = depth;

in file DE-Raytracer.frag...
line 397
Code:
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...
Code:
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


* test.png (161.58 KB, 640x360 - viewed 243 times.)

* testz.png (72.25 KB, 640x360 - viewed 226 times.)
« Last Edit: September 19, 2015, 06:54:31 AM by 3dickulus, Reason: slider » Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« 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 smiley

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

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« 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

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« 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
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« 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

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« 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

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« 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
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« 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.


* testDepthToAlpha0.jpg (37.22 KB, 640x360 - viewed 187 times.)

* testDepthToAlpha1.jpg (33.27 KB, 640x360 - viewed 185 times.)

* testDepthToAlpha2.jpg (15.33 KB, 640x360 - viewed 202 times.)
« Last Edit: November 08, 2015, 10:19:05 PM by 3dickulus, Reason: inf » Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« 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



* testDepthToAlpha3.jpg (19.81 KB, 640x360 - viewed 212 times.)

* testDepthToAlpha4.jpg (19.76 KB, 640x360 - viewed 198 times.)

* testDepthToAlpha5.jpg (46.53 KB, 640x360 - viewed 207 times.)
« Last Edit: November 10, 2015, 02:43:00 AM by 3dickulus » Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Pages: 1 2 3 [4]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
rendering text into an image buffer in C++ Programming aluminumstudios 2 2692 Last post July 31, 2010, 03:58:22 AM
by aluminumstudios
Exporting 3D files Meet & Greet « 1 2 » william duffy 15 10299 Last post March 02, 2011, 02:41:31 AM
by David Makin
Z Buffer and animation in Mandelbulb Introduction to Fractals and Related Links Gylded_Khakatrice 1 3018 Last post October 13, 2011, 06:45:57 PM
by DarkBeam
Exporting parameters from interpolated animation sequences? Mandelbulb 3d morbidorbits 6 4213 Last post July 06, 2012, 10:46:35 PM
by morbidorbits
How to add DOF afterwards to a Mandelbulb 3D image with Z buffer? Format, Printing & Post Production schizo 1 5961 Last post November 09, 2014, 01:20:24 AM
by ellarien

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.264 seconds with 25 queries. (Pretty URLs adds 0.014s, 2q)