Jump to content
The Dark Mod Forums
zergrush

TDM Engine Development Page

Recommended Posts

So this is technically easy to implement, but all the textures need to be reworked?

Also, is the PBR shader mostly for metal surfaces and won't have much effect on stone and wood?

Share this post


Link to post
Share on other sites

Nope, it's a new way of rendering everything, all possible materials. It's easier from artist workflow perspective, as values are linear and many of them are constant for particular materials. Due to energy conservation formula, materials are largely lighting-agnostic, and with roughness/metallic model you don't have to worry about Fresnel values, as they're calculated by the shader. Also, you don't have to worry about relationship between specular and cubemap reflection, as the transition from porous to mirror surface is done seamlessly in the shader.

The problem is, most of the TDM stock materials never fully embraced the "classic" non-pbr specular workflow. So switching to PBR now won't be as groundbreaking, if you're not used to making specular (or in this case, roughness) maps for everything.

Edited by peter_spy
  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, peter_spy said:

Did you redo textures, so they're correct for PBR?

 

10 hours ago, VanishedOne said:

Since people on Doomworld have been using Icecoldduke's PBR shader with the games' existing non-PBR materials, I thought I'd try dropping it (the Doom 3 version) into TDM

 

2 hours ago, peter_spy said:

The problem is, most of the TDM stock materials never fully embraced the "classic" non-pbr specular workflow. So switching to PBR now won't be as groundbreaking, if you're not used to making specular (or in this case, roughness) maps for everything.

It's not just a matter of material authors' embracing specular maps or not, it's the frustrating way the interaction shaders behave. The simple shader applies constant gloss, reportedly. The enhanced shader derives the gloss from the colour and, unlike the simple shader, scales the colour by the rgb keyword in the diffuse stage. (This seems to originate in a hack used by the ARB enhanced interaction shader to test whether a specular map is present; it broke the rgb keyword in specular stages.)

https://bugs.thedarkmod.com/view.php?id=5046 https://bugs.thedarkmod.com/view.php?id=5044

Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites

Not sure what's the problem with Enhanced shader, it's been on by default for ages IIRC, and I just do all my material taking it into account (switching between postprocessing on and off to tweak it). The same goes for RGB relationship between diffuse and specular, no surprises there. An yeah, the RGB keyword for speculars is broken, but it's no biggie, since you tweak your specular maps in image software anyway. Since it's non-pbr setup, you make your materials for a particular lighting, that's how all older engines work. Some just use greyscale speculars, some use RGB.

 

Edit: I switched to Simple shader for a second; it looks godawful. It's like all the power has been sucked up from my speculars. Never again :D

Edited by peter_spy

Share this post


Link to post
Share on other sites
9 hours ago, snowy said:

So this is technically easy to implement, but all the textures need to be reworked?

Also, is the PBR shader mostly for metal surfaces and won't have much effect on stone and wood?

I'm not a expert on PBR (physically based rendering) because i'm not using it myself nor I ever made PBR materials for games but I know it was the way offline renders (Blender, Modo, 3D Max, etc) did their materials for ages, IMO is also the main system that gives UE4 and Unity their modern look.

I also know PBR makes more realistic materials, in that they behave as expected in any kind of light condition, older materials like those used now in TDM, work well in some lighting conditions but not others, so one material that worked well, in a scene, may need to be reworked for another, where's a PBR material, is enough for all scenes, so they not only make games look better in all conditions, they bring the material work needed down, you can easily create standard material libraries that are just drag and drop and work for all scenes and objects, only good advantages, no wonder it was imo the fastest system to implement in pretty much all modern engines.

I always thought that the idtech 4 engine would need to be heavily reworked to be able to do PBR, that shows how little I really know about engine rendering, if you just need a shader to do PBR in idtech 4, then it was more future proof than I believed!  If this is a true PBR system (and performant) I will be very impressed!

 

https://marmoset.co/posts/basic-theory-of-physically-based-rendering/

Edited by HMart
  • Like 1

Share this post


Link to post
Share on other sites

I happened to be looking through the Doom3world salvage yard, saw https://modwiki.dhewm3.org/doom3world/index.php?thread_id=25989 and realised it's the same person whose work we've just been talking about. Still working on megatextures, too.

  • Like 1

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites

Btw. I tried to drop the vfp file into the glprogs folder in 2.07, but nothing happened. Must be doing something wrong.

Edit: oh, I forgot. The PBR shader uses ARB, to support the original Doom 3, while TDM switched to GLSL with 2.06. Will need to check whether I can have r_useGLSL 0 to switch to ARB in 2.07.

Edited by peter_spy
  • Like 1

Share this post


Link to post
Share on other sites

I haven't tried it on 2.07 yet, but yes, I'd hope r_useGLSL 0 would work.

