Title: Independent Glow for DE objects with Ray Marching ? Post by: glennmarshall 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.. Title: Re: Independent Glow for DE objects with Ray Marching ? Post by: glennmarshall 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 Title: Re: Independent Glow for DE objects with Ray Marching ? Post by: cKleinhuis on June 12, 2013, 01:45:23 PM thank you for sharing, yet nice results, it all comes down to your object definition ;)
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 ;) Title: Re: Independent Glow for DE objects with Ray Marching ? Post by: glennmarshall 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..
Title: Re: Independent Glow for DE objects with Ray Marching ? Post by: glennmarshall 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..
Title: Re: Independent Glow for DE objects with Ray Marching ? Post by: elphinstone 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:
For scaling the glow color make a distinction of the two cases:
Hope it helps :) 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 Title: Re: Independent Glow for DE objects with Ray Marching ? Post by: glennmarshall 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..
Title: Re: Independent Glow for DE objects with Ray Marching ? Post by: Syntopia 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:
(http://blog.hvidtfeldts.net/media/glow.png) Title: Re: Independent Glow for DE objects with Ray Marching ? Post by: glennmarshall 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 :)
Title: Re: Independent Glow for DE objects with Ray Marching ? Post by: glennmarshall 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. |