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 Studio Chat / Porting DBP shaders to AGK

Author
Message
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 11th Jan 2024 14:34 Edited at: 31st Jan 2024 00:00
Just want to let the agk community know that Im in the process of porting my newly updated Dbp shaders over to Agk and they might be useful for some of you.

Post processing


Shadowing


Lighting


Environment


PBR


Miscellaneous


Reconstruction


shaders are free, do what you want with them.
Scribble
7
Years of Service
User Offline
Joined: 2nd Apr 2017
Location:
Posted: 11th Jan 2024 19:21 Edited at: 11th Jan 2024 20:24
Finally, I've been waiting for this days for 10 years ( or at least feels like 10 years).
Advanced Lighting was a mandatory addtition for DBPro https://www.evolved-software.com/advancedlighting/advancedlighting

Are you planning to do Post Filters too? With the Bloom, HDR lighting, SSAO and everything?

EDIT: These pages/shaders seems to 404:
AGK-Bump Refractions.zip
AGK-Parallax Corrected.zip
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 11th Jan 2024 21:24 Edited at: 11th Jan 2024 21:25
The links should now be fixed, Some of the post filter shader might be a bit difficult to convert as there seems to be no option to use different texture formats when some shaders require rendering to rgba16f target such as the hdr/ssao for floating point accuracy.

I've done the conversions of the two pbr samples (I will do some more at some point) and that concludes the easy shaders to port over. Im now working on the shadow map shaders.I have noticed that agk dose not seem to calculate tangents for normal mapping so there is a CalculateObjectTangents(iObject as integer,iMeshIndex as integer) function you will need to call for shader with normalmaps (not sure if it will work on bone meshes mind you).
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 11th Jan 2024 23:10 Edited at: 11th Jan 2024 23:19
oh, my thanks for this and whatever else you bring to the AppGameKit side of things, evolved.

a couple thoughts:

1) are these tested in Classic or Vulkan-only? i'm ignorant to shaders but i think there might be differences and since you posted in Studio, i wonder.

2), drop a screenshot or 2 into the first post and this would probably be better kept in the AGK Showcase board? i'll be happy to move it there.

3) project added to the AGK Resource Directory for quick reference

thanks again!
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 12th Jan 2024 00:33
Thanks so much, excellent as always
Win 10 Home 64, Intel(R) Core(TM) i5-10300H, 8GB DDR4, NVidia GeForce GTX 1650 4GB GDDR6
Dark Raven
9
Years of Service
User Offline
Joined: 27th Jul 2014
Location: United States
Posted: 12th Jan 2024 01:46
Tested a couple of them and these are great thanks. I've also tested in Classic and can confirm that these WILL NOT work with classic. In studio it seems that the version of glsl that is a higher version. Even if you set to "basic" in studio you will get compile error in the shader language. But for studio these are pretty cool shaders. Thanks Again.
Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 12th Jan 2024 13:42
Wow, great stuff. Always loved your work!!
Regards Sph!nx
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 12th Jan 2024 16:58 Edited at: 12th Jan 2024 21:34
I've updated all shaders today, some should now work with #rendering set to basic. If a shader has equirectangular mapping (used for reflection/pbr/cube light example) you will need to change "textureLod(texture,uv,mip)" to" texture2d(texture,uv)" (remove the mip value) in the ps shader, this is used to remove a texture seam with the equirectangular technique and produce roughness effect.

speaking techniques, I'm not haveing much luck converting the shadow map shader. In DBP we have techniques as part of the hlsl file, so you can use these to swich between different shader effects in an efficient manner. To try and emulate this, I have made some "effect" functions which the newly updated shaders now use.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 13th Jan 2024 15:18 Edited at: 14th Jan 2024 12:33
Wow that's a surprise !