Also, according to http://wiki.thedarkmod.com/index.php?title=Replacing_ARB_shaders TDM may not even use its interaction.vfp, and I found nothing happened until I changed the filename to interaction_direct.vfp. And I needed to change from the enhanced to the default interaction shader in the settings menu (presumably the enhanced one uses some other vfp again).

  • Like 1

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites

I have no idea how this should be organised, code-wise, but it seems we have quite a few vfp files for interaction shader: interaction, interaction_direct, interaction_102, and there's a folder called 102_interaction with file named... interaction. Aren't we asking for trouble with this setup?

Share this post


Link to post
Share on other sites

I imagine the legacy ARB set-up dates from before the renderer was open-sourced. Possibly bits of it also inherit structure from other D3 shader mods.

  • Like 1
  • Thanks 1

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites

Ok, I managed to get it working in 2.05, had to do the same thing as @VanishedOne, i.e. replace the interaction_direct.vfp instead of interaction.vfp and set the Interaction shader to "Simple" in TDM menu. For now, the red channel in "specular" texture is a Roughness, and green channel is Metallic - that works correctly. I talked with Icecoldduke, the blue channel will be the AO slot at some point.

I'll redo a few of my base materials to make a test room and see how it works with TDM lighting.

  • Like 1

Share this post


Link to post
Share on other sites

The last time stgatilov chimed-in on PBR, he was pessimistic about how viable it would be to "convert" TDM to it.

Largely because of all the tuning needed for both the light projections and texture assets.

In my humble opinion, there is no need to fully comply with all the strictures of "true PBR" to benefit from better

specular behavior. So we could just implement these shaders and create new image map types for it.

It's just a matter of demonstrating the benefits to the team. Demo images \ videos go a long way towards winning over the majority...

  • Like 3

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Share this post


Link to post
Share on other sites

What is the obstacle at all here? Does it go beyond adding specular texture images and a single fragment shader?

Share this post


Link to post
Share on other sites

IMO there will be no conversion at all, as most non-PBR textures are downright incompatible with this shading model. Content creators will have to make new textures, as they're based on measured real-world values. In theory, we could mix non-PBR and PBR materials by having e.g. a separate interaction_pbr.vfp that can be declared in materials. It might make the transition smoother, but I suspect the two types of materials won't look correct with the same lighting.

  • Like 1

Share this post


Link to post
Share on other sites

We'll have to see. From my point of view a major attraction of adding PBR is that so much of the stuff we can obtain from elsewhere is now made for it, to the extent that http://wiki.thedarkmod.com/index.php?title=Texture_Sources opens with a notice about that. And PBR assets crowbarred into a non-PBR engine don't look fully correct either.

TDM already has assets acquired from a variety of sources, including whatever mappers can lay hands on, so in that respect it's never had the visual consistency of a dedicated art team anyway. But we'll have to see.

  • Like 1

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites

I made that notice ;) And it's true, the textures are incompatible both ways, although with PBR to non-PBR it can be something as simple as adding AO to base color for diffuse and inverting roughness map. Doesn't work the other way.

  • Like 2

Share this post


Link to post
Share on other sites

It seems like at this point the PBR shader will be largely incompatible with TDM. I suspect it might have something to to with the vfp programs we use. I tried the 2.05 + interaction direct combo along with correct PBR textures, and the surface roughness changes way too drastically with movement, or even just standing / crouching.

Edit: This is an issue in vanilla D3 as well, Icecoldduke is aware of the problem and will fix it :)

obraz.png

obraz.png

 

Edited by peter_spy

Share this post


Link to post
Share on other sites

So it's not just use with non-PBR materials that creates incompatibilities then. When I tried it as interaction_direct.vfp and played a couple of FMs, I got outright visual glitching in places.


Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites

I'll have to verify the above, as I tried something like that in D3 vanilla, and the effect is similar. Light hotspots seem to work correctly with metallic materials, but that problem exists with non-metallic surfaces.

Share this post


Link to post
Share on other sites

if you fix this PBR problem, will there be information on what will have to be changed in material files to get them to work as some of us have custom material files for textures in some maps, and not the generic ones that come in the 'dark mod' pk4 files.

Share this post


Link to post
Share on other sites

If that works (I saw the suggestion on the Doomworld thread, but haven't tried it), it would mean we can start working with PBR assets without waiting for backend support.

Assuming the proof of concept is a success, though, it would be nicer to be able to write 'blend pbrmap' or 'blend rmaomap' or something, as per @nbohr1more's comment when PBR was discussed in 2017.

  • Like 1

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites

Yeah, I agree. Even though tools like Substance have nice grayscale->channel packing options, I bet people would still use something like Gimp to tweak the textures. And working on channels in Gimp is a PITA (constant decomposing and recomposing, then exporting). Having shortcuts, e.g. pbr_Color, pbr_Roughness, and pbr_AO (just like diffusemap, specularmap, and bumpmap) might be faster for material prototyping.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...