Logo by DarkBeam - 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 us on facebook
 
*
Welcome, Guest. Please login or register. April 25, 2024, 05:33:27 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
  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: God Ray Octo Bulb  (Read 2785 times)
Description: This is my first attempt at actually hacking the GLSL code part of Fragmentarium
0 Members and 1 Guest are viewing this topic.
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« on: August 21, 2013, 05:49:23 AM »

This is my first attempt at actually hacking the GLSL code part of Fragmentarium
Something simple, add a "god ray" effect to whatever is being rendered.
Revised: Works best in the dark with some black fog.

<a href="http://vimeo.com/moogaloop.swf?clip_id=72793321" target="_blank">http://vimeo.com/moogaloop.swf?clip_id=72793321</a>

 Rendered with Fragmentarium 1.0b+
« Last Edit: October 07, 2013, 12:38:37 AM by 3dickulus, Reason: url » Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #1 on: August 21, 2013, 07:03:08 AM »

cool effect, well done.  smiley smiley


I am following all the fragmentarium animation posts with much interest, though with very little technical understanding. smiley

Logged
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #2 on: August 21, 2013, 07:42:03 AM »

tnx  smiley

I'm still learning something new every day, this little hack is far from perfect, it messes everything else up so it's render this effect only or render normally but can't just turn it on and off or ease in ease out... yet  smiley it's derived from something at https://github.com/larsendt/dynamic-tex, not coded entirely by me, I just figured out how to patch it in as a 'post' effect.
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 #3 on: October 06, 2013, 02:16:57 PM »

just for fun here is a little post-effect tutorial.

Files of interest: 3D.frag Buffershader.frag

Step 1:

In 3D.frag add the variables for the post effect to the variable editor by adding a new group before the "Post" group...

Code:
#group Godray
// based on https://github.com/larsendt/dynamic-tex
uniform int Samples; slider[0,0,500]
uniform float Intensity; slider[0,5.0,10.0]
uniform float Decay; slider[0.8,0.9,1.0]
// X screen location to emanate from.  Positive = out of screen Negative = into screen
uniform float ScreenX; slider[-1.0,0.5,1.0]
// Y screen location to emanate from.  Positive = out of screen Negative = into screen
uniform float ScreenY; slider[-1.0,0.5,1.0]
uniform int SubframeMax; slider[1,10,1000]

Step 2:

Then in Buffershader.frag in the main() routine after local variables and before the first test add...

Code:
// God Ray
// based on https://github.com/larsendt/dynamic-tex
if(Samples > 0) {
vec2 p = pos;
vec2 dir = vec2(ScreenX,ScreenY) - p; // Standard GodRay
float sam = float(1.0/Samples);
float i = Intensity;
if(ScreenX < 0.0 || ScreenY < 0.0) dir = p + vec2(ScreenX,ScreenY); // Anti-GodRay
dir *= sam;
for(int s = 0; s < Samples; s++) {
c += (texture2D(frontbuffer, p).rgb * i * sam) / float(SubframeMax);
i *= Decay;
p += dir;
}
}

Step 3:

Load the attached frag file with the 3Dickulus version of Fragmentarium and apply the GodRay preset.

Results: render test Posted above ^ ^ ^

* GodRayMandelbulb.frag (10.13 KB - downloaded 149 times.)
Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
LMarkoya
Strange Attractor
***
Posts: 282



« Reply #4 on: October 06, 2013, 10:03:02 PM »

Nice job and a cool effect  Repeating Zooming Self-Silimilar Thumb Up, by Craig
Logged
Nahee_Enterprises
World Renowned
Fractal Senior
******
Posts: 2250


use email to contact


nahee_enterprises Nahee.Enterprises NaheeEnterprise
WWW
« Reply #5 on: October 06, 2013, 10:20:14 PM »

    This is my first attempt at actually hacking the GLSL code part of Fragmentarium
    Something simple, add a "god ray" effect to whatever is being rendered.
    Revised:  Works best in the dark with some black fog.
            http://vimeo.com/moogaloop.swf?clip_id=72793321
    Rendered with Fragmentarium 1.0b+

Very nice effect with the lighting.  Some of the frames went by too quickly to appreciate the image, and at times the "light" was a bit too bright to actually see anything, but was a good initial test.     cheesy
 
Logged

3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #6 on: October 07, 2013, 12:21:11 AM »

Thank you X2 cheesy

just thought I should share the whole thing as it makes a good post-effect tutorial.

provides God-Ray and Anti-God-Ray effect or with a little math could track the spotlight source direction  cheesy
« Last Edit: October 07, 2013, 12:43:18 AM by 3dickulus, Reason: options » Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
barcud
Navigator
*****
Posts: 69


« Reply #7 on: October 07, 2013, 02:33:16 PM »

This 'rays through fog' effect was something I was looking for so I gave it a try.

