Modding, Mission Design, and Coding > The Modding Workshop

PBR/BNAO

(1/2) > >>

Subspace Anomaly:
Hello, here is a set of shaders to toy around with PBR lighting model, ambient occlusion using bent normals and soft bloom threshold.

The difference in PBR is that it no longer uses specular colors from the texture, but instead just roughness and metallicity. It's still not perfect and probably quite hacky, at the moment the metallicity is red channel in reflect texture, while roughness is alpha channel as before ( stored as inverse/smoothness, meaning bright pixel is smooth and black pixel is rough )

Please excuse the non-artist art,  PBR texture generated with materialize:



And example how this helps to make dynamic lighting a bit less rubbery:



Bent normals are explained here:
https://dev.epicgames.com/documentation/en-us/unreal-engine/bent-normal-maps?application_version=4.27

Basically it's another form of precomputed occlusion in addition to AO.
It's used as -misc texture in the same format as normal maps.

Example:
https://imgsli.com/Mjg3NjYz

Here are the shaders ( note that you need to enable loading shaders in your -mod file

--- Code: ---#GRAPHICS SETTINGS
$Enable External Shaders: YES
--- End code ---
https://mega.nz/file/9BZlRTTB#cpvi5SS9Tow8bnRgsrmDz4z6ZWu1qmw_4wC2mrRbUag
And here is the medusa example ( note that the normal, diffuse/albedo and glowmap are mvps originals, included just because the game prefers -shine textures, so I had to change the name, model is also mvps original with just changed texture name )
https://mega.nz/file/gYo3hBbC#YLH0rkETlJiAuMxngyUhOSs9OItGwfDCYCv531egelw

Take note that this is all quite hacky, team color functionality is hijacked completely, and most existing models will see some regression, because they will have wrong metallicity set. Low lighting settings are likely broken and not sure how well the forward rendering works.

If you want to bake your own bent normal map, try following this https://blender.stackexchange.com/questions/157079/how-do-i-bake-a-bent-normal-map-in-blender
It's a bit vague, but it's the only free software solution I've found.

I've used pof-tools for importing pof models in the blender, for baking you may want to remove everything outside of the solid mesh from detail0 and assign the material with the script to it. Then bake it using cycles normals baking option.

EatThePath:
Very interesting work. I think bent normals is something that was tossed around a bit during the last overhaul, and we've definitely talked about bloom changes, so I'm curious to see what you've got there.

One quibble I have: Unless I'm very much mistaken the engine's current specular+gloss method is a fully valid PBR method which allows everything a metal+rough approach does and a little bit more. As I understand it metal+rough infers if it should use the color texture for diffuse color or specular color, whereas having separate specular and diffuse textures lets you specify explicitly.

Given that a lot of the textures these days are probably made in Substance with a metal+rough workflow and converted on export it's probably possible to faithfully convert the majority of assets to metal+rough maps without losing significant information, but using the diffuse map alone as color is going to lose a lot of information on ships that were made with metallic regions, producing much darker metals then they should have.

qazwsx:
This is wonderful work! I think me and EatThePath were very much keen on integrating bent normals, but never really got the time. It shouldn't be too much difficulty to add another map type and support them code-side. Regarding bloom: I have an old PR in draft for the mipmap-pyramid bloom used in Unreal/Unity here: https://github.com/scp-fs2open/fs2open.github.com/pull/5431 , but once again didn't have the time to determine sensible defaults and get it over the line. You're welcome to take a look!

Subspace Anomaly:
Right, this is mostly POC for fun and learning so I surely might be wrong. And looking at https://physicallybased.info/ indeed some materials do have specular specified, so I suppose that the more robust model that would support old assets as well as more workflows would be needed.

And yeah, that bloom looks interesting, will build it when I get the time. If it goes  well, might as well drop in the BN stuff in a PR., the lengthy part is baking the normals anyway.
The current double pass box filter however was pretty decent, it's mostly the lack of parametrization in the pass filter that prevents it from being visually appealing. I can imagine it's not the fastest, with all the buffers it creates.

EatThePath:
In my perfect, ideal, dream version of FSO, the engine would probably accept both types and convert them to a single internal format on launch, with the option of making the engine spit out the converted files to speed up future loading. That's a bit of a pipe dream, but we probably don't want multiple extra shader variants if we can help it.
And between the two options, color+metalness vs diffuse+specular colors, I prefer latter as an internal representation. As I see it, every possible metalness workflow material can be made with a specular workflow, but not every specular workflow texture can be made with metalness, and I really like the idea of having those niche and potentially rule-breaking visuals even if I haven't made anything(released anyway) that leverages it.

Navigation

[0] Message Index

[#] Next page

Go to full version