Jump to content
The Dark Mod Forums

Recommended Posts

Posted (edited)
7 hours ago, Arcturus said:

Does maskalpha work at all? It doesn't seem to do anything.

I think it is supposed to be working when you want to use an alpha you made from one texture in another texture, like this:

Spoiler
textures/custom/maskedAlpha
{
   {
      maskcolor
      map textures/custom/usethisalpha.tga
   }
   {
      blend blend
      maskalpha
      map textures/custom/dontusethisalpha.tga
   }
}

As for the cubeMap, vs. cameraCubeMap, remember that those are / were not exactly the same things. CubeMap is used when you project it on convex surfaces, like ingame objects. CameraCubemap is used to project the cubemaps onto concave suraces, like a skybox sphere with faces inverted inwards.

Edited by peter_spy
Posted
4 minutes ago, peter_spy said:

I think it is supposed to be working when you want to use an alpha you made from one texture in another texture, like this:

  Reveal hidden contents
textures/custom/maskedAlpha
{
   {
      maskcolor
      map textures/custom/usethisalpha.tga
   }
   {
      blend blend
      maskalpha
      map textures/custom/dontusethisalpha.tga
   }
}

I wasn't able to get it to work.

  • Sad 1

It's only a model...

Posted

To clarify, maskAlpha is really just a command that says "in this stage, leave the alpha channel alone. don't write anything to alpha and ignore any alpha in the texture mapped to this stage"

https://iddevnet.dhewm3.org/doom3/materials.html

{
        blend gl_dst_alpha, gl_one
        maskalpha
        cubeMap env/gen2
        red     Parm0
        green   Parm1
        blue    Parm2
        texgen  reflect
}
Quote

The third stage is the main color stage. Because 'blend' references gl_dst_alpha, the color value depends on the alpha value set in stage 2. Normally we would just put the alpha value directly in the image map, but this stage uses a 6 sided cube map texture, which moves with the viewer (because of texgen reflect). We don't want the alpha channel to move, however, so we have to set it in a different stage.

 

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...)

Posted

@nbohr1more This stage is gonna work the same way if you delete maskalpha. It doesn't seem to do anything at all in Darkmod.

It could be very useful if maskalpha worked the way I think it should work.

It's only a model...

Posted

I noticed that

blend gl_dst_color, gl_dst_alpha

used with a black and white mask, makes surfaces reflect the cubemap in two different ways.

0xEnrOQ.jpeg

That got me thinking. This kinda sorta looks like a ceramic surface mixed with metallic. Those stages can be stacked on top of each other.

Spoiler

textures/test/blend_shaders
{
    bumpmap textures/test/star_local
    diffusemap textures/test/star_color
    {
    blend    specularmap
    map    textures/test/star_s
    red 0.5
    green 0.4
    blue 0.2
    }
    {
        maskcolor                
        map makealpha (textures/test/star_mask_inverted)
    }
    {
        forceHighQuality
        blend gl_dst_color, gl_dst_alpha
        cubeMap env/blender/blender
        rgb 1
        texgen reflect
    }
    {
        maskcolor                
        map makealpha (textures/test/star_mask)
    }
    {
        forceHighQuality
        blend gl_dst_color, gl_dst_alpha
        map textures/test/star_color
        rgb 1
    }
}

This works both in 64 and 32 bit modes. It does't have proper fresnel and whatnot, but If we could control the blurriness of the reflection with a roughness map, then I think we're onto something.

 

It's only a model...

Posted

Just by adding fine grain noise in the normal map, the glossy reflection completely disappears.

 

  • Like 1

It's only a model...

Posted

Using detail normalmap as a way to control surface porosity seems like an overkill ;) Especially since blending two normalmaps together (base + detail) is such a hassle on shader level. Having multple and complex stages in the shader increases the amount of times surfaces have to be redrawn, so it's also performance intensive.

The only solution I thought of would be to have different cubemaps for different metals, depending on how polished the're meant to be. If I want slightly duller surface, I'd use a blurred generic cubemap with alpha mask. If the metal is polished, I'd switch it to an envshot from a certain location.

At this point, it would probably be more efficient to port PBR solution from RBDoom3BFG, so you can control all of this with a single roughness map. Every hacky or convoluted solution increases material authoring time, and I guess most people have neither time nor energy for that.

