Author Topic: Light material question  (Read 310 times)

0 Members and 1 Guest are viewing this topic.

spamclark15

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Light material question
« on: July 25, 2017, 12:26:05 AM »
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

Code: [Select]
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

  • Newbie
  • *
  • Posts: 34
  • Karma: +4/-0
  • Doom Newbie
    • View Profile
Re: Light material question
« Reply #1 on: July 25, 2017, 08:54:13 AM »
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

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Light material question
« Reply #2 on: July 25, 2017, 12:50:35 PM »
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

  • Sr. Member
  • ****
  • Posts: 275
  • Karma: +21/-81
  • Doom Newbie
    • View Profile
Re: Light material question
« Reply #3 on: July 25, 2017, 01:48:50 PM »
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

  • Mr. Phrozo
  • Jr. Member
  • **
  • Posts: 89
  • Karma: +15/-1
  • :3
    • View Profile
    • Mod Page
Re: Light material question
« Reply #4 on: July 25, 2017, 01:58:44 PM »
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

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Light material question
« Reply #5 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?

Phrozo

  • Mr. Phrozo
  • Jr. Member
  • **
  • Posts: 89
  • Karma: +15/-1
  • :3
    • View Profile
    • Mod Page
Re: Light material question
« Reply #6 on: July 25, 2017, 03:03:45 PM »
If these are materials from the game then they should be fine. How many lights are there?

argoon

  • Sr. Member
  • ****
  • Posts: 275
  • Karma: +21/-81
  • Doom Newbie
    • View Profile
Re: Light material question
« Reply #7 on: July 25, 2017, 03:21:10 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.

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

 

spamclark15

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Light material question
« Reply #8 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?

argoon

  • Sr. Member
  • ****
  • Posts: 275
  • Karma: +21/-81
  • Doom Newbie
    • View Profile
Re: Light material question
« Reply #9 on: July 25, 2017, 04:09:15 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.

Code: [Select]
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

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Light material question
« Reply #10 on: July 25, 2017, 07:24:17 PM »
Code: [Select]

        {
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

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Light material question
« Reply #11 on: July 26, 2017, 02:17:04 AM »
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

  • Mr. Phrozo
  • Jr. Member
  • **
  • Posts: 89
  • Karma: +15/-1
  • :3
    • View Profile
    • Mod Page
Re: Light material question
« Reply #12 on: July 26, 2017, 08:37:56 AM »
Mind sharing what the solution was?

spamclark15

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Light material question
« Reply #13 on: July 26, 2017, 03:29:31 PM »
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

  • Mr. Phrozo
  • Jr. Member
  • **
  • Posts: 89
  • Karma: +15/-1
  • :3
    • View Profile
    • Mod Page
Re: Light material question
« Reply #14 on: July 27, 2017, 12:14:19 AM »
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.