Welcome to WSL!

New to the forum? Please read this and this.

[DEV] DCTL Convolve Bokeh Fuse

Where the future is being made, today.

Welcome to the WSL development corner!

In this forum, please post your development projects. You get kudos and feedback here.
Topics ideally have preset prefixes, and this is what they (might) mean:

  • [DEV] - very much work in progress, don't build a business on this, could go anywhere
  • [BETA] - should kinda do what it's supposed to do, please test, give feedback
  • [RC] - this may end up in Reactor soon, polishing up, now's the time for last minute thoughts
  • [ABD] - died a premature death, sadness, will not see the light of day ever (unless someone picks up the scraps)

Once a development project has been released (hurray), topics can be marked as - you guessed it - [RELEASED] :cheer:

Development topics only, please. For generic questions, how-to's, questions and inquiries about existing tools etc, please go to the appropriate other forums.
User avatar
Shem Namo
Fusionista
Posts: 686
Joined: Sun Oct 06, 2019 9:15 pm
Answers: 1
Location: North Israel
Real name: David Kohen
Been thanked: 9 times

Re: [DEV] DCTL Convolve Bokeh Fuse

#31

Post by Shem Namo »

That error message means that you are missing an f after a floating point number.
In this case the 3.0.

Here is a version that should work on OpenCL.
td_Bokeh (2).fuse
Great job on this fuse @tida!!
It looks very useful.

Cheers,
David
You do not have the required permissions to view the files attached to this post.

User avatar
Millolab
Fusionista
Posts: 824
Joined: Wed Oct 24, 2018 6:26 am
Answers: 6
Been thanked: 29 times
Contact:

Re: [DEV] DCTL Convolve Bokeh Fuse

#32

Post by Millolab »

maybe it's a Mac thing... but with a bokeh texture of 500x500 and a touch of Amplify, my computer took 63.2 seconds to calculate one frame.
Tested the same BG and a Bokeh texture (1024x1024) on Nuke NonCommercial using a Convolve node and it was almost realtime...

User avatar
tida
Fusionista
Posts: 257
Joined: Mon Jan 27, 2020 4:37 am
Answers: 1
Real name: none
Been thanked: 41 times

Re: [DEV] DCTL Convolve Bokeh Fuse

#33

Post by tida »

@Shem Namo thanks for solving the issue. Already saw that issue but I would like to come with a simplified update soon. But thanks again for the 2-pass Gaussian filter - had to exchange the _tex2DVec4 as it mixed up TEX_FILTER_MODE when combining with additional kernels.

@Millolab What do you want to do??? Don't think so that the aim should be to give your computer per frame a demand of 500x500x1024x1024 = 262.144.000.000 pixel (find/add/multiply etc.) calculations. This is, why I wanted to limit it. Don't try 4k by 8k and you will wait weeks with 100% GPU power and some 3080ti cards :) Please look, whether it will definitely give you a better quality. The subsequent integrated 2-pass Gaussian Blur should minimize the bokeh size in most cases dramatically, without noticeable quality changes.
Maybe an NSA computer will deal with it and give some higher fps. But they need for their beast an own power plant (approx. 150 megawatt) to feed with electricity...

User avatar
Millolab
Fusionista
Posts: 824
Joined: Wed Oct 24, 2018 6:26 am
Answers: 6
Been thanked: 29 times
Contact:

Re: [DEV] DCTL Convolve Bokeh Fuse

#34

Post by Millolab »

