New DoF with DSLR model [WIP] need help

share shaders here
  • Author
  • Message
Offline
*sensei*
Posts: 373
Joined: 07 Mar 2013, 10:14

Re: New DoF with DSLR model [WIP] need help

Cool stuff.. it will be interesting to see where you take it! I also dislike the lens feature for most applications... Guess I just need to start working with it some more to make it interesting. Oh well that wont happen anytime soon... still on my coding break!

Offline
*sensei*
Posts: 445
Joined: 29 Jan 2013, 01:17

Re: New DoF with DSLR model [WIP] need help

.
Last edited by Rubber-De-Flubber on 25 May 2022, 18:38, edited 1 time in total.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 1498
Joined: 31 Mar 2012, 15:06
Location: France

Re: New DoF with DSLR model [WIP] need help

Rubber-De-Flubber wrote:Any chance I could try this out? :3
This.... ;)
_________________
Lian Li PC011 Dynamic, Corsair AX 1500i PSU, i9 10850K @5.0 Ghz, Aorus Z490 Ultra, RTX3090 MSI Gaming X Trio, 32GB Corsair Vengeance Pro RGB RAM@3600, Corsair MP600 1TB NVME System Drive, 10 TB Storage, W10 Pro 64, Custom Hard Tubing Watercooling Loop

Offline
*sensei*
Posts: 445
Joined: 29 Jan 2013, 01:17

Re: New DoF with DSLR model [WIP] need help

.
Last edited by Rubber-De-Flubber on 25 May 2022, 18:38, edited 1 time in total.

Offline
*blah-blah-blah maniac*
Posts: 565
Joined: 05 Apr 2014, 10:29
Location: Taiwan

Re: New DoF with DSLR model [WIP] need help

I'm stuck.

The goal is to conserve full res infocus area, while spliting alpha channel for temp blur texture.(require 2 sets rgba for separable bokeh to work)

I've tried split Alpha into rgba1 & rgba2(8th parts), but the final result looks pixelated.
here's the pic
Image

I'm still trying to use RGB as rgb1 and Alpha as rgba2 + a1, but it doesn't looks promising.
Does anyone have good ideas to do this?
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

Offline
*sensei*
Posts: 372
Joined: 28 Jul 2013, 23:26

Re: New DoF with DSLR model [WIP] need help

Wouldn't know... you downscale then upscale... will be pixels.
Maybe you can blur the upscaled texture again to wash out the pixels?

Or, maybe you should downscale to different resolutions, then overlay them all to get a single blur result (much like how the bloom shader works). would still be low quality.......

Not sure about this... I also tried messing with blur and cutting resolution, overlaying and blah... didn't like result.

Aliasing artifacts are a bitch. You need some very clever algorithm to approximate the original texture before scaling (save data in downscaled texture as floats then use floats to reconstruct image). Though I have no idea about such algorithm, I suppose people would pay a lot of money for such thing :) You can maybe do it by sampling neighbor pixels to approximate the missing ones when upscaling.

For example:

Image

Where Grey is the average of the vertical pixels, Blue of the horizontal pixels and Yellow is the weighted between the blue and grey.

Dunno, looks like performance killer :) certainly if using only 1 pass...

Offline
*blah-blah-blah maniac*
Posts: 565
Joined: 05 Apr 2014, 10:29
Location: Taiwan

Re: New DoF with DSLR model [WIP] need help

Prod80:
kind of complicated...

Tried vertical split screen in effect.txt with texOriginal. It works as intended, but I'm loosing precision in alpha channel (as blur weight) which makes visible blur steps every few inches.
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

Offline
User avatar
*master*
Posts: 229
Joined: 21 Feb 2013, 03:21
Location: Los Angeles, CA

Re: New DoF with DSLR model [WIP] need help

Are the alphas a1 and a2 constant (same blur value for all pixels)? If so, maybe you can take advantage of that and store the alpha value in a single pixel. Then use the space you saved to get more precision.
_________________
i7-4970K 4.8ghz, 16gb ram, Geforce Titan X 12gb vram, win7

Offline
*blah-blah-blah maniac*
Posts: 565
Joined: 05 Apr 2014, 10:29
Location: Taiwan

Re: New DoF with DSLR model [WIP] need help

number6
Sadly no, alpha it self also needs to be blured so that second pass can blur accordingly.

Here is the WIP version, both prepass.fx and effect.txt.
effect.txt
WIP.(have visible blur step)
(9.83 KiB) Downloaded 288 times
enbeffectprepass.fx
WIP. (will lose half .x res)
(13.71 KiB) Downloaded 302 times
They are essentially the same.

instructions
It has minimum focus distance related to focal length.
Blur radius (or circle of confusion) and depth of field are determine by f-number and focal length.
35mm for balance, 80mm for larger bokeh, 24mm has longer DoF. Basically the same operation as cameras.

TS_Axis determines tilt-shift rotation axis, TS_Angle for tilt-shift angle.

Edit: "temp" in prepass.fx is to demonstrate blur radius. set to 0 to disable it.
Edit: reupload files, set default values
Last edited by kingeric1992 on 24 Sep 2014, 03:30, edited 2 times in total.
_________________
Intel Xeon L5639 6C12T @3.96GHz | Gigabyte ga-x58a-ud3r | MSI GTX680 4G | 48G RAM | Intel 760p Nvme w clover bootloader
Flickr
YouTube

Offline
User avatar
*master*
Posts: 229
Joined: 21 Feb 2013, 03:21
Location: Los Angeles, CA

Re: New DoF with DSLR model [WIP] need help

Looks amazing from what I can tell, but I am getting what looks like clipping at the focal plane. Here's an example:

Image

Maybe it's my combination of .fx files causing it. Any ideas?
_________________
i7-4970K 4.8ghz, 16gb ram, Geforce Titan X 12gb vram, win7
Post Reply