Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Test Builds => Topic started by: Swifty on December 15, 2017, 02:05:31 am

Title: GGX Lighting Model
Post by: Swifty on December 15, 2017, 02:05:31 am
Hi, it's me, the dude who introduced physically-based rendering to Freespace. FSO 3.8 shipped with the Blinn-Phong specular model which looks pretty good. I adopted it because it was cheap and easy to implement.

However, a lot of commercial games are shipping with more complex specular lighting models. One notably is GGX, popularized by Disney's engineers (https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf), now being used in Unity and Unreal.

GGX is a bit more expensive to calculate than Blinn-Phong but its specular reflectance behavior is closer to reality than that of Blinn-Phong.

(http://www.neilblevins.com/cg_education/ggx/disney.jpg)

Taken from http://www.neilblevins.com/cg_education/ggx/ggx.htm, the first image shows a highlight from real world chrome values. The second image is GGX. The third image is the Beckmann reflection model (which produces values close to Blinn-Phong)

Here's what it looks like in Freespace:

(https://i.imgur.com/maZ9GSz.png)

(https://i.imgur.com/MimFp7l.png)

(https://i.imgur.com/AorIGOe.png)

(https://i.imgur.com/ofakMqj.png)

As you can see, Blinn-Phong has a bit of a stronger falloff than GGX, almost making reflections seem glossier than they really are. GGX allows the reflections a chance to relax a bit allowing for a bit more material expression.

Try it out yourself (Win32 Build Only): http://www.mediafire.com/file/ne7sxlks5v67j7k/ggx_test_win32.zip
Title: Re: GGX Lighting Model
Post by: Oddgrim on December 15, 2017, 07:14:50 am
Great stuff, I'm gonna play around with this XD
Title: Re: GGX Lighting Model
Post by: Nyctaeus on December 15, 2017, 06:40:55 pm
Shiny! And this reflection model highlight all the scratches much more. I will try this with proper PBR stuff. Maybe it preserve all custom reflectivity settings better than current rendering engine. Good work, man :yes: !
Title: Re: GGX Lighting Model
Post by: Axem on December 15, 2017, 06:47:23 pm
I have some more comparison pics!

First a very rocky asteroid.
Blinn Phong
(https://i.imgur.com/ZuMJab0.png)

GGX
(https://i.imgur.com/lE0KVru.png)

Your first reaction may be "huh, not as vibrant" which... it is, but the specular highlight on the asteroid is much less prominent which I think helps sell the "rockiness" of the asteroid.

Next SF Asteroth (I was experimenting with making new PBR textures for some Shivan fighters)
Blinn Phong
(https://i.imgur.com/aLOO8vy.png)

GGX
(https://i.imgur.com/rohNwka.png)

Again your first reaction may be "huh, normal map doesn't pop as much" which.. it doesn't, but if you look at the two rear panels, in Blinn Phong, one is well lit, and the other is just totally dark, only the environment reflection is doing anything. In GGX, both are well lit, and I think gives a better contrast with the rest of the hull.

Basically intensity of the lighting is a little bit less, but you get something more visually pleasing in my opinion. Everything isn't as harsh.

(Also here's a worst case shot of the Asteroth
Blinn Phong
(https://i.imgur.com/Tl8AdNz.png)

GGX
(https://i.imgur.com/h7FPNAq.png)
Title: Re: GGX Lighting Model
Post by: tomimaki on December 17, 2017, 04:52:54 pm
Hm, I get error 0xc000007b when launch this.  :(

Nvm, copied files from nightly win32.
Title: Re: GGX Lighting Model
Post by: DahBlount on December 17, 2017, 06:06:58 pm
Yeah, you'll need the 32-bit dlls for the builds in the OP.

Alternatively, there are 64-bit builds here: http://www.mediafire.com/file/ndowfov7417s84h/fs2_open_64-bit_GGX_Builds.zip
Title: Re: GGX Lighting Model
Post by: Trivial Psychic on December 17, 2017, 10:41:08 pm
Would I be correct in assuming that an ATI 5770-based card would not support this?
Title: Re: GGX Lighting Model
Post by: tomimaki on December 18, 2017, 06:10:12 am
@DahBlount
I don't like mess both architectures on windows so, thanks to you, I still can stay at 64b only. And I have no idea how to compile builds on windows. :p

@Trivial Psychic
Why not? It doesn't require any new opengl extensions.
Title: Re: GGX Lighting Model
Post by: The E on December 18, 2017, 06:34:14 am
Would I be correct in assuming that an ATI 5770-based card would not support this?

It should be able to support it, at least in so far as being able to execute the shaders.

That being said, I strongly recommend doing an update sometime soon, if that is at all possible.
Title: Re: GGX Lighting Model
Post by: DahBlount on December 18, 2017, 10:05:00 am
*snip*
That being said, I strongly recommend doing an update sometime soon, if that is at all possible.
This. Any card that supports OpenGL 3.2 or later can run FSO, but with the advent of Deferred Lighting, Soft Shadows, and PBR, newer gpus are highly recommended.