Jump to content
The Dark Mod Forums

[2.13] Environment mapping + bumpmap


Recommended Posts

A visually breaking change is planned for 2.13 (6354).

Environment mapping is used when material contains a stage like this:

{
    blend add
    cubeMap env/gen3
    texgen  reflect
}

Historically, there are two separate shaders for this case: one if the material has bumpmapping, and one if it does not.
Note that if the material has diffuse or specular stage, then bumpmap is added implicitly.
 

The shader with bumpmap was apparently "tweaked" by someone in TDM and got several major differences:

  1. it has fresnel term
  2. output color is tonemapped to [0..1] range using X / (1 + X)
  3. the color multiplier is hardcoded to (0.4, 0.4, 0.4)

I'd like to delete all of these differences and restore the same behavior as in non-bumpmapped case.
It is also the same behavior which is used in both cases in Doom 3 BFG (and supposedly in Doom 3 too).

Speaking of points 1 and 2, nobody will notice the difference except in rare corner cases.
The point 3 however is serious.
It is also the main reason behind the change.
Right now nobody can tweak the intensity of environment mapping: if you try to set red/green/blue/rgb, these settings are simply ignored.


Now the problem is that the intensity of most environment mapping materials will change.

In core files I see text like this (stainglass_saint_01) :

	{
		blend add
		maskalpha
		cubeMap env/gen3
		// tone down the reflection a bit      //I see no evidence that these values do anything
		red     Parm0 * 0.2
		green   Parm1 * 0.2
		blue    Parm2 * 0.2
		texgen  reflect
	}

Since the default parameter was 0.4, after the change this material will get 2x less intensity.

The situation is even worse if rgb multiplier is not specified, since then it will change from 0.4 to 1.0, i.e. envmapping will become 2.5 times brighter.


I can probably collect the list of all materials using environment mapping, but I'm not sure I'll be able to check them all one by one.
Perhaps I can delete existing rgb settings, blindly set "rgb 0.4" and hope for the best.

  • Like 1
Link to comment
Share on other sites

I think we can use this script (mod) to extract all textures with specular maps, and if possible, create a map for testing. Unfortunately, I'm not yet familiar with the editor to help with this.

I came here because I plan to work on textures more thoroughly, and I'm currently reading the wiki on texturing issues. In general, I'm interested in this topic.

Maybe I'm not competent at all, but is it possible to make a texture have a constant reflection (yes/no) and a variable with a setting in the editor/accompanying document (?) that controls the intensity?

For example, the same object/texture can behave differently on different maps.

Link to comment
Share on other sites

10 minutes ago, stgatilov said:

I can probably collect the list of all materials using environment mapping, but I'm not sure I'll be able to check them all one by one.
Perhaps I can delete existing rgb settings, blindly set "rgb 0.4" and hope for the best.

Collect them all in a testmap and then run an automation script that moves trough the map, making screenshots?

Link to comment
Share on other sites

That bash script does not (as far as I can see) "extract all textures with specular maps". It extracts all materials to disk, then locates lines that include the word "specularmap" and blindly injects a couple of new material stages underneath. It does not identify the name of the material at all, and I'm not sure it will correctly handle materials where the specular map is part of a full stage block "{ blend specularmap ... }".

Link to comment
Share on other sites

5 hours ago, stgatilov said:

Perhaps I can delete existing rgb settings, blindly set "rgb 0.4" and hope for the best.

Instead of deleting I would comment them out. Then later on it can be decided if these settings are worth it.

Link to comment
Share on other sites

  • 2 weeks later...

I tried the script on the core assets, and find an interesting case called

  • textures/darkmod/metal/flat/tiling_1d/gen_smooth_gold01

This material has time-dependent envmap color:

    {
        blend add
        maskalpha
        cubeMap      env/gen1
            red      sintable[time*0.1]
            green    sintable[time*0.1]
            blue     sintable[time*0.1]
        texgen      reflect
    }

I wonder whether it was intentional or not.
Here is how it looks:

gen_smooth_gold01.gif.e0986815f5bb7f4735f9361e55b52c65.gif

I suppose it would be worthwhile to manually review the modified materials, because in some cases the color adjustment was actually meaningful...

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

The new behavior is available in the latest dev17026-10712.
If you set cvar r_envmapBumpyBehavior to 1, then you get new behavior.
The old behavior is for value 0, which is default yet.

The missions/core files are not adjusted yet.
But I'd say everything is ready to do it.

  • Like 1
Link to comment
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.

  • Recent Status Updates

    • The Black Arrow

      Happy birthday to me!
      Yes, today's my birthday and as much as I want to play The Dark Mod, I won't until it's late Autumn, where it should be a bit chilly in my place and there's some wind too.
      For now, it's time to enjoy my birthday, if any of you want to play a great fan mission in my honour...Well that's asking too much, just play the mission because it's fun, not because of me, enjoy it yourself! 💪
      · 4 replies
    • nbohr1more

      New texture wiki article created: https://wiki.thedarkmod.com/index.php?title=Creating_textures_from_Ornate_Photos
      · 2 replies
    • Xolvix

      Took a break from TDM until I got my backlog under control. It's been months and it's still not "under control". Damnit.
      · 4 replies
    • Ansome

      I sleep well at night knowing the player will never see the absolute nightmare that is my sealing brushwork outside the playable area. Only the pointfile can judge me now.
      · 4 replies
    • JackFarmer

      Somehow I admire the fact that the material from Dune has now been filmed for the third time. Personally, I could never do much with the material, but as a child of the 80s, I of course know the David Lynch movie...and that movie was at least funny!
      · 2 replies
×
×
  • Create New...