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/AppGameKit Studio Showcase / App Shader Kit (3D Shader Pack)

Author
Message
janbo
11
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 27th Dec 2019 19:34
Just found the PBR Demo in the Example folder yesterday (thanks Vitium for mentioning it in Discord ).
Looks nice but you can't really use it with moving Objects yet, cause you need to pre bake all and everything.
So I went ahead and made the Equirectangular mapping, used for the reflections in the PBR shader,
with a single rendering step, so one could now generate the Environment maps on demand in runtime in AppGameKit itself.
janbo
11
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 27th Dec 2019 19:35 Edited at: 27th Dec 2019 19:36
Sorry for the tripple post
nonom
2
Years of Service
User Offline
Joined: 12th Nov 2017
Location: Aden
Posted: 29th Dec 2019 14:22 Edited at: 29th Dec 2019 14:22
Totally agree; @janbo is my hero
janbo
11
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 29th Dec 2019 18:19 Edited at: 29th Dec 2019 18:20
There is still a better way than generating the environment maps as soon as an object moves.
You can setup a bounding box and place those maps in the corners, then you can interpolate between them.
So as long as you move inside this box you don't need to update anything in AGK.
Also you can calculate something called parallax corrected normal which corrects the normal for when you move near the environments bounding box.
But I'm not at that stage yet.
Santman
8
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 29th Dec 2019 18:53
Is it PBR though? Given it's just a diffuse and a normal, isn't it just.....normal mapping?
janbo
11
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 29th Dec 2019 19:01 Edited at: 29th Dec 2019 19:30
Nono, the PBR Example Demo uses those Equirectangular maps to produce those nice reflections.
Now If you try and move the objects in the Demo you'll see the reflections stay the same cause there is no fancy parallax corrected normal calculation nor updates for the Environment map(the Equirectangular one)
But I can create those environment maps in AppGameKit using a shader, so updating them is possible now.
Actually I have the code for Screenspace,Dualparabolic,Cube and now Equirectangular mapping working, there are not many left
Santman
8
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 29th Dec 2019 19:29
No I know, I disected it and put a post on the FB page...Preben still gets credit for the "PBR" demos in Syudio that aren;t PBR at all. Lol.

Shader king Janbo....you'll need to do sme for the World Builder.
janbo
11
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 29th Dec 2019 19:39 Edited at: 29th Dec 2019 19:42
Quote: "you'll need to do some for the World Builder"

I would love to help you out a bit but not too much cause I don't want to ruin mine and TGC's bussines giving shader pack shaders away inside the world builder...you know
Also wouldn't be too fair for those who alrady purchased the pack and I still want to be able to tell everyone that I make real money with a product I entierly made my self
If we create an exe only version, I can make you some here and there...
But please don't think I wont help on shader stuff anymore....definitely not the case !
Bengismo
2
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 29th Dec 2019 22:27 Edited at: 29th Dec 2019 23:24
Hey janbo

The equirectangular mapping is pretty cool and is a much easier uv lookup then cubemaping or dual hyperbolic, so its quick.

I did a very simple scene and have been comparing the different reflection maps


I can generate the equirectangular map and the others two (see above) but im wondering what filtering to do between the mipmaps down the image for texture 2 (is it just a simple blur?) and its not obvious how to choose an exponent value when trying to make a new reflection map (for texture 2). The ones used in the shader are not sRGB and the HDR calcs are new to me.

Are you generating all 8 mipmap levels for the HDR reflection maps too? And are you storing the hdr exponent in the alpha channel like in the demo's?

The lightmaps (texture 3) are stored in the same way...its the first time ive seen HDR packed textures used like that.

AGK teir 2 has GL cubemaps properly built in but its not accessable in teir 1 (arghh). Thats a real shame as it would be good to use open GL cubemaps properly (with accelerated hardware lookups) rather than complicated shader based UV translation version that we have to do in AGK.
janbo
11
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 29th Dec 2019 23:27
I don't think I can convert them into High Dynamic Range as we can only render the environment into LDR images, so if possible, it wouldn't make a difference in apearance if we calculate it in the PBR shader itself, not ?
I'd probably take an example from https://learnopengl.com/PBR/IBL/Diffuse-irradiance and https://learnopengl.com/PBR/IBL/Specular-IBL
But to stay simple you can also access all 8 mipmaps of the texture with textureLod(myTexture, textureCoord, mipmapLevel)
Bengismo
2
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 29th Dec 2019 23:36 Edited at: 29th Dec 2019 23:39
The PBR shader uses HDR textures in the demo ....so its textures have RGB values and A is the exponent for a pow (RGB,(Alpha*256)-82)....so the colour values used intenally have a huge range ....like >5million vs 0-255 for LDR

It would be possible to render the reflection map with the larger dynamic range I guess.

The PBR shaders use the IBL specular reflectance already.....Thats all done.

