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.

DarkBASIC Professional Discussion / SSAO Shader Not Working

Author
Message
Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 19th Mar 2014 14:40 Edited at: 19th Mar 2014 14:45
I'm trying to write an SSAO shader, basically by converting an OpenGL shader, but as we all know I'm not great with shaders. I need a depth texture for the SSAO to work, so I decided to try to create one in a separate pass (initially; I'll attempt to optimise later), but I just cannot get it to work.

As far as I can see, this shader should work fine for rendering a depth map to the screen....I don't know why it's not. It's just black. I can set the pixel shader's output to constants and make it render a solid colour, but it refuses to render the depth.

Any pointers?



EDIT: Hangon, here's a more distilled version without all the commented SSAO code...purely depth rendering in this one (still doesn't work):



Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 19th Mar 2014 14:45
Do you have your render target set both as an output image and as a texture for some object you're using that shader on?
I don't think it likes having an image bound to both the input and output stages at once.


"Why do programmers get Halloween and Christmas mixed up?"
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Mar 2014 15:42 Edited at: 19th Mar 2014 15:43
Not sure what your code is trying to do. This is what I get with some adhoc changes to the vertex shader:







Powered by Free Banners
Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 19th Mar 2014 23:30
I forgot to mention it's a fullscreen shader, not a model shader.

Quote: "I don't think it likes having an image bound to both the input and output stages at once."


That may or may not be the answer, but it gives me an idea

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Mar 2014 23:52
Quote: "I forgot to mention it's a fullscreen shader, not a model shader."


I wondered about that. What's the input object? Is it a screen quad? If so, then I guess you'll get a uniform depth.



Powered by Free Banners
Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 20th Mar 2014 00:06
Quote: "Is it a screen quad?"


I assume so (I'm testing in Dark Shader). Is there another way to do fullscreen shaders?

Quote: "If so, then I guess you'll get a uniform depth."


Meaning...it would all be one shade of grey? But why? And how else would you render depth with a fullscreen shader?

Oh, I think I see. So.... a shader applied to a quad will only go through the quad's vertices and not those of the entire scene like I thought, right? Hmm....now I have no idea how to get a depth texture...

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Mar 2014 00:36
Quote: "Hmm....now I have no idea how to get a depth texture..."


The same way a shadow mapping shader does it. In DBPro you'll need a separate render of the whole scene using a shader on each object with a depth technique. In a deferred rendering system, you could have a geometry pass that records the position of each pixel. That could, if necessary be followed by a depth pass that simply calculated depth from the position. In that case a textured quad would be the input and a textured quad would be the output.



Powered by Free Banners
Clonkex
Forum Vice President
16
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 20th Mar 2014 00:43 Edited at: 20th Mar 2014 00:44
Quote: "The same way a shadow mapping shader does it. In DBPro you'll need a separate render of the whole scene using a shader on each object with a depth technique."


In that case I can't do what I'm trying to do, which is to hack SSAO into FPSCReloaded (I don't have the source so I can't set up anything that can't be done in a bloom shader). I was trying to make it look as much like Half-Life 2 as possible to see what it could look like, but I guess I'll have to ignore AO and move onto better textures

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Mar 2014 01:09
Yes, that would be a difficulty.



Powered by Free Banners

Login to post a reply

Server time is: 2026-07-06 07:50:21
Your offset time is: 2026-07-06 07:50:21