Posted

You can still get similar results with diffuse+normal+specular+masked cubemap then. It just requires a lot more manual tweaking.

PBR would be another can of worms with existing assets though. Not sure if there's any good way of making the transition.

Posted
16 minutes ago, peter_spy said:

You can still get similar results with diffuse+normal+specular+masked cubemap then. It just requires a lot more manual tweaking.

The earlier method for mixing metallic / non-metallic in a single material has its drawbacks.

It doesn't work in 32 bit mode, so you get a material that's different for different users. You can't tweak it exactly as you like in 64 bits without breaking it for 32 bit users. It doesn't work well with current frob highlight, and while it's not the end of the world, it inverts colors in the cubemap, which is stupid.

It's only a model...

Posted

I meant the cubemap with gl blend mode using alpha, not the color. The color has too many drawbacks and it's unpredictable, as you demonstrated. Even materials with bright diffuse and specular textures get very dark. It will be hard to control the whole thing.

Posted

I'm referring to this setup:

Quote

    {
        maskcolor
        map makealpha (textures/etc.)
        alpha 1 * parm3
    }
    {
        blend gl_dst_alpha, gl_one
        maskalpha
        CubeMap        textures/etc.
        texgen        reflect
    }

 

Posted

This will make the glossy bit glow in complete dark. I used negative RGB values as a hack to avoid that, but that only works in 64 bits.

It's only a model...

Posted

That's why I have alpha 1 there, multiplied by parm3. You can set shaderparm3 in the model to make it darker. Should work the same in both 64 and 32 bit, as long as you don't exceed the 0-1 range.

Posted

It will still glow in complete darkness a little bit. Plus, fainter reflections look less like metal and more like a clear-coat type of shader.

BizTZ8I.jpeg

  • Like 1

It's only a model...

Posted

None of these solutions is without major flaws, it seems. I try to set up proper diffuse + specular look first, then add cubemap reflections if that's not enough. But to get something similar to a PBR model, we'd probably have to just switch to it.

Posted (edited)
18 hours ago, Arcturus said:

fainter reflections look less like metal and more like a clear-coat type of shader.

For metals, you'd have to author your cubemap a bit more. If you just added that studio cubemap or envshot made in the game, you need to tint these images with the color of your metal, it's not done automagically. This is where the dst_color blend mode has its advantage I guess.

Edited by peter_spy
Posted

It was experimental shader which was never released properly.

And I don't see why it should be helpful here.
The experimental shader could compute reflection from the floor based on cubemap reported above the floor. As far as I see, @Arcturus mostly tests small objects inside the room, where ordinary env. map works fine.

Posted

I uploaded to the repository a test map with all the loot and most of the NPC models. There are levers to switch between white and orange lights. Can be expanded further.

1DEqfwQ.jpeg

  • Like 1

It's only a model...

Posted

Here's the map if someone's interested: test_metal_map.zip

I loaded all skins from one of the paintings. Most of the frames are presumably gilded wood (like this).

Spoiler

8FF1Xo6.jpeg

Bags are glowing in the dark (but not the gemstones).

Spoiler

JwLuUIt.jpeg

Gold has a wide range of colors.

Spoiler

bdUMtSv.jpeg

kBJsVkj.jpeg

y7Ba3er.jpeg

KTTimcO.jpeg

 

 

It's only a model...

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

    • snatcher

      Author of the Visible Player Hands mod: please come forth and collect a round of applause!
      · 2 replies
    • nbohr1more

      Holiday TDM Moddb article is now up: https://www.moddb.com/mods/the-dark-mod/news/happy-holidays-from-the-dark-mod
      · 0 replies
    • nbohr1more

      Cool thing: Thanksgiving break means I don't have to get my son up before dawn

      Not cool thing: My son stays up all night on my PC so I don't get much TDM time...
      · 3 replies
    • datiswous

      Does anyone know if the mission/map in this video posted by @Springheel can still be found somewhere and played? Looks like fun.
       
      · 2 replies
    • taffernicus

      I'm curious about doom and thief multiplayer netcode 😂 or how these games handle networking for multiplayer in general
      a youtube channel called battle(non)sense sometimes posts about netcode analysis
      · 2 replies
×
×
  • Create New...