Depth node plus luma blur, avoiding halo when white filter width is large

when I combine render node with depth node and luma blur, to blur the back part of a particle system,
if I use a white filter width large, it works great but there is always some halo left around the closer elements which shouldnt have any, I change the depth node from values to restrict the blurring to the back part of the system but I just cannot get rid completely of a bit of halo in the frontal part, any tips? thank you :slight_smile:

This is a fairly common problem with depth of field algorithms that use screen space information to produce the effect.

The issue is that a given pixel + a blur radius pulls samples in from all around it, some of those samples may be closer to the camera, some further, but the luma blur does not have any awareness of which samples are closer and should be discarded vs further samples.

To do this properly, or at least more visually correct looking you’d need a more intelligent luma blurring algorithm, or maybe some other clever way to cheat and make it look better.

Here’s one interesting article about the challenges:

This is still a pretty actively researched topic, so not sure there’s a perfect solution, just some better than others.

1 Like

@lucasm wow such a great answer, thank you so much. Well, not good news, I see that there is no clear solution in touchdesigner then mmm, I will have to make do with it as it is I see, just trying to make it look as best as I can. If anybody has implemented any tweak or alternative in touchdesigner please let me know :slight_smile:

1 Like

@lucasm as an alternative to the luma blur depth trick, is there a way to use depth of field controls in the TD camera to also blur the background? or is the luma blur depth trick the standard way of blurring far away stuff? :slight_smile:

@lucasm had another idea, for cases where the sharp frontal parts are all located at the bottom of the screen and the far away are located at the top, how can I mask the luma blur effect so that I simply make it not have an impact on the bottom part of the screen? thank you :slight_smile:

There’s this one pretty nice component made by another member of the community you could try. I’ve used it for some projects and it’s pretty nice, though still some subtle halo’ing its the best out of the box solution I’ve found for TD so far.

@lucasm awesome, thank you so much Lucas,
I downloaded it and checked its insides,
what Im not sure mmm is how to use it, havent incorporated much external components like that one,
do you have a simple example of using this new component to do such an effect with anything simple?
thank you :slight_smile:

its pretty easy to use, just plug your camera, render top, and depth top into those parameters circled in red, and you’ll need to tweak and play with the settings to your liking.

show focus is great, has a little yellow line that illustrates where the in focus area is.
circle of confusion changes the magnitude of the dof effect. autofocus can be nice if you dont want to adjust it constantly.

the settings at the bottom are more advanced, but you can see how they affect things by playing with them.


1 Like

@lucasm great will try it, I see that I can just load it separately and then drag it and drop it onto a different .toe and then I can use it, great

@lucasm yeh, Im using it but no results so far,
I put my depth node, camera and output node, but nothing happens,
I select “show focus” and I see nothing either, where is it supposed to appear that yellow line?
in the window of the component itself all I see are these squares with the first one pink that have nothing to do with my background node, mmm

@lucasm oh I seeee, I have to take the output of that component to a Null top for example and then I see its output. And if I have “show focus” marked then I see areas of the image that become Orange. And changing the From parameters of the Depth TOP I can make that Orange area change.
The funny thing though is that I still dont see blurring. I increase the Filter Size parameter of the component but I see no blurring. Is the blurring supposed to happen in the orange areas? and How do you increase the blurring?

thank you :slight_smile:

@lucasm

oh wow, this is a great component! just need to tame it properly :slight_smile:
I managed to blur now part of it by using

  • Max Blur Samples: increasing this finally blurs part of the scene
  • Circle of Confusion: controls the width of the sharp part of scene it seems
  • Filter size no idea what it does, apparently nothing

what is funny now is that, I see three types of parts:

  • Orange: it becomes Blurry
  • Yellow: it becomes sharp
  • Blue: it also becomes blurry

so thats a bit odd, so the yellow part in between is the one getting sharp (this is when Show Focus is active)

@lucasm still hard to control,
which parameters do you use the most? which are the key?
Max Blur Samples, Circle of Confusion, certainly,
which ones do you use and how

yeah that’s correct. it’s a component that simulates how a camera focuses. with cameras you have a certain depth from the lens that is most in focus, and as you get further away from that point in either direction it gets blurrier. Show focus just helps you visualize that then when you get it right you turn that off again.

I think you got it, you just have to play with the settings. scene scale will affect what settings to use, etc.

base_swaggy_example.tox (34.8 KB)

@lucasm thank you so much, two things:

  • in depth node, I see you left pixel format in “Depth Texture”, in my case I select there “32 bit float” and then in Depth Space I select “Reranged from camera space”,
    which is a better thing to do? what I have is what made luma blur work, but should I switch you Depth Texture?

  • What is Filter Size doing in that component? It does something but not sure what

  • this scene of mine is little in z axis, particle system going from like -1 to 1, maybe thats why its hard for me to find the point

@lucasm
If I select Depth Texture in Depth Node, then how do I control where is the focus mmm

on the other hand could you please clarify for me, what each of those colors mean? in the show focus setting

orange ?
blue ?
yellow ?

I still dont have it clear thank you :slight_smile:

and I definitely think this component is amazing, I just need to tame it properly :slight_smile:

  • I believe this tool is intended to be used with Pixel Format being “Depth Texture”, but you’d have to ask the creator to be sure. It seems to work as expected for me when I use that mode.
  • Ah I leave “Blur depth texture” off. It’s meant to help smooth some artifacts around depth discontinuities, but imo looks better with out.
  • yeah, short z depth will make it less easy to find.

I wouldn’t worry about all three colors, just look for the orange line/slice.
Orange is where the image is most in focus, and usually you place that orange slice where you want to draw the viewers attention to.

I think the other colors just indicate if it’s closer or further than the orange sice.

@lucasm I wish I could control this well, it is such a great component,
but I am applying to different scenes I am working on, and I can manage to make it all blurry, or all non blurry, but to make only some parts of these particle systems in 3d space blurry, very difficult, I cannot manage; what is most confusing of all, is that sometimes in the “show focus” mode, I manage to put some parts in orange, some in yellow and some in blue, and yet everything stays in focus, which is so odd; is there some kind of manual of usage of this I wonder, will search :slight_smile:

try turning circle of confusion up some as well for greater blur

1 Like

@lucasm , could you make me a favour please, attached is your example from a different perspective, could you change the settings of that component to have the first frontal boxes be completely sharp and the 3 rows behind them be blurry? I try everything and I cannot manage, maybe if you just set that for me I will finally get it

base_swaggy_examplev2.9.toe (37.7 KB)