tida wrote: Mon Mar 01, 2021 2:55 am @Millolab What do you want to do??? Don't think so that the aim should be to give your computer per frame a demand of 500x500x1024x1024 = 262.144.000.000 pixel (find/add/multiply etc.) calculations. This is, why I wanted to limit it. Don't try 4k by 8k and you will wait weeks with 100% GPU power and some 3080ti cards :) Please look, whether it will definitely give you a better quality. The subsequent integrated 2-pass Gaussian Blur should minimize the bokeh size in most cases dramatically, without noticeable quality changes.
Maybe an NSA computer will deal with it and give some higher fps. But they need for their beast an own power plant (approx. 150 megawatt) to feed with electricity...
@tida I have no idea of what kind of calculation you're doing, actually.
Using 1920x1080 image + 500x500 Bokeh texture your fuse was slow but still usable. As I touched the Amplify slider then it took more than a minute!
I have no idea what the Amplify is doing. So, all fun apart, all I'm saying is that this method of convolution, maybe, is not very effective.
If so, maybe the best thing to do is what Thibaud suggested:
thibaud wrote: Fri Feb 26, 2021 4:08 am you could have the bokeh input be resampled to an optimal size when the input exceed a certain threshold and propose a switch "high-res bokeh" that bypass the resampling and use the provided bokeh input size.
That said: I tried doing the same thing on NukeNonCommercial and that was almost realtime. And I used a 1024x1024 texture.
Nuke is not using the same method for calculating the convolution.

User avatar
tida
Fusionista
Posts: 257
Joined: Mon Jan 27, 2020 4:37 am
Answers: 1
Real name: none
Been thanked: 41 times

Re: [DEV] DCTL Convolve Bokeh Fuse

#35

Post by tida »

The following, is an update of the simplified Bokeh fuse. Did rename the inputs, got rid of a bug, did cancel the chromatic abberation functionality and changed the limiting to a High Quality option.
td_Bokeh.fuse
The DCTL DepthToFocus Fuse will convert a depth map into a focus map. Would be happy about some feedback for improvements. Please note, Black is In Focus whereas White is Out Of Focus.
td_DepthToFocus.fuse

You do not have the required permissions to view the files attached to this post.
Last edited by tida on Mon Mar 01, 2021 6:25 am, edited 1 time in total.

User avatar
tida
Fusionista
Posts: 257
Joined: Mon Jan 27, 2020 4:37 am
Answers: 1
Real name: none
Been thanked: 41 times

Re: [DEV] DCTL Convolve Bokeh Fuse

#36

Post by tida »

Millolab wrote: Mon Mar 01, 2021 4:10 am As I touched the Amplify slider then it took more than a minute!
Sorry, now I understand. As soon as Amplifier is >1 it will calculate the pixel color in the console with one power function more. It seems to be, that one power function is much slower than some adding and multiplying, which becomes more obvious. I would expect similar or worse as soon as one would use sin or cos functions.
same thing on NukeNonCommercial and that was almost realtime.
Furthermore, Nuke seems to be based on Fast Fourier transformation algorithms. viewtopic.php?p=36388#p36388 This blows up my mind and I would appreciate finding some examples of how it can be coded. Maybe @JiiPii can teach as he has some experience with that. In general, you should try to get some speed advantages by using the Gaussian run. The use of this subsequent filter is similar to the sparse concept people use to accelerate simple bokeh's.
The following sounds nice, but you can forget some more complex bokeh's...
https://www.graphics.rwth-aachen.de/med ... eprint.pdf

User avatar
Kaleb
Posts: 27
Joined: Fri Aug 11, 2017 10:02 am

Re: [DEV] DCTL Convolve Bokeh Fuse

#37

Post by Kaleb »

I built a simple 3D scene and rendered the Depth channel through Render3D. This is the test result, there is some glowing effect on the edge of the focus object, I don't know if this problem is easy to fix.

Image

User avatar
Millolab
Fusionista
Posts: 824
Joined: Wed Oct 24, 2018 6:26 am
Answers: 6
Been thanked: 29 times
Contact:

Re: [DEV] DCTL Convolve Bokeh Fuse

#38

Post by Millolab »

tida wrote: Mon Mar 01, 2021 6:05 am The use of this subsequent filter is similar to the sparse concept people use to accelerate simple bokeh's.
The following sounds nice, but you can forget some more complex bokeh's...
https://www.graphics.rwth-aachen.de/med ... eprint.pdf
this looks very interesting!

User avatar
tida
Fusionista
Posts: 257
Joined: Mon Jan 27, 2020 4:37 am
Answers: 1
Real name: none
Been thanked: 41 times

Re: [DEV] DCTL Convolve Bokeh Fuse

#39

Post by tida »

