Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Physically Based Rendering #4247

Merged
merged 34 commits into from Nov 17, 2022
Merged

Conversation

Blodir
Copy link
Member

@Blodir Blodir commented Sep 30, 2022

Implements physically based shading for meshes.

We've had to work within the limitations of the engine:

  • There's only one direct light: the sun. Settings for the sun are changed on a per map basis by the map creator.
  • We are relying on existing environment maps, which are of varying quality. Notably some are missing the lower half (it's all black) entirely, which causes big issues with the shading.
  • We are using mip levels of the environment map to approximate diffuse irradiance maps as we can't precompute anything more accurate without engine changes
  • We have replaced the (unused) anisotropic texture with a precomputed environment BRDF lookup texture

Resources:

image
image
image
Untitled
Note that the lighting setting of the maps varies wildly and we have not set on a good mapping for it, which is why in the last example the PBR shading looks darker than the original.

Also note that while we are trying to infer albedo/metallic/roughness/ao information from the original textures shipped with the game, those textures are very inconsistent at times. For optimal results each texture has to be manually checked.

(Jip) Todo before merge:

  • fix Nomads overriding the mesh shader

@Garanas Garanas mentioned this pull request Oct 1, 2022
@Garanas
Copy link
Member

Garanas commented Oct 1, 2022

Exciting initial start, wonder what it looks like on Seraphim units 😄 .

In terms of pre-computing the roughness, BlackYps mentioned we can use mip maps for that. You can generate initial mip maps using Image Magick, as separate files. And then combine them again. I experimented with that for maps to reduce the detail of a texture as you zoom out so that it looks less repetitive 😄

cubemap

An example cube map, extracted from fa steam. I'm not entirely sure what order the images are but it is difficult to imagine they choose a different order than the usual cube maps. Maybe @The-Balthazar has an idea about it

@Blodir
Copy link
Member Author

Blodir commented Oct 1, 2022

image
image

@Blodir
Copy link
Member Author

Blodir commented Oct 1, 2022

image

@Garanas Garanas mentioned this pull request Oct 11, 2022
@Garanas
Copy link
Member

Garanas commented Oct 30, 2022

@Blodir / @BlackYps Lets finalize the shader part of this task. Aim is to merge this pull request. We'll complete the work (actually assign units the shaders) in another pull request, in the near future when we start working on the textures of individual units.

@Garanas Garanas marked this pull request as ready for review November 17, 2022 20:35
@Garanas Garanas merged commit 8119fba into FAForever:deploy/fafdevelop Nov 17, 2022
Garanas pushed a commit that referenced this pull request Jan 28, 2023
This change represents a steppingstone towards (significant) better graphics. Shaders that are based on physics are able to represent lighting a lot better than the current shaders.
@Garanas Garanas added area: graphics Anything Related to the Game Graphics area: pbr Anything related to PBR Graphics labels Feb 23, 2023
@Garanas Garanas added this to the Development iteration I milestone Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Anything Related to the Game Graphics area: pbr Anything related to PBR Graphics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants