Logo by KRAFTWERK - 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: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. March 29, 2024, 11:43:32 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: Fixup for Glow in Raytracer.frag  (Read 1283 times)
Description: Fixup for Glow in Raytracer.frag
0 Members and 1 Guest are viewing this topic.
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« on: January 09, 2014, 06:19:27 PM »

Hey, just fiddling around and found that the "glow" settings seem backwards and not on the object and I came up with this...

In DE-Raytracer.frag at around line 357 change this...
Code:
float stepFactor = clamp((fSteps)/float(GlowMax),0.0,1.0);
to this...
Code:
float stepFactor = clamp((fSteps)/float(1000-GlowMax),0.0,1.0);

then at around line 399 add a line to the floor hit test like...

Code:
if (floorHit ) {
hitColor +=Glow.xyz*stepFactor* Glow.w*(1.0-shadowStrength);
}
else // Glow in object is based on the number of steps.
hitColor = mix(hitColor, Glow.xyz, clamp(float(steps)/float(MaxRaySteps) * ((GlowMax*Glow.w) *0.01), 0.0,1.0) );

note the glow slider values in the attached pics (may require tweaking depending on the raytracer.frag you use)

Glow in object is based on the number of steps.
gleened from Marius' fragment.glsl: @ http://code.google.com/p/boxplorer2/source/browse/trunk/fragment.glsl


* glow-before.jpg (65.64 KB, 680x520 - viewed 278 times.)

* glow-after.jpg (62.66 KB, 680x520 - viewed 303 times.)
« Last Edit: January 09, 2014, 08:01:28 PM by 3dickulus, Reason: tweak » Logged

Resistance is fertile...
You will be illuminated!

                            #B^] https://en.wikibooks.org/wiki/Fractals/fragmentarium
SCORPION
Conqueror
*******
Posts: 104


« Reply #1 on: January 10, 2014, 02:43:18 AM »

Thank you 3dickulus!
So is working correctly!
And your code is correct?
So works:
Code:
else{ // Glow in object is based on the number of steps.
hitColor = mix(hitColor, Glow.xyz, clamp(float(steps)/float(MaxRaySteps) * ((GlowMax*Glow.w) *0.01), 0.0,1.0) );}
Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #2 on: January 10, 2014, 10:13:02 PM »

Yes, as implemented the glow is only outer glow - if you want inner glow as well, you will have to add it at the end:

hitColor +=Glow.xyz*stepFactor* Glow.w;

The glow strength in my shader is already based on the number of steps, exactly like in Marius':
float stepFactor = clamp((fSteps)/float(GlowMax),0.0,1.0);

The only difference is that the 'GlowMax' variable controls the number of steps that saturatures the effect, instead of always using MaxSteps - so lowering GlowMax will increase the strenght, which is probably why you felt it backwards.
   
Finally, it should be noted that Glow is more visible when lowering the Gamma-factor on the 'Post' tab.


* glow.jpg (52.67 KB, 400x354 - viewed 326 times.)
Logged
3dickulus
Global Moderator
Fractal Senior
******
Posts: 1558



WWW
« Reply #3 on: January 11, 2014, 02:53:23 AM »

Thankyou smiley Syntopia

yes it seemed odd that value 0 = max and glow was not in object just the background, a bit counter intuitive.
post gamma? that too seems a bit counter intuitive as post is where general image manipulation would be and not 3D object effects (thinking back to things I learned about animating vs image processing, gamma would be used for going to hard copy to compensate for the difference between screen colors and printed colors) something as specific as object glow was too sophisticated for post 2D stuff and would be rendered as part of the object , but now with amazing processing power and algorithms it's really just "what do you want and where do you want it".

while fiddling with it I found that "+=" went overboard hence  the mix(clamped) treatment

it's a really nice effect, I'm curious why it was done this way ( in background and not in object ) I suppose it's not a hi priority thing as it has nothing to do with calculating fractals and everything to do with aesthetics and if one is writing shaders it's, as you point out, trivial to add, unless you're a nube or not mathematicaly inclined, like me  embarrass

edit: I also didn't want the floor or other things glowing so I used the hit test to restrict to the object, that allows the original code to add the glow behind the object.
« Last Edit: January 11, 2014, 04:18:24 AM by 3dickulus, Reason: edit » 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 #4 on: January 11, 2014, 05:35:46 AM »

after a few minutes of twiddling and testing your line works best, not surprising at all smiley and I will add it to the DE-Raytracer.frags because it seems like the glow function makes more sense with this in place.
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
Small error in Complex.frag Fragmentarium JosLeys 2 1419 Last post June 08, 2013, 09:01:45 AM
by Roquen
Orbit Trap in GI frag Fragmentarium « 1 2 3 » vinz 38 7135 Last post June 20, 2013, 07:48:01 PM
by vinz
Rocket's Red Glow Images Showcase (Rate My Fractal) coldwetnoz 2 880 Last post August 19, 2013, 04:44:02 AM
by coldwetnoz
Strange interaction of glow and floor in DE-Raytracer Fragmentarium Feline 0 1252 Last post October 09, 2013, 04:48:58 AM
by Feline
Frag to GPU asm dump Fragmentarium « 1 2 3 » 3dickulus 30 6857 Last post June 16, 2015, 02:02:23 AM
by 3dickulus

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