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.

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

    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 2 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 3 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
×
×
  • Create New...