I just wanted to do it for one image ut a bigger render and I came across the results shown below.
When I render it with the 'God Ray' to an image where the Buffer size is locke to image size it works fine.
If I want to create a bigger render (3x3 tiles) the rays seem to get lost somehow. sad

The files were created with the example frac, the changes to 3D and Buffershader and the subframe rendering set to 50.

Is that just me ( and my inability to use Fragmentarium) ?


* RenderAs3x3tilesSquares.jpg (51.56 KB, 867x528 - viewed 352 times.)

* RenderAsBufferSizeOK.jpg (56.99 KB, 867x528 - viewed 422 times.)
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 2512


Fragments of the fractal -like the tip of it


« Reply #8 on: October 07, 2013, 07:02:33 PM »

it looks more like a "zoom blur" wink
Logged

No sweat, guardian of wisdom!
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #9 on: October 07, 2013, 08:09:21 PM »

I'm sure you applied this correctly as your images show the effect and it's limitations.
As an exorcize for the user...  wink

ScreenX and ScreenY values need to be offset based on which tile we are in ie: in top left tile means offset to bottom right, 2x2 will be easy because 4 corners will be the center, more than that will get a bit more complicated.

(3x3) another bug that will show up is that when we are below and/or to the right the offset will be negative which will give an Anti effect ie:the rays may bleed from bright spots into the image rather than out.

this effect was not intended for anything more than a single frame image so it might be that for tiled images it will have to be applied post assembly, after all tiles have been rendered and put together as a single image or the code may have to be rewritten completely.

it looks more like a "zoom blur" wink
DarkBeam is absolutely correct, this is a POST effect, this is NOT raytracing light emanating from behind or within the object,
it is bright spots smeared in a direction from an offset point,
"zoom blur" is the process "god ray" is the effect?

Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
barcud
Navigator
*****
Posts: 69


« Reply #10 on: October 07, 2013, 08:45:32 PM »

OK, got it.
Still, a great effect.
Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #11 on: October 07, 2013, 10:23:05 PM »

Nice effect, 3dickulus.

Just to clarify: some screen space effects will not work in tile mode since they depend on pixels from other tiles. For tile mode to work, each pixel must be calculated independently.

But in Fragmentarium v1.0 and later, you don't have to use tiled rendering. Just set the Buffer size to 'custom size', and choose whatever resolution you want. The preview window will be limited to the dimensions that are currently shown, but when you do the 'High Resolution ...' render, the actual 'custom size' buffer settings will be used. Notice that this might time out the GPU, and make the system unresponsize for some time.
Logged
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #12 on: October 07, 2013, 10:56:16 PM »

Thank you Syntopia for pointing that out and thanks again for creating Fragmentarium.

As my "hacks" are applied to your codebase "Custom" buffer size is available in the 3Dickulus version as well
so the frag file and code posted above should work for any resolution that is rendered as a single frame with no tiling. A Beer Cup
however, if tiling is required then the code posted above will not work without a rewrite.

QImage/QPixmap XY axis are limited to 32767x32767 pixels afaik.
« Last Edit: October 08, 2013, 12:31:38 AM by 3dickulus » Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
Nahee_Enterprises
World Renowned
Fractal Senior
******
Posts: 2250


use email to contact


nahee_enterprises Nahee.Enterprises NaheeEnterprise
WWW
« Reply #13 on: October 08, 2013, 11:06:51 AM »

    This 'rays through fog' effect was something I was looking for so I gave it a try.
    I just wanted to do it for one image ut a bigger render and I came across the results shown below.
    When I render it with the 'God Ray' to an image where the Buffer size is locke to image size it works fine.
    If I want to create a bigger render (3x3 tiles) the rays seem to get lost somehow.  sad
    The files were created with the example frac, the changes to 3D and Buffershader and the subframe rendering set to 50.
    Is that just me ( and my inability to use Fragmentarium) ?
            RenderAs3x3tilesSquares.jpg
            RenderAsBufferSizeOK.jpg

Your last attachment turned out very good.     cheesy
 
Logged

3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #14 on: October 08, 2013, 11:18:18 AM »

good to hear, tnx

a bit of a roller-coaster ride cheesy
Logged

Resistance is fertile...
You will be illuminated!

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

Related Topics
Subject Started by Replies Views Last post
P 8 bulb inside a P 2 bulb. probably not... Mandelbulb Renderings KRAFTWERK 12 4501 Last post March 08, 2010, 09:45:21 AM
by kram1032
Bulb in a Box 2 Fractal Movies Power 8 0 1994 Last post April 10, 2010, 02:32:04 PM
by Power 8
another bulb Mandelbulb3D Gallery Bent-Winged Angel 0 1164 Last post June 21, 2010, 08:54:26 PM
by Bent-Winged Angel
PdoKlnStdDE octo Mandelbulber Gallery mclarekin 0 525 Last post October 08, 2016, 11:56:14 AM
by mclarekin
Prism Octo SphFold Mandelbulber Gallery mclarekin 1 773 Last post March 13, 2017, 07:59:24 PM
by paigan0

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