Logo by HPDZ - 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 the official fractalforums.com Youtube Channel
 
*
Welcome, Guest. Please login or register. April 19, 2024, 05:21:25 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]   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: Independent Glow for DE objects with Ray Marching ?  (Read 2883 times)
0 Members and 1 Guest are viewing this topic.
glennmarshall
Alien
***
Posts: 26


« on: June 12, 2013, 09:26:34 AM »

Hi
I'm just wondering if it's possible to put glow on individual parts / objects within a DE scene using Ray Marching - e.g. having lots of spheres with a glow around them, but not the other objects in the scene.

And to expand further - would it be possible to add basic transparency / luminance to objects individually..
Basically I'd love to have my Ray Marcher do most of the things a standard 3d Ray Tracer could do.

I'm using this code for my work,
http://www.openprocessing.org/sketch/73427

Thanks..
Logged
glennmarshall
Alien
***
Posts: 26


« Reply #1 on: June 12, 2013, 01:37:31 PM »

i'm nearly there with the glow idea at least,
in this scene - I created a scaled up DE of the red sphere - and used it's value as a multiplier for the red glow - so that the entire scene doesn't get the glow, just the area around the red sphere.

the little problem i'm still having is that the glow is creating a strange banding artifiact on the background sky - looking into that now.
http://imgur.com/v03VcMd


* glow.png (136.85 KB, 661x427 - viewed 347 times.)
« Last Edit: June 12, 2013, 01:42:42 PM by glennmarshall » Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #2 on: June 12, 2013, 01:45:23 PM »

thank you for sharing, yet nice results, it all comes down to your object definition wink
BUT, you are tricking around, the glow should be - in my eyes - implemented as some kind of volumetric stuff, and the DE value should give you a densitiy value, similar to how cloud rendering using a raymarcher would work, problem with cloud rendering is that every point in a volumetric object emits light but in ALL directions wink
Logged

---

divide and conquer - iterate and rule - chaos is No random!
glennmarshall
Alien
***
Posts: 26


« Reply #3 on: June 12, 2013, 01:57:06 PM »

oh it's a shameless hack of someone else's code I'll admit, I'm far from an expert 3d programmer..
Logged
glennmarshall
Alien
***
Posts: 26


« Reply #4 on: June 12, 2013, 02:01:53 PM »

although it only adds the glow to geometry close to it so it seems- not background stuff in the distance - as seen in this version with a stronger glow..


* glow2.png (130.65 KB, 681x394 - viewed 313 times.)
Logged
elphinstone
Alien
***
Posts: 38



mattia.gollub
WWW
« Reply #5 on: June 12, 2013, 02:40:52 PM »

It's a technique I still not tried, but I think it's a good starting point for adding volumetric glow outside the sphere:
  • add a sphere concentric to the one you want to add glow to
  • when a ray intersects it check both intersections and measure the distance between them
  • scale the glow color using the distance calculate.
  • Let the ray continue through the scene (the glow sphere should not block it) and sum the traced color to the scaled glow color.

For scaling the glow color make a distinction of the two cases:
  • The ray intersects only the glow sphere: then s=\frac{d}{2*\sqrt(r_g^2-r_s^2)}
  • The ray intersects both spheres: the math gets a bit compicated here.. as a decent approximation I suggest to use just s=1. Or maybe you can get interesting results using no glow in this case.
Where r_s and r_g are the radius of the sphere and of the glow sphere. d is the measured distance, s the scale factor.

Hope it helps smiley This works just for spheres, but the idea is to use a scaled version of the shape you are drawing as "glow shape". The most accurate approach would be to "grow" the shape along the normals, but I think it gets really complicated :S
« Last Edit: June 12, 2013, 05:57:40 PM by elphinstone » Logged
glennmarshall
Alien
***
Posts: 26


« Reply #6 on: June 12, 2013, 05:50:23 PM »

Thanks - I think I get the gist of what you're saying - I might attempt it soon - for now I'd be happy with a quick hack.  If can get rid of the banding effect on the background sky I'd be happy - picture attached.  The glow seems to be horizontally applied to the sky - I'm trying to exclude the sky from all glow effects..


* glow3.png (165.12 KB, 711x461 - viewed 320 times.)
Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #7 on: June 12, 2013, 11:09:55 PM »

You can also just keep track of the closest distance to the objects you want to glow. And then add some color based on this distance in your lighting code:

Logged
glennmarshall
Alien
***
Posts: 26


« Reply #8 on: June 13, 2013, 12:20:39 AM »

thanks Syntopia! I think I could get my head around that - I'll give it a try and get back with any results / questions smiley
Logged
glennmarshall
Alien
***
Posts: 26


« Reply #9 on: June 13, 2013, 09:23:23 PM »

I actually decided to pursue the method I had started - and got it working the way I wanted.  I figured out the 'real' glow method - but what I was doing seemed more interesting, it's more of an intense radiosity / bounce effect.  I think it will lend itself to interesting colors and textures when working with something more complicated like an iterative fractal.  Thanks for all the help anyway - I'll post more pics as I develop the idea more.


* glow4.png (175.63 KB, 727x447 - viewed 347 times.)
« Last Edit: June 14, 2013, 01:34:53 PM by glennmarshall » Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
independent film maker requires help from fractal animators Let's collaborate on something! teamfresh 6 1074 Last post March 25, 2010, 02:38:40 AM
by teamfresh
A Blue Glow in the Dark Mandelbulb3D Gallery popol4444 0 675 Last post March 31, 2011, 05:56:23 PM
by popol4444
opengl, order independent tranparency ? Programming cKleinhuis 13 3609 Last post May 06, 2013, 11:20:35 PM
by cKleinhuis
Rocket's Red Glow Images Showcase (Rate My Fractal) coldwetnoz 2 916 Last post August 19, 2013, 04:44:02 AM
by coldwetnoz
Strange interaction of glow and floor in DE-Raytracer Fragmentarium Feline 0 1278 Last post October 09, 2013, 04:48:58 AM
by Feline

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