Kaleb wrote: Mon Mar 01, 2021 6:46 am I built a simple 3D scene and rendered the Depth channel through Render3D. This is the test result, there is some glowing effect on the edge of the focus object, I don't know if this problem is easy to fix.
Yes, I see what you mean - it's a glow. Made a similar 3D setup - it's reproducible. It's especially obvious if the distance behind the focused object is farther away. Hope I find a solution...

User avatar
tida
Fusionista
Posts: 257
Joined: Mon Jan 27, 2020 4:37 am
Answers: 1
Real name: none
Been thanked: 41 times

Re: [DEV] DCTL Convolve Bokeh Fuse

#40

Post by tida »

@Kaleb will try to integrate a Sobel or Laplacian edge detection for the map, to get rid of the phenomenon.

User avatar
tida
Fusionista
Posts: 257
Joined: Mon Jan 27, 2020 4:37 am
Answers: 1
Real name: none
Been thanked: 41 times

Re: [DEV] DCTL Convolve Bokeh Fuse

#41

Post by tida »

The following update does include an Enhance Edge Slider. If it's kept set to 1 it will be disabled. In case you use a focus map, you might need to apply it as otherwise, some glow artifacts could arise at the focused subject.

Please try it and I would appreciate getting some feedback...
td_Bokeh.fuse
BokehEdgeEnhance.JPG
You do not have the required permissions to view the files attached to this post.

User avatar
tida
Fusionista
Posts: 257
Joined: Mon Jan 27, 2020 4:37 am
Answers: 1
Real name: none
Been thanked: 41 times

Re: [DEV] DCTL Convolve Bokeh Fuse

#42

Post by tida »

Now an update regarding the Depth to Focus Map Fuse. Did grab the idea from the great ZRemap fuse developed by @Shem Namo and integrated the possibility to work with the Z-Depth of a Renderer3D. That means you are able to define its Foreground and Background even by sampling options.

ZDepthIntegration.JPG


This will save you a ChannelBoolean as well as a BrightnessContrast workaround as shown at 17:00 by VFXStudy:

[attachment=1]ZDepthIntegration.JPG[/attachment]
You do not have the required permissions to view the files attached to this post.

User avatar
TerryPXM
Fusioneer
Posts: 86
Joined: Mon Oct 30, 2017 3:53 am
Location: Medellin, Colombia.
Been thanked: 1 time

Re: [DEV] DCTL Convolve Bokeh Fuse

#43

Post by TerryPXM »

@tida Maybe this could help

https://www.gamedev.net/blog/1455/entry ... -included/
https://github.com/TomCrypto/fraunhofer

Demo

User avatar
tida
Fusionista
Posts: 257
Joined: Mon Jan 27, 2020 4:37 am
Answers: 1
Real name: none
Been thanked: 41 times

Re: [DEV] DCTL Convolve Bokeh Fuse

#44

Post by tida »

@TerryPXM many thanks for all the information. I try to check how they implemented the FFT into the Frauenhofer App. At least one has to check all about FFT Cyclic Convolution. There is also an interesting patent US20140368494A1 from Nvidia.

User avatar
tida
Fusionista
Posts: 257
Joined: Mon Jan 27, 2020 4:37 am
Answers: 1
Real name: none
Been thanked: 41 times

Re: [DEV] DCTL Convolve Bokeh Fuse

#45

Post by tida »

This is an update of the DCTL Bokeh Fuse. It tries to compensate for luminance changes coming from the bokeh image. If the bokeh image is too colorful, you might need to change the brightness slider.
I included a Min Convolutions Slider which is active as long as High Quality is not enabled. You can achieve interesting effects if you try very small numbers.
td_Bokeh.fuse
In addition, I made a Macro to build up bokeh images. You can change the size of RGB/CMY areas individually to mimic symmetric chromatic aberration or other color effects. To receive a neutral color output without color tint it is helpful to use the LineScope fuse as well.
td_Bokeh_Image.setting

Bokeh with Color Tint: (left image, LineScope with 4x zoom shows averaged G>R>B)
Bokeh_CA_Tint.JPG
Neutral Bokeh: (left image, LineScope with 4x zoom shows averaged R=G=B)
Bokeh_CA_Neutal.JPG
Final:
Bokeh_CA_Final.JPG
You do not have the required permissions to view the files attached to this post.