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 / Adding lighting to a Depth of Field shader??

Author
Message
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 12th Mar 2018 14:48 Edited at: 12th Mar 2018 16:06
Hi dear shader gurus. I need some help getting lighting to work.. What exactly do I need to add lighting / shadow back into the renderer?

I know the default PS shader adds lighting in the way the manual describes.
Basically a standard PS with lighting ;



However any combining I do keeps giving me a GetPSLighting 'function not found' error.

I am trying to combine with;



...which is the final render pass of a depth of field shader. I probably should add it to one of the blur passes instead, so it gets blurred too. But I basically want to understand why I am getting the aforementioned error.
Any tips of ideas pointing me in the right direction is greatly appreciated. I'm a bit stuck here.

I initially tried to uncomment the code below from the Depth ps pass, however the same error shows up... or no shadows shown

Attachments

Login to view attachments
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 12th Mar 2018 23:14
It's not exactly clear to me what you are doing... What are you combining ?
Anyhow the two shaders looks fine.
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 13th Mar 2018 01:52 Edited at: 13th Mar 2018 01:52
Thanks. Well, the problem is the blur passes and the final shader that handles the depth of field, seems to ignore shadows cast and received. The shader that handles the depth of field doesn't have lighting added (combined) with the final output, so instead of a blurry shadow whenever depth of field comes into play, I see no shadows anywhere.

The two shaders are correct in syntax, yes. However I am trying to add the lighting part of the standard pixel shader above to either one of the other two shaders posted. The full screen post processing seems to remove the shadows entirely as they aren't explicitly called or calculated in the shader codes.

I will have a bit more time Wednesday providing some errors and such, but uncommenting the lines in the last shader code posted does not work. No shadows show up, despite how that should work though, right?
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 13th Mar 2018 23:42


Hi again, the video above kind of shows the problem... there are no shadows, despite the lines about GetPSLighting in the shader code. What could I be missing here?

I can't record the first split second the program actually starts, but there's also a small amount of time where the regular shadows are visible. So it doesn't seem to be a problem with the shadows related code in AppGameKit 2 itself. The Depth of Field shader seems to ignore shadows. :/

It's a bit unfortunate.
Green7
19
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 14th Mar 2018 08:16
have you set up the shadow shading correctly? it does not work by only adding "SetObjectCastShadow( objID, mode )". You need at last to initialize the shadows by "SetShadowMappingMode( mode ) ".
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 14th Mar 2018 08:50
Hi
Im not sur, but perhaps the shadows are calculated when you call rendershadowmap ()
https://www.appgamekit.com/documentation/Reference/Core/RenderShadowMap.htm

I guess you use not sync (), but you use : update () render3d (), swap (), so you need to add rendershadowmap () to get the shadows i think.

I hope this help
AGK2 tier1 - http://www.dracaena-studio.com
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 14th Mar 2018 16:14
Quote: "
I guess you use not sync (), but you use : update () render3d (), swap (), so you need to add rendershadowmap () to get the shadows i think.
"


Ahhh, yes! Thanks a bunch. That fixed it. I did not realize that was necessary when using update() render3d() swap() manually. Thank you.

Login to post a reply

Server time is: 2024-11-27 14:37:23
Your offset time is: 2024-11-27 14:37:23