News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

Light material question

Started by spamclark15, July 25, 2017, 12:26:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

spamclark15

I've changed the color of the lights on doors for locked/unlocked but I'm noticing that, while the red image appears correctly, the green image seems to be a combination of both the "locked" and "unlocked" images. Looking through the material files, I found


textures/base_door/doorlight
{
//noShadows
qer_editorimage textures/base_door/doorlight_red.tga
bumpmap textures/base_door/doorlight_local.tga
        diffusemap textures/base_door/doorlight_red.tga
{
if ( parm7 == 0 )
blend add
map textures/base_door/doorlight_red.tga
colored
}
{
if ( parm7 == 1 )
blend add
map textures/base_door/doorlight_grn.tga
colored
}
}

textures/base_door/doorlight_red_to_green
{
qer_editorimage textures/base_door/doorlight_red.tga
bumpmap textures/base_door/doorlight_local.tga
        diffusemap textures/base_door/doorlight_red.tga
{
if ( parm7 == 1 )
blend add
map textures/base_door/doorlight_red.tga
rgb 5
}
{
if ( parm7 == 0 )
blend add
map textures/base_door/doorlight_grn.tga
rgb 5
}
}

textures/base_door/doorlight_grn
{
//noShadows
qer_editorimage textures/base_door/doorlight_grn.tga
bumpmap textures/base_door/doorlight_local.tga
        diffusemap textures/base_door/doorlight_grn.tga
{
blend add
map textures/base_door/doorlight_grn.tga
colored
}
}


Does anyone know enough about the material files who knows what needs changed to get green to appear fully opaque rather than a mixture?

Snehk

I don't see anything wrong with those materials, but I'm not a materials expert, or even Doom3 modding expert. Maybe check which material doors scripts call?

spamclark15

It's not something wrong, it's just not looking quite like I would like. It's not an issue with scripts but rather the way the material is displaying the green light texture on top of the red but not displaying it opaquely.

argoon

Instead of blend add

try all the other blend types and see what they do:

blend blend

blend filter

blend none

See here https://www.iddevnet.com/doom3/materials.php  for more information on materials.

You could also try removing the blend keyword and see what it does. 

Phrozo

Yes try blend blend instead of blend add if you want opacity. Also do you have your switch values in reserve? Maybe I'm mistaken but
in textures/base_door/doorlight you have '0' as a switch for red and '1' as a switch for green but in textures/base_door/doorlight_red_to_green you have '1' as a switch for red and '0' as a switch for green.

spamclark15

Those switches are actually untouched from the original material file base_light.mtr. For all I know the originals _could_ be messed up. Here's what I got:

Replacing blend adds with blend none = green doesn't appear at all, red always shown and unlit
Replacing blend adds with blend blend or blend filter = both red and green appear but are unlit

So it's possible to get them opaque doing this but they no longer appear lit?

Phrozo

If these are materials from the game then they should be fine. How many lights are there?

argoon

Quote from: spamclark15 on July 25, 2017, 02:23:53 PM
Those switches are actually untouched from the original material file base_light.mtr. For all I know the originals _could_ be messed up. Here's what I got:

Replacing blend adds with blend none = green doesn't appear at all, red always shown and unlit
Replacing blend adds with blend blend or blend filter = both red and green appear but are unlit

So it's possible to get them opaque doing this but they no longer appear lit?

Blend add works like photoshop Overlay blend, there's no light coming of those textures is just a trick, so if you want a color to appear "lit" you need to "blend add" a white image to it.


        {
if ( parm7 == 0 )
blend filter
map textures/base_door/doorlight_red.tga
colored
}
        {
if ( parm7 == 0 )
blend add
map _white
}



spamclark15

Is there a certain order these need to be in? I added the additional stuff and now they appear just solid white. Is filter required as the blend type?

argoon

Quote from: spamclark15 on July 25, 2017, 03:42:11 PM
Is there a certain order these need to be in? I added the additional stuff and now they appear just solid white. Is filter required as the blend type?

Perhaps, i'm using this from memory, i don't mess with idtech4 materials for a long time and i didn't tested the code above. But perhaps is full white because the blend add stage could be over-saturating the underlying color, you could try removing the blend filter and use other blend's, blend blend or blend diffusemap perhaps, you could also control the blend add strength with" rgb 1, 1, 1, alpha_number_here".

Is just a matter of trying until it works that was i found this stuff.

For example here is a material where i blend a color over a texture to make texture highlight system.

textures/door/door_wooden_door
{

wood

qer_editorimage textures/door/door_wooden_door.tga

diffusemap textures/door/door_wooden_door.tga

{
        if  ( parm7 > 0 )
        blend      blend
        map         _white
        color       0.99, 0.95, 0.62, 0.03
    }
}


The color keyword is so i can change the color of the highlight.

spamclark15


        {
blend blend
map textures/base_door/doorlight_grn.tga
colored
}
{
                blend   add
                map             _white
}


This was basically what I tried. I'm wondering if having multiple sections with a map causes the latter to replace the former?

spamclark15

Alright figured it out. Who keeps downvoting me for asking questions? Here comes another one, so get your downvote ready.

I'm wondering about the statues and the large beams that act as teleporters on the hell map. Since there don't seem to be any graphics files that are that green color or look the way they do, I assume they're defined as materials. Looking through the material file for hell doesn't have any obvious contenders. Is there a way I could determine the color and then search for that in all of the material files?

Phrozo

Mind sharing what the solution was?

spamclark15

I ended up not using the extra white blend and have "blend blend" set as the blend type for the 2 lights. After testing it over a wider range of maps it does seem to work properly. The behavior that id gave the lights is unusual, particularly as use of the flashlight makes the default behavior worse, where light colors become a 50/50 mix of both images leaving you with yellow when really even under the flashlight, they should appear red or green and not any other color. I'm guessing it was done in a hurry.

Phrozo

Hmm, still a bit perplexing. I wish I had Doom 3 installed to see so for myself.

Anyways the beams for the hell portals are made with particles. If you look at those particles in edit mode with the particle editor you should be able to select them and look at each stage to get the materials being used and also the vertex coloring used for that exact green it uses.