RobertBeckebans / RBDOOM-3-BFG

Doom 3 BFG Edition source port with updated DX12 / Vulkan renderer and modern game engine features
https://www.moddb.com/mods/rbdoom-3-bfg
GNU General Public License v3.0
1.38k stars 247 forks source link

PBR textures support with metal workflow #277

Closed RobertBeckebans closed 1 year ago

RobertBeckebans commented 8 years ago

PBR with the metal workflow which means diffusemap is replaced with albedo/metalcolor and specmap is replaced with RGBA = ( roughness, metalness, AO, displacement ).

I don't want to modify the existing materials to support this so I suggest to just look for a _rmaod suffix in the file names.

example: textures/base_wall/lfwall27d_s.tga becomes

textures/base_wall/lfwall27d_s_rmaod.png for ( roughness, metalness, AO, displacement ) if you want tesselation support

textures/base_wall/lfwall27d_s_rmao.png for ( roughness, metalness, AO ) without displacement maps.

The albedoM maps still have to be in the sRGB format and the alpha channel is still used for opacity tests. The new specmap values have to be in linear RBG values.

This is the basic reflection map output format Quixel Suite supports in the UE4 optimized profile. Allegorithmic Substance Designer materials can be configured the same way.

BielBdeLuna commented 8 years ago

great!

Why the AO (Ambient Oclussion) isn't the idea of ambient occlusion in textures against the PBR mentality?

maybe we could add another 2 dimension map for x and y anisotropic blurring on the specular reflections?

HeadClot commented 8 years ago

I just saw this and +1

aFoxNamedMorris commented 8 years ago

So wait... Texture packs that control the tesselation/displacement of the geometry? Or is it just a texture effect? Either way, this sounds awesome!

RobertBeckebans commented 8 years ago

Parallax techniques suck because they add annoying complexity to the shaders. And even if parallax mods exists they are half-assed and ignore that non-interaction shaders need the offset too. So tesselation is the more interesting approach. AO is still very important with PBR because you want to reduce the amount of indirect light reflections on your models with it. It is only very important that AO is not baked into the albedo/diffuse texture beacuse you need AO for both, diffuse reflections and specular reflections. And having AO in a separate channel then it allows to mix it into the SSAO renderer result.

aFoxNamedMorris commented 8 years ago

That makes perfect sense. This also allows for monsters and other complex objects to have a higher resolution look, without having to add more geometry. Excellent. Would these displacement effects have a falloff value for optimizing performance?

EDIT: Could the parallax texture pack mods people have already made be converted for use with these new effects?

ghost commented 8 years ago

I've made some PBR textures, but it looks nothing like it did in AwesomeBump, most likely just lighting. Self-Shadowing Relief shaders would also be nice, I prefer them over Parallax with AO, as the shaders grab shadows from the light sources.

aFoxNamedMorris commented 8 years ago

Is there an ETA for these features? If so, are there any WIP screen captures to look at?

Deperture commented 8 years ago

I agree with Fox, how's it going? I'd love to see how it looks... and how it stacks up to id Tech 6...

RobertBeckebans commented 7 years ago

PBR texture support is making progess. From left to right -> roughness From top to bottom -> metal

http://imgur.com/a/Q0UA8

aFoxNamedMorris commented 7 years ago

@RobertBeckebans Nice! And once finished, this will be available through texture packs? Or is it a bit more involved than that?

BielBdeLuna commented 7 years ago

great! are you using a specified cubemep for those reflections or are those models getting the cubemap from an entity placed on the map? will roughness be another blend option (maybe even replace the concept of a "specularmap" with "roughnessmap") ? will "metalness" become the new "specularmap" maybe (or maybe maintain the name but use the specular map as a percentage value instead of a full power value)? so "matal" controls de percentage of specularity versus the albedo power (the 100% colour being from the incident light so no new light gets created), and "roughness" controls the blurring of the specularity?

anyways great work!

RobertBeckebans commented 7 years ago

PBR textures require IBL and I created the necessary textures with the "makeAmbient" console command. It looks like code from Rage that was nowhere called. It was slow as hell so I optimized it with a few tricks from common PBR implementations. See https://github.com/RobertBeckebans/RBDOOM-3-BFG/commit/7389fece98f76fff7361aeb0c58f13a3ce57ab02

PBR textures require at least one default ambient (irradiance, 128_128) and specular (radiance, 256_256, 7 mips) cubemap. We could use a default UAC cubemap, a default cubemap for hell maps and so on as a fallback.

This is how the new materials look like: https://github.com/RobertBeckebans/RBDOOM-3-BFG_assets_mod1/blob/master/materials/materialorb.mtr

I created the Git repo https://github.com/RobertBeckebans/RBDOOM-3-BFG_assets_mod1 for content examples. It also contains Crytek's Sponza Atrium which I customized in Blender so the meshes have proper Doom style materials names. RBDOOM load the entire scene as a Collada mesh and ASE and LWO formats suck and I don't want to deal with outdated Blender addons anymore.

You can load it with "devmap sponza".

BielBdeLuna commented 7 years ago

this is great!

ghost commented 7 years ago

This is awesome.

aFoxNamedMorris commented 7 years ago

May I ask if/how you might implement fresnel? It would go a long way to improving the look of environments in RBDoom3BFG, if you ask me.

ghost commented 7 years ago

@aFoxNamedMorris I asked in another post about anistropic highlighting for gloss, BielBdeLuna suggested that I try fake it with normals, I've faked a fresnel effect before in Blender Game Engine with inverted normals and tweaked with a ramp node so it only effects the rim of the model. My only guess here is to make a normal map that only has higher values on the edges for the fresnel effect, then making the engine render that normal map to specular. Maybe I'm way off with it, I only model, still trying to understand the 3D rendering process.

BielBdeLuna commented 7 years ago

@RobertBeckebans I can't compile it I get this:

CMakeFiles/RBDoom3BFG.dir/d3xp/Light.cpp.o:(.rodata._ZTV10idGameEdit[_ZTV10idGameEdit]+0x30): undefined reference to `idGameEdit::ParseSpawnArgsToRenderEnvprobe(idDict const*, renderEnvironmentProbe_t*)'
collect2: error: ld returned 1 exit status
CMakeFiles/RBDoom3BFG.dir/build.make:13468: recipe for target 'RBDoom3BFG' failed
make[2]: *** [RBDoom3BFG] Error 1
CMakeFiles/Makefile2:142: recipe for target 'CMakeFiles/RBDoom3BFG.dir/all' failed
make[1]: *** [CMakeFiles/RBDoom3BFG.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
RobertBeckebans commented 7 years ago

@BielBdeLuna I fixed the CMake file. It should compile now.

BielBdeLuna commented 7 years ago

great! now it compiles, unfortunately when I enter the sponza map I get a segfault:

(...)
[Load AAS]
loading maps/sponza.aas_cyberdemon
Entering doom_main()
Exiting doom_main()
Spawning entities
signal caught: Segmentation fault
si_code 1
Trying to exit gracefully..
session->GetSaveGameManager().CancelToTerminate();
soundSystem->StopAllSounds();
Stop();
--------- Game Map Shutdown ----------
(...)

I can open any of the doom3bfg maps with no problem, so maybe the segfault is caused by an entity in the sponza map?

ghost commented 7 years ago

Hitting 3fps with the Sponza map on a GT 630 4GB. I am assuming the card struggles to render all the geometry at the same time.

BielBdeLuna commented 7 years ago

you can also open the sponza map with the master branch (without any of the PBR improvements), is it also hitting you on the fps?