Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / I need "Depth Of Field " shader please :(

Author
Message
GolWofael
8
Years of Service
User Offline
Joined: 15th Mar 2016
Location:
Posted: 25th Apr 2016 19:42
I need "Depth Of Field " shader please
GolWofael
8
Years of Service
User Offline
Joined: 15th Mar 2016
Location:
Posted: 25th Apr 2016 20:21
Guys .... I found this code ... But I need to convert it to AppGameKit


Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 25th Apr 2016 20:39 Edited at: 25th Apr 2016 20:45
Hello fellow,
maybe this can help:
- get the depth buffer image, create a shader that will take that texture
- combine it with a lowpass/highpass filter to filter out a color-segment(focus)
- apply a blur calculation over it and
- this result as a mask for the original screen render with a blur shader applied.


Currently I am stuck with work, but the time will come, where it becomes
urgent for me to have a DOF shader. Soon. I will share it, once I find the time for DOF.



Meanwhile you can run your own experiments:
This Guide is very helpful to understand the AppGameKit GLSL communication:
AGK Shader Guide

CreateRenderImage


Description
Creates a blank image suitable for rendering and returns an ID to reference it. This can be used with SetRenderToImage to draw things to images. You can create RGBA images for normal rendering or depth images for capturing the depth buffer on devices that support it. You can also choose to use mipmapping on this image or not, this overrides the global SetGenerateMipmaps() command for this image only, this is because mipmaps on rendered images can be a performance hit so it should not be used unless necessary. Mipmaps should only be necessary if you intend to use this image to texture objects in your scene, if you are only using this image for full screen shaders you should not use mipmapping on it.

Definition
integer CreateRenderImage( width, height, format, mipmap )
UINT agk::CreateRenderImage( UINT width, UINT height, UINT format, UINT mipmap )
CreateRenderImage( imageID, width, height, format, mipmap )

[/url]
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 25th Apr 2016 21:51 Edited at: 14th Sep 2017 19:23
At first we all must wait for version 2.0.19 to use depth images in shaders...

If you only need DOF and no motion blur -> I will play with depth images and maybe a DOF shader comes along
GolWofael
8
Years of Service
User Offline
Joined: 15th Mar 2016
Location:
Posted: 25th Apr 2016 22:07
Thanks Jack.... for your great help
GolWofael
8
Years of Service
User Offline
Joined: 15th Mar 2016
Location:
Posted: 25th Apr 2016 22:20
janbo ... I have to wait for version 2.0.19 this is the bad news
DOF with motion blur shader will be great but I think it will reduces performance
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 26th Apr 2016 11:30
I got this working by having a duplicate scene, all objects white with a black fog, then render that and use it as a blur reference on the main render. But it's not practical, a bit too slow to be of much use in an actual game, we need the new version of AppGameKit with depth render support.

I'd be happy to upload my test app if anyone wants to experiment with it though.
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 26th Apr 2016 19:11
Quote: "all objects white with a black fog"


This method is quite smart and should also work with one scene with acceptable framerates. Currently I work with shaders and see, that it would be easy to create a white to black ramp on applied geometry based on the camera position. This shader can be activated before the render of the depth image and should not hit the framerate too hard.

[/url]

Login to post a reply

Server time is: 2024-04-19 10:06:17
Your offset time is: 2024-04-19 10:06:17