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.

Author
Message
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 30th Dec 2019 10:44 Edited at: 30th Dec 2019 10:52
It started Here: App Game Kit Shader Pack
The right Object I have added uses the Cubemap and a PreFilterConvolution shader which produces those nice blurry effects.(I'm actually working on a multiplayer lib but you beat me to it @Santman )
I think anything else than cubemapping would produce wrong results here.( as you'd need to incorporate the streching at the top and bottom of the Panorama somehow)
Not sure If I should try to create an equirectangular map from the final result (Would become a large complex shader)
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 30th Dec 2019 12:06 Edited at: 30th Dec 2019 13:15
Created some unpacked textures for the ShaderBall: RawTextures.zip

Preview Diffuse Image


8 Spheres with different roughness
(made with the Filter shader)

Attachments

Login to view attachments
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 30th Dec 2019 15:29
Wow, truelly awesome stuff going on here now Janbo. I can do some shadwr stuff, but I've no idea how your generating that reflection. Is it fast enough for game usage?

BTW, was just kidding about the world builder....its a scene editor, the idea is people will use their own shaders. In theory.....maybe even the shader pack.
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 30th Dec 2019 15:38
@janbo NICE!
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 30th Dec 2019 16:28 Edited at: 30th Dec 2019 16:43
Quote: "but I've no idea how your generating that reflection"

You know, I don't invent those things, we don't have to nowadays.

Quote: "Is it fast enough for game usage?"

Thats the downside, it's not fast enought for my taste.
Also I don't render blurry environment maps, the bluring effect happens inside the object shader itself, using the raw cubemap.
Thats probably also the bottleneck here.
So not a final solution.

Now I need someone who challanges me to continue by creating better results
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 30th Dec 2019 19:11 Edited at: 30th Dec 2019 19:42
It looks good janbo!

That said, i would precompute the blurred levels for the PBR shader myself....You can see cubemap edges on those spheres too ..(squares in the reflection where the edges of the cubemap are). Might be worth limiting the lookup values a bit so its not sample edges - i ahd a similar problem when I started using mipmapped cubemaps and had to force sampling at the top level with a bias value.

The PBR demo that ships with studio runs very fast (>2400fps on my pc) and so it is quite impressive. It was that speed that I was after as well as a really nice look. The pre-rendered and filtered lightmap and reflection maps are a quick lookup for each pixel in the final render so its a smart way to render quickly. Thats the way to get fast results rather then actually smoothing/bluring in the shader during every render.

The only reason why I was asking about the 8 levels of precomputed images was that I wanted to know how to conserve radiance energy and make the pre-computed levels realistic with a true BRDF solution. My filter shader works but im still not sure its working right. The maths is horrendous and following it is now hurting my brain!

Its taken me an age to find out how to render ambient occlusion and then store that into the normal map texture too. Ive been messing with my 3d editing software for over an hour now baking textures. One texture that the AppGameKit PBR shader stores the normal map (RG), ambient occlusions(B) and the roughness(A) and so i had to code up a quick bit of software to blend separate images into one. I then need to convert each from a HDRI into a PNG with exponent in the a channel.



This is not my model!....I cant take any credit for that. Im just loading it and rendering PBR shaders on it.

Its made up of 9 different textures for reflections and lightmaps and honestly is a nightmare to rebake them all. It has 4 different reflection maps which all have 8 levels of filtering. Im still using the equirectangular light maps and reflectance maps.

One of the issues i was talking about is shown in the background....you can see bands of colours and that is due to using LDR images in a skysphere lightmap so I am using HDR radiance maps in the object shader as thats what the AppGameKit PBR shader requires anyway and it gets away from the prolems that creates.
The original maps used in the pbr example are properly rendered BRDF based filters and are done in HDR in the png images vs just a 8bit per colour standard texture. It took me a while to understand how that works but its really quite simple and easy to implement too. Thats a case of writing a pack function to complement the "unpack" function used in the shaders. Im glad I finally managed to find that out. The HDR Radiance maps work best for really good reflections.

I was struggling with what filtering to use to do it properly but there are a load of good resources of how to do correct perspective corrected BDRF cook torrence filtering and other correct rendering of reflectance maps and light maps. I wish id never looked into it...lol

Honestly im getting a bit tired of it now. Suffering from fried brain syndrome with this.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 30th Dec 2019 19:48 Edited at: 30th Dec 2019 20:18
Quote: "You can see cubemap edges on those spheres too"

Yeah im aware of this...also made a lot of research and wasn't pleased with their solutions.
So cubemaps still need some love from me.

Quote: "map (RG), ambient occlusions(B) and the roughness(A)"

Stage 0: RGB=Diffuse, A=Metalness
Stage 1: RG=Normal, B=AO, A=Roughness
Stage 2: RGB=Environment, A=HDR Exponent
Stage 3: RGB=Lightmap, A=HDR Exponent

Quote: "pack function to complement the "unpack" function"

Sure !
can someone solve this eqation to rgbe for me ?
erg=rgbe.rgb*pow(1.04, rgbe.a * 256.0 - 82.0);

Quote: "Thats the way to get fast results rather then actually smoothing/bluring in the shader during every render"

Exactly... lol
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 30th Dec 2019 19:53 Edited at: 30th Dec 2019 20:01
Quote: "Stage 0: RGB=Diffuse, A=HDR Exponent
Stage 1: RG=Normal, B=AO, A=Roughness
Stage 2: RGB=Environment, A=HDR Exponent
Stage 3: RGB=Lightmap, A=HDR Exponent"


Hmm...isn't it

Stage 0: RGB=Diffuse, A=Shininess/metalicness (it scales between specular reflection and diffuse - lol ive no clue what to call it) ??

I thought only the last two stages used the HDR images? Or they do in the shader im using anyway

Quote: "can someone solve this eqation to rgbe for me ? "

This guy already covered that I dont do my own homework if i can copy someone elses!
http://www.malteclasen.de/zib/index4837.html?p=37

Thanks for the help Janbo!
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 30th Dec 2019 20:18 Edited at: 30th Dec 2019 20:41
Quote: "Stage 0: RGB=Diffuse, A=metalicness"

True. My bad, I'll change it to metalness
Maybe we get some sort of user guide put together.

Quote: "This guy already covered that"

Good find.
Do you use the HdrDecode function from "this dude" then too ?
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 21st Sep 2022 20:36 Edited at: 21st Sep 2022 20:38
So quick update on this:
I managed to create the atlas texture with those 8 stacked Equirectangular images.
Each level I increase the roughness of the PreFilterConvolution resulting in a more blurry image the higher the level of detail.
All created in AppGameKit itself but you wouldn't actually use it in runtime but rather prerender the IBL probes on different positions throughout the game and create those stacked images you then use for the PBR shader later.
Now you could create those probes for every object in you scene so the reflections for each object looks right but that would result in too many Images all stored somewhere on the memory for large scenes.
Thats why people use ParralaxCorrectedNormal calculations to then create a bounding box around that probe matching roughly the surounding in position and size.
This correction allows us to have much less probes but also be able to move near walls without the infinite distance thing you'd suffer if using few probes and dont correct them.
Combine it all in the PBR shader and voilla we have a solution to make PBR work in AppGameKit that could replace a toolchain you'd need otherwise...or atleast thats my idea of it.

All that I have working already but I still need the right calculation for the exponent in the alpha channel of the environment maps.

Login to post a reply

Server time is: 2024-03-28 13:58:44
Your offset time is: 2024-03-28 13:58:44