Logo by visual - Contribute your own Logo!


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. August 16, 2022, 02:58:55 AM

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]   Go Down
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: Best way to split GLSL into tiles?  (Read 1518 times)
0 Members and 1 Guest are viewing this topic.
Posts: 120

« on: November 21, 2012, 01:11:59 AM »

I had a peek at the Fragmentarium source code, but couldn't find the relevant part.

What is the best way to render a shader as multiple smaller sub-tiles (to avoid the default 2 second video driver timeouts)?

At the moment I am using loops and glviewport, like...

          for yloop:=0 to ytiles-1 do
               for xloop:=0 to xtiles-1 do
                    glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1, -1);
                    glTexCoord2f( 1.0, 0.0 ); glVertex2f(  1, -1);
                    glTexCoord2f( 1.0, 1.0 ); glVertex2f(  1,  1);
                    glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1,  1);

Which does work, but seems to really slow down the rendering.  I think this is due to the glfinish having to wait for the GPU to finish all its work before continuing with the next tile, but if I don't include that then the video card will timeout.

Any ideas for improving the above method without the slowdown?  How does Fragmentarium handle the issue?

« Reply #1 on: November 21, 2012, 06:07:01 PM »

Are you sure it is not something you do in processMessages like a screen refresh? That would slow things down.
Posts: 120

« Reply #2 on: November 22, 2012, 04:15:10 AM »

Commenting processmessages didn't make a difference.  I only include it so the app doesn't get the dreaded Windows "not responding" title bar during intensive shaders.

Finding that I was using way more tiles than necessary (as in each subtile was around 10x10 pixels in size) helped get the speed back up.

The above method/code still leads to a slight delay compared to a single full screen qaud.  As an example if a single quad gives 1 fps then splitting the screen into 9 sub quads gives 0.5 fps.

It isn't a huge deal.  As long as I can avoid the GPU timeouts it is acceptible for the time being.  But if there is a smarter way to divide the screen up I am ready to be educated.

« Last Edit: November 22, 2012, 04:19:22 AM by Softology » Logged
Fractal Molossus
Posts: 681

« Reply #3 on: November 22, 2012, 07:12:59 AM »

I don't use tile rendering to prevent time-outs - tile rendering is only used to create high-resolution images, and I always render whole fullscreen quads.

I think the best way to split up the rendering is to use progressive/accumulated rendering. Simple render to a offscreen buffer (a Frame Buffer Object), and when writing to the buffer, add the previous result. Then, when drawing the buffer to the screen, divide by the number of samples (this must be done in a custom shader). This way you can do progressive anti-aliasing or Monto-carlo raytracing (soft shadows, DOF, ...). Fragmentarium use a slightly more complex buffer setup, with two offscreen buffers, flipped at each frame, so that you can sample from neighbor points (this makes reaction-diffusion and game-of-life systems possible). I also use float buffers (32-bit for each channel), to avoid quantization errors, and allow for HDR rendering.

In Fragmentarium I use the alpha-channel to keep track of how many samples have been used - this also allows me to do weighted sampling, since I can use the alpha-channel for the sum of the weights.
Posts: 120

« Reply #4 on: November 28, 2012, 05:28:22 AM »

Thanks Mikael.

I only started down the tile based approach after I was using older GPUs for testing that kept timing out with more complex shaders.

Your other tips will come in handy when I eventually get the hang of shaders and GLSL to a more competant level.

Pages: [1]   Go Down
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Tiles format Mandelbulber BattleMetalChris 2 1324 Last post July 22, 2012, 01:45:25 AM
by BattleMetalChris
Fractal bathroom tiles Other Artforms Mrz00m 0 991 Last post June 21, 2015, 12:40:10 AM
by Mrz00m
Rendering: tiles visible in final render Fragmentarium « 1 2 3 » Sabine 31 3130 Last post September 08, 2016, 01:45:59 PM
by Sabine
Inconsistent coloring of Big Render tiles bug reporting JohnQForumPoster 1 601 Last post September 09, 2016, 09:43:44 PM
by JohnQForumPoster

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.182 seconds with 25 queries. (Pretty URLs adds 0.005s, 2q)