Logo by dainbramage - 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: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. November 17, 2019, 02:18:59 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 4167 times)
0 Members and 1 Guest are viewing this topic.
Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #30 on: July 15, 2015, 10:55:00 PM »

And frags - apologies for multiple posts, but there's a 256KB limit on the attachments. At least for newbies wink

* Towards VFX Pipelines.zip (99.26 KB - downloaded 72 times.)
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #31 on: July 16, 2015, 02:50:44 AM »

Quote
32bpp buffer is scaled down do 24bit and split into 3 8b channels.
can you encode to RGBA for 32 bit data so...
Code:
z32 = r*256*256*256 + g*256*256 + b*256 + a;

The internal depth buffer use in GL is an odd creature, if you google "working with GL depth buffers", or the like, you will find the same infos I did when hacking up spline path occlusion, I don't know the details of why it works the way it does, I just know that it works, and had no thought of saving the depth buffer to a file while I developed the spline path occlusion, those numbers are the ones that seemed to get the desired results.

nice to see you are making some progress  A Beer Cup
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 #32 on: July 17, 2015, 01:20:50 PM »

Quote
can you encode to RGBA for 32 bit data so...
Cool, but what would I do with it if I cant export it thanks to QT limitations?
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #33 on: July 17, 2015, 03:30:56 PM »

encoded as RGBA? = standard qt image, which could be exported?
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 #34 on: July 18, 2015, 03:09:08 AM »

you can find all Qt image formats here http://doc.qt.io/qt-5/qimage.html#Format-enum

the data structure is directly accessible on a per byte or per scanline.byte basis so if you create an image of the desired size and format you can read/write directly to the storage buffers whatever values you want cheesy
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #35 on: July 18, 2015, 07:37:33 PM »

Mikael, can you let me know where and how it is decided how Frag buffer is handled?
Do I have control over it on the GLSL side?

I'm not sure what you are asking here. But you can control the bit depth of the buffer Fragmentarium is rendering to using the
'#buffer RGBA32F' directive (see e.g. 3D.frag). Notice that this is not related at all to the OpenGL depth buffer resolution (which I never used in the original Fragmentarium).

By far the best solution to all this would be to integrate a library capable of exporting HDR data, such as the OpenEXR library you suggested yourself.

Dick, what is the reason for calculating it that way? i.e what's the reasoning behind "1000.0 - 0.00001" part?

I have written a bit on how to calculate gl_FragDepth here: http://blog.hvidtfeldts.net/index.php/2014/01/combining-ray-tracing-and-polygons/ - notice, that this is ONLY needed if you want to integrate standard OpenGL vector graphics with GLSL pixel graphics (which I don't think you want)
Logged
Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #36 on: July 19, 2015, 11:00:23 AM »

Many thanks Mikael.

The QT 32bit is 32bit total, so it is still 8bits per channel.
I was thinking about 32bit per channel. Or at least 16.
So yes, OpenEXR in the future.
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #37 on: July 28, 2015, 07:46:14 AM »

But you can control the bit depth of the buffer Fragmentarium is rendering to using the '#buffer RGBA32F' directive (see e.g. 3D.frag).
I added RGBA16F too, it renders clean pictures so I'm assuming it works, still saves QImage RGB8
edit: ( in latest source code only)
By far the best solution to all this would be to integrate a library capable of exporting HDR data, such as the OpenEXR library you suggested yourself.
I have been studying the EXR code and I might be able to manage it, seems relatively simple huh? , the plan: save 16/32 float rgbz directly from the GL buffers when using filename extension ".exr" for output images. It will require a lot of ram me thinks...
edit: (not quite there yet wink )

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 #38 on: July 29, 2015, 06:43:55 AM »

here is the first (ever?) OpenEXR image from Fragmentarium cheesy

exrstats
Code:
$> exrstats tile_0.exr

tile_0.exr [512x288]:

exrstats: Scanning 287
exrstats: Done.

  Alpha     min is   1.000, max   1.000

  Luminance min is   0.105, avg   0.666, max   0.964
  Red       min is   0.106, avg   0.681, max   0.965
  Green     min is   0.106, avg   0.713, max   0.965
  Blue      min is   0.094, avg   0.666, max   0.961

  Luminance log min is  -2.253, avg log  -0.364, log max  -0.036
  Red       log min is  -2.245, avg log  -0.395, log max  -0.036
  Green     log min is  -2.245, avg log  -0.350, log max  -0.036
  Blue      log min is  -2.363, avg log  -0.420, log max  -0.040