I left my shader work on a system where you can place bounding boxes for a parralax corrected PBR shader in an editor and then interpolate between them depending on the objects position using SDF's. (barycentric coordinates where an option too)
While those shaders are already more usefull than the PBR shader that came with AppGameKit Studio we are still missing some good tools to create the textures and data for those effects like the equirectangular textures for example.
Normally i'd say that i try to put some code together to render those equirectangular maps inside of your AppGameKit Levels but i don't have any time lately and i even got most of the code already.
But maybe those features will come with Mapscape 3 ?
Anyway thank you for sharing and by the way your work for DBPro is part of why I made the shaderpack and it's nice to once again scroll through your code.
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 13th Jan 2024 23:05
Awesome work, Evolved legend. Small request as well i have 2 shaders i was working on here that ive given away for freely but there not fully compatible and are missing some lighting ect if you would like to take a look maybe you could tweak them a bit and redistribute them for use https://forum.thegamecreators.com/thread/229443 i Will be using your shaders soon. Agk has needed some community shaders. Point light shadows it what kept me from working on a few projects

Qube_
9
Years of Service
User Offline
Joined: 21st Oct 2014
Location: Omnipresent
Posted: 13th Jan 2024 23:14
Wow!, these are very impressive and generous of you to share. Wish I could understand how to do shaders but my brain just doesn't understand a thing. Perhaps I'm overcomplicating things in my head
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 14th Jan 2024 11:43
Just converted the world reconstruction form depth shader, this means I can convert the SSAO shader. This is quite usefull for deferred rendering and you could actually use this to set up a light pre-pass render by rendering normals xy+depth then do lighting calculations and proj lighting results back over geometry (crysis 2). The shadow shaders are mostly done, not too happy with some of them mind you so will come back and have a second look. Point light shadows will need an alternative way and will look at this at a later date.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 14th Jan 2024 11:58 Edited at: 14th Jan 2024 13:29
Alright i did it anyway and found the time this morning.
I added the ability to render the Equirectangular maps without going through cubemaps inside of AppGameKit directly.
I adopted EVOLVED's coding style and added a self contained CreateEnvironmentMap command into the common.agc wich you can pass the effect to render with and the width and height of the renderimages.
I also altered the LoadEffectTechnique to accept fullscreen shaders.

You can see here I added a third object wich is reflected in the environment map of the center object:
Download: Equirectangular Reflections

Attachments

Login to view attachments
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 16th Jan 2024 00:17
All shaders have been updated as I have done some work on the "Common.agc". I've uploaded a skinned mesh animation/fast bone shader just to make sure the altered CalculateObjectTangents() function would now work with objects with animations, as this function now works by adding vertex tangents to an existing mesh attributes.

I'm now taking a small break from agk to do some work on treeit.

@janbo
Ive added your LoadFullScreenShader() change to the Common agc. Did not even know this command existed, is there any other usefull commands that exist like set cameraclip or setobjectcolorwrite?. ColorWriteEnable was so darn useful that I relied on a lot with dbp hlsl shaders as you can render different single channel effects or objects onto the same render target.

There are some things that I'm finding quiet bizza with agk like only having one camera but there is a camera ID, just feels half finished. I also take it only 32bit rgba and 24bit depth textures are the only texture formats that agk has ? no rgba16f etc ?. Is agk even still being developed as I've only just started using it last week, despite owing a copy for some time it just seems like there some useful rendering stuff missing (wireframe+point rendering also being very useful).

Good job on ther equirectangular reflections might see if this can be adopted to render point light shadows. I've made some changes to "Shared Shadow Maps" sample which combines the 4 24bit depth maps into one 32bit rgba texture as a postprocess pass, maybe something similar can be accomplished when creating an equirectangular map.

janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 16th Jan 2024 08:30 Edited at: 16th Jan 2024 09:06
Yeah there are quite a few commands that feel that unfinished.
And the support has decreased a lot, but rumors are that TGC will make AppGameKit some kind of Open Source.
There are commands to load shaders from strings now LoadShaderFromString so we can generate em or add define values to activate different parts of code for example. So we could create ubershaders that does it all.
There is the command SetCameraBounds to create a off center projection and you set the near and far clipping plane with SetCameraRange verry usefull to only render into parts of an image.
I tried to render point light shadows using equirectangular maps too, but only ever made it for cubemaps really.
I also always try to be compatible with AGK's generated shadercode so the comunity can still use the build in commands on the objects so have it easier to get started.
If you get it working properly make sure to also render a stack of the shadow maps below each other in one image so we have several point lights and don't use up all texture stages as we need them for other stuff
Doing this for cubemaps is kinda ugly if you try to stack them as you want to save space so you pack em in an F formation and every second image you have to mirror the formation ect.
If you also want to support mobile we have to encode the Depth map into an RGBA image and decode it in the shadow shader later again:

Also i noticed you still use Dim and undim but we can do this now:

And did you find the ref keyword for calling by ref in functions ? only for custom types tho

How come you're looking into AppGameKit ?
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 26th Jan 2024 04:15 Edited at: 26th Jan 2024 04:19
Just a quick update, as I have now managed to port over most the currently available shaders over to AGK.

There now is a point light shadow mapping sample that makes use of dual paraboloid mapping, I did try this with equirectangular maps but there were errors towards the top and bottom. I did struggle to port this over to agk at first, the issues was a real need for multiple cameras as using the same camera over and over again was just real mess. So I've now added some usefull camera functions to the common.agc code base to which all the samples now use.

I've also made two new agk only shader samples, one is "AGK Lighting Parallax" which just combines parallax mapping with agks generated shadercode so the inbuilt lighting/fog system is used. A simple bloom shader is another sample which I think look pretty decent for sRGB limited color range, there is also basic eye addaption added that chages the objects brightness rather than being a part of the post processing pipeline (same method as agks tonemap shader sample).

I'm now looking at working on a merged shader sample that combines Bloom, Dof, light scattering and fxaa.

@janbo Thanks the info!, I did have a look into agk generated shadercode and ended up adding it to most my basic shader samples such as toon/fur/environment shaders. Set camera bounds was also usefull for a custom set "CameraView" function as part of the added camera commands, the only downside is clearscreen() clears everything regardless of what the scissor is set to.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 29th Jan 2024 17:47 Edited at: 29th Jan 2024 17:56
Thats a nice set of camera commands and i never thought about using one byte of depth and combining them as a depth map into one image but i guess the limited precision doesn't matter for nearby objects or lights with a low range.
My wish for AppGameKit is to combine PBR with Parralaxcorrected environmant maps and all kinds of shadow mapping
with the objects automatically interpolating between the best prerednered environment maps and all that without the use of external Editors in AppGameKit for wysiwyg.
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 31st Jan 2024 02:10 Edited at: 31st Jan 2024 02:12
All shaders have been updated to fix an issue, I some how failed to normalize the normals and tangent vectors which would result in incorrect normals if you were to scale objects so this should be now fixed!.

Also added some new shaders samples "snow" and a "matcap" using a thermal vision texture. There is also a PBR lighting sample to which combines most of the shaders so far. I did rework the "Dual Paraboloid" shadowmaps to use just single shadowmap texture as I did plan on adding this to the new "PBR lighting" sample, but the pixel shader instruction count was getting a bit high so I left it out. If any one wants, I could still add it to the sample so we can have 8 lighting array lights + 4 point shadowing lights on screen at any given time but the performance would be pretty dire.

@janbo
I have given it some thought on how a real time lighting system could be added, the way I would go about accomplishing this would be using a pre-pass system with overlapping shadow masks and a reflection render.

Geometry pass 1) Render Depth + Normals xy with fractional values in zw for extra normal precision (might not be necessary mind you).