What i meant is that the reflection maps that it uses are actually 8 different maps at different mip levels so that roughness and blurred reflections work properly. They are mipmapped down the images vertically (not actually mipmapped in open GL). The reflection map is 8 images stacked vertically.

Ive got a shader working tonight that works out the 8 levels and applies a blur to correctly produce the right result but it takes 2 steps instead of one.

The PBR example shader uses all 8 levels to produce reflections depending on surface roughness. Its really cool and interpolates between the levels. The shader always uses the top level to control the bluring internally based on the roughness value stored in the alpha of the normal maps.
janbo
11
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 30th Dec 2019 00:10 Edited at: 30th Dec 2019 00:28
Did't venture too much into the Demo. Where do you see it using the OGL mipmap levels ? which you'd use for roughness(not talking about the stacked images)(forget that)
If we don't mind using two steps we could use the texture2Dlod to produce the 8 stacked environment images.
I'm probably missing something...to late for me...good night ^^
Bengismo
2
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 30th Dec 2019 00:20 Edited at: 30th Dec 2019 00:23
Quote: "Did't venture too much into the Demo."


Fair enough.

The demo uses HDR images for the reflection map (texture 2) and the light map (texture 3). Both these textures have a exponent stored in the alpha value so that the range of brightness/colour values stored in those textures is massive and creates a much more realistic result in the final image especially when used with the ACES tone mapping. Its the same tonemapping used in various newer engines.
Each of those images is also actually 8 images stacked in the y direction . No internal open gl mipmapping is used as it produces horrible results with blocky squares. Instead 8 levels are generated by sucessively blurring the reflectance map and lightmaps. This is done with the HDR being used too so its super accurate and creates really lovely accurate smoothed reflections. The

Quote: "Where do you see it using the OGL mipmap levels ? "
It doenst use open GL mipmap levels...it has 8 images in the one PNG file stacked vertically. As I said above...the detail levels are stored vertically. The roughness and fresnel reflectance calculate which two levels to use and blend between for each pixel.

Quote: "If we don't mind using two steps we could use the texture2Dlod to produce the 8 stacked environment images."
You dont want to use open gl LOD levels for this as the results are terrible.....plus they dont work on a HDR image anyway.

Quote: "I'm probably missing something...it's midnight in germany...good night ^^"
Goodnight....lol same time here.

Im thinking preben or GaborD wrote those shaders or borrowed them from somewhere..
janbo
11
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 30th Dec 2019 00:43 Edited at: 30th Dec 2019 00:56
Besides knowing it uses the alpha channel to calculate the hdr values and the environment being 8 stacked blurred images, I looked into the shader again a you are right about the roughness, also prebaking the environment maps using a nice blur will produce a nicer result indeed.
So what blur algorithm to use, gaussian ?
(Hammersley sequence?)
And do you use all 8 texture stages of a shader or 8 sprites to combine your texture atlas.(im using the shader aproach)
Santman
8
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 30th Dec 2019 09:59
Perhaps this needs a new thread?
janbo
11
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 30th Dec 2019 10:36 Edited at: 30th Dec 2019 10:47
[Edit]Made a new thread for this [/Edit]

The right Object I have added uses the Cubemap and a PreFilterConvolution shader which produces those nice blurry effects.(You beat me to it)
I think anything else than cubemapping would produce wrong results here.( as you'd need to incorporate the streching at the top and bottom somehow)
Not sure If I should try to create an equirectangular map from the final result

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
13
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Mar 2020 09:51
I've not read right through this massive thread but I notice Edge Detection is not mentioned in the purchase page. Ironically enough it's the main one I would like.
Is it no longer available? It is perfect for many of my CAD projects!
Using AppGameKit V2 Tier 1
janbo
11
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 20th Mar 2020 22:05 Edited at: 20th Mar 2020 22:09
The websites just aren't up to date.
There is EdgeDetection but it can only handle narow lines as every other algorithm would be quite to performance heavy for my taste.
What are you up to ?
Conjured Entertainment
AGK Developer
14
Years of Service
Recently Online
Joined: 12th Sep 2005
Location: Nirvana
Posted: 21st Mar 2020 01:04
WOW !

I have not read through the entire thread either, but that image above is truly worth a thousand words.

Absolutely amazingly cool.

Quote: "Shader king Janbo...."


Most impressive Janbo, and I have to agree that you are the shader king.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
janbo
11
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 21st Mar 2020 21:23 Edited at: 21st Mar 2020 21:24
Well thanks, but the only contribution to the image obove is the Cubemapping,Equirectangularmapping and PreFilterConvolution shader to make real use of AGK'S PBR in the future.
Check out this thread: PBR Tests

Login to post a reply

Server time is: 2020-04-03 05:56:53
Your offset time is: 2020-04-03 05:56:53