* tile_0.exr.zip (203.89 KB - downloaded 68 times.)
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #39 on: July 29, 2015, 07:01:21 PM »

Very nice! The image opens nicely in EasyHDR
Logged
Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #40 on: July 29, 2015, 08:08:13 PM »

Yeah! The dream came true!
Made my day and you rock!

On my end I've implemented simple version of materials with slightly improved and optimized blinn-phong based shading and I'm updating the renderer to deal with transparency and matte objects through the pipeline. It's gonna take a bit more time, but we already see the light!

@Dick - are you able to think about capturing or intercepting multiple layers from fragmentarium to write multiple layers into EXR?
I guess there's only one buffer (hopefully i'm wrong), but perhaps we could make use of 2Dsampler/texture objects to funnel data to EXR?

Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #41 on: July 30, 2015, 03:11:27 AM »

@Syntopia ty smiley  on my system it doesn't look quite right, could be the display/conversion prog but it looks a bit too bright when converted to png and too dark, low contrast, in the desktop display app. (OpenEXR is included as part of the SuSE linux dist). It should look exactly like the default bulb image at startup.

@PK it is only at a very rudimentary stage, saving one tile, they will still need to be stitched together for larger tiled images, I am looking at layers but again only in the simplest of forms. The image I attached previously should be RGBAF so 4 float layers. I have had no luck with depth buffer, I think it's because rendering is done with 2 accumulation buffers then to a screen buffer, the depth buffer stuff that I did for spline path occlusion is only active when in Non-Tiled + Non-Accumulation mode, however the fragment code should still be populating the depth buffer (maybe that needs to accumulate too), but I think it gets destroyed when we render our texture to a quad for display.
Perhaps Syntopia can weigh in with some of the finer points of Fragmentarium's internal rendering flow smiley can we use GL_Accum and Qts default double buffers (created for QGLWidgets) instead of the current setup?

My plan is for better colour resolution for printing fractals so I may not take it any farther than that but the end result will be the ability to save EXR images for processing in other software. wink

EDIT: exr image from GL float buffers, first pic shows Fragmentarium render in background, Okular viewer and png converted from exr
EDIT: second pic is displayed with the OpenEXR viewer cheesy


* compareEXR.jpg (90.18 KB, 866x580 - viewed 225 times.)

* compareEXR2.jpg (41.65 KB, 553x376 - viewed 241 times.)
« Last Edit: July 31, 2015, 02:20:12 AM by 3dickulus, Reason: i just realized that everything to do this is built into SuSE linux :\\ » 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 #42 on: July 31, 2015, 03:38:19 PM »

Again, easier than anticipated cheesy
I have set it up so that all the user has to do is to make the output base filename end with .exr and you get RGBA16F images, but they are upside down and don't seem to work with odd tile size, must be even huh? so a little tinkering over this weekend and hopefully a fresh release.
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 #43 on: August 01, 2015, 12:10:16 AM »

Yeah! That's great! Is there a build for that already?
That puts some pressure on me to add alpha channel to the raytracer and I'm almost there.
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
Patryk Kizny
Global Moderator
Fractal Fertilizer
******
Posts: 372



kizny
WWW
« Reply #44 on: August 01, 2015, 12:40:58 AM »

I inspected the EXR file and it looks as follows:
https://www.dropbox.com/s/6f6niyfjl4b9cdp/Screenshot%202015-08-01%2000.38.04.png?dl=0
https://www.dropbox.com/s/71vmztyq0lzt5li/Screenshot%202015-08-01%2000.37.57.png?dl=0

There are RGB channels and alpha.
Alpha is all 1.0 values.

Does it mean alpha would take other values if present in buffer?
Logged

Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
Pages: 1 2 [3] 4   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Exporting 3D files Meet & Greet « 1 2 » william duffy 15 4403 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 1978 Last post October 13, 2011, 06:45:57 PM
by DarkBeam
Rendering Z buffer images in Mandelbulb 3D Mandelbulb 3d Gylded_Khakatrice 2 2231 Last post December 30, 2011, 03:09:41 PM
by Rama
Exporting parameters from interpolated animation sequences? Mandelbulb 3d morbidorbits 6 1133 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 1918 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.12 seconds with 28 queries. (Pretty URLs adds 0.01s, 2q)