All pre-pass renders done in a deferred rendering manner:
Pre-pass 1) Render shadow masks 1, incorporates directional shadows in red channel and the fist 2 overlapping point/spot light shadow masks in the green/blue using additive blending.
Pre-pass 2) Render shadow masks 2, incorporates 3 more overlapping point/spot light shadow masks, this only needs to be rendered if more than 2 on screen lights have an overlap (still using additive blending btw).
Pre-pass 3) Render reflection probes, largest to smallest in RGBE8 format. We can use noise to create a transitions between probes so no alpha blending is needed.

Geometry pass 2) Render our lighting results making use of the above pre-pass data, I'm hoping that the depth buffer is still intact so we can just use SetObjectDepthReadMode=equal and render to the same rendertarget to make use of early z rejection (just like the depth prepass method that most other game engines use).

This will allow you to have parallax corrected reflection probes + multiple on screen shadowing lights, but there would be a limit of 5 lights that can overlap at any given time (not to much of an issue as lights are usually spread out). Lights will have to make use of an inscreen/in view frustum light array, if there are 50 lights on screen, we will have to cycle through 50 lights each pixel. We can make use of the shadowing prepass masks to create a bunch of optimizations on whether or not to do the lighting calculations though, A tiled render(if possible) here would also help performance.
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 31st Jan 2024 05:52
The new PBR looks sweet. Thanks yet again! " If any one wants" depends on how much of a hassle that would be for you, if nothing else it would be really interesting to see how dire
Win 10 Home 64, Intel(R) Core(TM) i5-10300H, 8GB DDR4, NVidia GeForce GTX 1650 4GB GDDR6
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 3rd Feb 2024 01:34 Edited at: 3rd Feb 2024 02:00
Nice you incorporated rendering the reflection probe aka. environment map in AppGameKit for the PBR Demo ! but you used that probe/map for all objects ^^
Your system sounds like only the shadow and lighting part is kinda deffered and the rest is still forward rendering ? do i understand that correct ?
I don't know how one would do reflections in a deffered way anyway ^^ or are reflections always deffered since that only means that it is processed at a later stage and reflections always involve environment maps in between
For your snow shader i wouldn't use a random sampling method as it flickers when the vertices are being deformed so maybe use SetShadowSmoothing(3)
And parralax correcting the environment map would be beneficial for the PBR Demo too i think, as you'd see the floor in the cube reflections better.
wait a minute they are parralax corrected but the bounding box is setup so it looks infinite...did you do that cause the cubes are also in the Environment map and it would become more obvious ?

I love what you do and im happy that i still understand it all...probably until you start with deffered shading cause i only dabbeled with it a tiny bit but I'm exited for that
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 15th Feb 2024 10:04 Edited at: 15th Feb 2024 10:05
Very nice work indeed!
I have a small question: Can these shaders work on TIER 2?

Thank you!
www.alexmatei.com
Scribble
7
Years of Service
User Offline
Joined: 2nd Apr 2017
Location:
Posted: 6th Mar 2024 12:34 Edited at: 6th Mar 2024 15:49
Thank your for your continuous great work. Happy to see you're having breakthough with post-processing. There is no need to ask, I'm 2690% sure everybody around here wants PBR, so as your other shaders such as the tree and cloud shader that you have made for DBPro. This reminded me of the excitement of when Janbo introduced his Shader Pack a few years back. AppGameKit sorely (or rather desperately) needs these visual enhancers.

I'm not sure if the tree shader can be used for grasses, but if you are looking for suggestions, may I suggest grass shader next? Something like Black Desert Online grass
https://www.youtube.com/watch?v=ozwyUwijQlM
And before I forgot, vertical fog shader.

Seriously, why aren't these featured on TGC Newsletter yet? These should have become the frontpage, or rather, THE newsletter itself. A permanent fixture. Pin it to the top of the forum too. Also pin it to TGC website login screen for good measure. That's how important these projects are to AGK.

Login to post a reply

Server time is: 2024-05-02 20:45:11
Your offset time is: 2024-05-02 20:45:11