Title: Fixup for Glow in Raytracer.frag Post by: 3dickulus 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); 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 ) {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 Title: Re: Fixup for Glow in Raytracer.frag Post by: SCORPION 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.Title: Re: Fixup for Glow in Raytracer.frag Post by: Syntopia 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. Title: Re: Fixup for Glow in Raytracer.frag Post by: 3dickulus on January 11, 2014, 02:53:23 AM Thankyou :) 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. Title: Re: Fixup for Glow in Raytracer.frag Post by: 3dickulus on January 11, 2014, 05:35:46 AM after a few minutes of twiddling and testing your line works best, not surprising at all :) and I will add it to the DE-Raytracer.frags because it seems like the glow function makes more sense with this in place. |