Jump to content
The Dark Mod Forums

Discussion about window textures


SneaksieDave

Recommended Posts

To start, a question:

1. What is it about some colors or diffusemaps ( e.g., textures/darkmod/window/largesquare01_lit ) that make them fullbright in Doom3 regardless of lighting? Besides these windows, I know it can be done because of the many blinking console lights or monitor readouts in Doom3, or burning runes in the expansion, etc. Is this a special palette, or...? How is it done, basically.

 

Next: I was looking for anything in the windows textures which suited a need, and realized some strangeness about the way many are implemented. Take for example the largesquare01 series. We have basically the same diffuse half a dozen times in the repository (with minor edits to the brightness). I'm not sure this is the best way to do it, especially considering the clutter that's growing out of it; there ought to be a clean, workable method to achieving varied light levels for windows. Below is an image of three windows, the _barelylit, the _lit, and the _lit again, but with an RGB modifier. The goal was to make the right window look like the left window. Obviously it's not perfect; it looks like there's a bit of saturation and contrast lost by doing it this way. But the question is brought up: are we currently going about this wrong? Do we need a different diffuse for every desired degree of lighting behind a window? Every additional diffuse eats memory in game and in the editor, and adds to the repository size (sure, it's only ~2Mb extra for this window set, but surely we want and will have a wide variety of windows). So, more questions come up:

 

2. Is there a way to affect the RGB and not wash it out, or to affect saturation and contrast, in a material?

 

3. Should we perhaps make shades of glass only, and pair them up with frames separately, perhaps as decals? That way the light can be the special color palette (or whatever), affected by RGB statements, and then the decal is placed over it, unaffected by the modifications.

 

4. Is there a better way to achieve this altogether?

 

The advantage to using material modifications is that it requires no extra space, and there could be literally a hundred shades of lighting if we wanted it. But can the result be improved a bit? Or is it good enough, considering the benefit? I think it's worth looking into this, considering the limitations, requirements, and clutter that's forming from the current system. What if we wanted to treat a large decorative stainedglass window the same? Duplicate it 6 times in the repository? Doesn't seem right to me.

post-58-1206923280_thumb.jpg

Link to comment
Share on other sites

To start, a question:

1. What is it about some colors or diffusemaps ( e.g., textures/darkmod/window/largesquare01_lit ) that make them fullbright in Doom3 regardless of lighting? Besides these windows, I know it can be done because of the many blinking console lights or monitor readouts in Doom3, or burning runes in the expansion, etc. Is this a special palette, or...? How is it done, basically.

It's the material definition. In short, it's down to "blend modes". Ordinary objects like, for example, horseshoes use the diffuse blend mode, which does react to lighting. The windows use whatever the default blend mode is - I'm guessing add - which doesn't react to lighting.

 

See http://www.doom3world.org/phpbb2/viewtopic.php?t=6617 for a quick and dirty primer on materials, stages, and blend modes, and also see:

 

http://www.modwiki.net/wiki/Material_%28decl%29

http://www.modwiki.net/wiki/Blend_%28Mater...tage_keyword%29

 

----

 

In principle it's not nice to have lots of textures which differ only by their brightness. In practice I'm not sure how much it matters. Still, if you want to change it, and you can make them still look good, I'm not going to complain. :)

My games | Public Service Announcement: TDM is not set in the Thief universe. The city in which it takes place is not the City from Thief. The player character is not called Garrett. Any person who contradicts these facts will be subjected to disapproving stares.
Link to comment
Share on other sites

You could do it like this :

the first Stage would be the Window-Frame Diffuse ( could also have additional spec/bump if necessary ) - and then you can add 2 ( or even 3, one alone usually looks too dull ) additive RGB-colored Stages using greyscale Emissive Textures to get the self-illumination going.

 

Thats basically how i set up most of the colorable Lantern Materials.

 

A quick mockup Material :

 

someYellowWindow
  {
   bumpmap textures/windowFrameBump
 specularmap textures/windowFrameSpec
 diffusemap textures/windowFrameDiffuse
	 {
		 blend add
		 map textures/windowEmissive
		 red 1
		 green 1
		 blue 0
   }
   {
		 blend add
		 map textures/windowEmissive
		 red 1
		 green 1
		 blue 0
   }
  }

 

That would allow you to choose pretty much any color you want the window to emit without having to go into Photoshop to change a Texture. Downside is tho that since that is based on greyscale Textures, it doesn't allow for fancy hue-changes in the color of the additive Textures.

You could of course just use a "pre-colored" Emissive Texture and just base it on "rgb x" instead of explicit "red green blue" settings.

Link to comment
Share on other sites

It's the material definition. In short, it's down to "blend modes". Ordinary objects like, for example, horseshoes use the diffuse blend mode, which does react to lighting. The windows use whatever the default blend mode is - I'm guessing add - which doesn't react to lighting.

Argh, I should've figured that out, as when I was experimenting, I kept getting a fullbright window (of a different diffuse) without trying, until I changed map to diffusemap. It sat there, defiantly ignoring my RGB statement, and I didn't even think of the fact that somewhere in the definition was exactly what I was looking for. Good thing I wasn't trying to discover penicillin. :rolleyes:

 

the first Stage would be the Window-Frame Diffuse ( could also have additional spec/bump if necessary ) - and then you can add 2 ( or even 3, one alone usually looks too dull ) additive RGB-colored Stages using greyscale Emissive Textures to get the self-illumination going.

Very interesting, and yet another thing showing my complete lack of experience or comfort with materials. :laugh: I'll have to try messing around with that and see what comes of it.

 

Downside is tho that since that is based on greyscale Textures, it doesn't allow for fancy hue-changes in the color of the additive Textures.

You could of course just use a "pre-colored" Emissive Texture and just base it on "rgb x" instead of explicit "red green blue" settings.

That is a shame, but it sounds like this (either method) could at least achieve what's being done now, but with two image files instead of half a dozen, so that's definite improvement.

Link to comment
Share on other sites

I think this is something that deserves attention. I had the same thought when I saw the number of window textures we have, but simple rgb keywords in the shaders don't achieve quite the same effect, as you saw.

 

I'm sure there's a way to do it if someone has the time, patience and/or shader experience to dig into it.

Link to comment
Share on other sites

I'm gettin' there... I think.

 

Here's what I've got so far, and results. I'm now grabbing at straws, because I guess anything could be wrong ranging from complete misunderstanding down to a simple juxtaposed statement (you can mess up a whole material just by putting things in the 'wrong' order <_<). Thus, I thought to ask before burning out on this.

 

Results are pretty self explanatory, the images are blend add and blend filter/modulate respectively. Blend blend only gives me the glass overtop everything. There are far worse variations, where the glass drowns out the frame, or only the frame shows, or it's all black.

 

Even the best result so far though, filter, is wrong. Note how much darker it is than the source window on the left, and that's with the rgb set fully to 1. Also, though it's hard to see in this image, the glass itself is showing right through the frame. Not a problem here, but it should not be accepted, and would definitely be a problem in other cases.

 

Can anyone see what's wrong, or direct me what to consider? I've tried maybe 100 permutations of this definition already. I really, really hope it's not the case that alpha is needed on both the frame and the glass image files, because then we're getting back into file clutter, non-reusability; the goal here is a system for all windows, easy to use and efficient. If it can't be done properly this way, perhaps decal frames are better afterall.

 

textures/darkmod/window/sd/window1
{
qer_editorimage	textures/darkmod/window/pebbly_glass_noframe01_lit

{
	blend diffusemap
	map textures/darkmod/sd/window1
	alphatest 0.7	
}

{
	blend filter
	map textures/darkmod/window/pebbly_glass_noframe01_lit
	alphatest 0.7
	red 1
	green 1
	blue 1
}
}

 

Edit: In fact, that can't be the case, there must be a way for this to work, so that only the frame shows on top, and the glass is covered (completely) by it but drawn everywhere else, because there are such things in D3 if I remember correctly. So it's a question of what I've got wrong here.

post-58-1206984220_thumb.jpg

post-58-1206984226_thumb.jpg

Link to comment
Share on other sites

I'm gettin' there... I think.

 

I think you need a frame diffisue texture that has alpha 0 (aka "a hole") where the frame is.

 

So you first render the glass diffuse, with RGB colors. Then you add the frame on top, and the frame will cover only the areas where no hole is, so leaving the glass alone.

 

Or at least I don't see how you can ever achive theeffect with only one diffuse map and no alpha.

 

Edit: I can make a window frame version with alpha channel if you want.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

What does it look like with this ? I'm not quite sure how Doom3 copes with a Material that adds the Diffuse last, but meh :

 

textures/darkmod/window/sd/window1
{
qer_editorimage	textures/darkmod/window/pebbly_glass_noframe01_lit
{
	blend add
	map textures/darkmod/window/pebbly_glass_noframe01_lit
	red 1
	green 1
	blue 1
}
{
	blend diffusemap
	map textures/darkmod/sd/window1
	alphatest 0.7	
}
}

Link to comment
Share on other sites

Hum hum, should have known, doh ! :)

What about this ? :

 

textures/darkmod/window/sd/window1
{
qer_editorimage	textures/darkmod/window/pebbly_glass_noframe01_lit
{
	blend add
	map textures/darkmod/window/pebbly_glass_noframe01_lit
	red 1
	green 1
	blue 1
	ignoreAlphaTest
}
{
	blend diffusemap
	map textures/darkmod/sd/window1
	alphatest 0.7	
}
}

Link to comment
Share on other sites

I think I got it! One sec; I'll try your code there and then post what I found.

 

Edit: or maybe not. Trying some mode mixing from iddevnet and getting warmer, maybe.

 

@rebb: Here's the result of your above code. Looks like the frame shows very faintly, and the whole schebang is transparent.

post-58-1206986427_thumb.jpg

Link to comment
Share on other sites

For my own sanity, I'm going to step through a very simple attempt at understanding this. I've tried almost everything on the iddevnet chart of src and blend modes, but haven't succeeded yet.

 

What do we want? A frame, and a window. Okay:

 

1. Create a frame from a texture with alpha.

textures/darkmod/window/sd/window1
{
qer_editorimage	textures/darkmod/window/pebbly_glass_noframe01_lit

{
	blend diffusemap
	map textures/darkmod/sd/window1
}
}

See image 1.

 

2. Enable alpha transparency.

...
			alphatest 0.7
...

See image 2.

 

So far, we're golden.

 

3. Now, whereever the frame exists, draw nothing. But where it doesn't, draw some glass. Now everything goes haywire. Note: I changed the glass image so it would be more obvious when it's drawing right over the frame.

...
{
	blend gl_one, gl_dst_alpha
	map textures/darkmod/sd/pebbly_glass_noframe01_lit2
	alphatest 0.7
}
...

???

See image 3. Note that is but one of many possible results from combining the constants on iddevnet (it would be a much longer post to cover all source possibilities and results). I read the above as "blend, using the full source image, whereever the destination alpha exists." Clearly, I'm reading it wrong. :)

 

Of course, there's the opposite approach as well (draw the glass, and lay a frame with alpha overtop), but that has had no better success (in fact, worse).

post-58-1206989419_thumb.jpg

post-58-1206989460_thumb.jpg

post-58-1206989468_thumb.jpg

Link to comment
Share on other sites

This seems to work :). Hooray for iddevnet.

 

textures/darkmod/window/sd/window1
{
qer_editorimage	textures/darkmod/window/pebbly_glass_noframe01_lit
noshadows
twosided
translucent
glass
forceoverlays
sort decal

{
	blend diffusemap
	map textures/darkmod/sd/window1
	// maybe an alphatest here ?
}
{
	maskColor
	map invertAlpha( textures/darkmod/sd/window1 )
}
{
	blend gl_dst_alpha, gl_one
	map textures/darkmod/window/pebbly_glass_noframe01_lit
	red 1
	green 1
	blue 0
	alphaTest 0.7
			// maybe a maskalpha here ?
}
}

Link to comment
Share on other sites

Hooray! :) I can confirm from below that the zig-zags don't appear to be shining through, so you've got that nailed. The only concern is the washing out. Since the source images remain the same, I assume some statement in there is not exactly the right one. But that gets us past the alpha issues!

 

Edit: It also has a nice bonus of accepting local lighting. It didn't occur to me that other lights being fullbright wouldn't be able to.

post-58-1206990491_thumb.jpg

Link to comment
Share on other sites

What do you mean with "washing out" ?

If you mean that the color of the texture just gets more "dull" as the rgb is decreased, thats because its basically just being multiplied down.

Duplicating the last stage in the above Material can help this a bit, because it adds the colored stages together.

Link to comment
Share on other sites

Nevermind, that was the result of trying to use equal RGB values (first, too high at rgb=1, later too low). Some minor tweaking got them to look normal (r=0.85, g=0.8, b=0.75).

 

Thanks! I'd say this pretty much establishes a good system. Now I can try to improve my test window (and make more).

post-58-1206991695_thumb.jpg

Link to comment
Share on other sites

An interesting thing is that the color of the clear areas on the frame affects the glass result. At first, the alpha sections were white, and as such the glass was very bright when a local light source struck it. I then tried black, and local light sources then had no effect on the glass! I settled for somewhere in between, so there is some effect but not too much.

 

Anyway, here are some pics in action. Not a final result, just wanted to get something up there to show. There is no specular yet, I don't think the normalmap is strong enough, and they're just quick rgb values to show possibilities (1, 1, and 0.1). Also, a question remains: how to get the specular and normals of the glass itself to show, in addition to that of the frame. It seems the material will accept only one specular and normal, that of the diffuse, because when I tried to add another to the glass stage, the material is black (addnormals isn't doing it, also giving me black). :unsure:

post-58-1207000046_thumb.jpg

Link to comment
Share on other sites

Yes the color of the diffuse has an effect, using black in the areas where the emissive will be overlaid is probably the best. The "colorme" Lantern Materials also have black areas where the additive stuff goes.

 

Afaik you can only have one diffuse/normal/specular stage in a material.

Link to comment
Share on other sites

Got it. [Edit: sorta... see below] This was one of those stages where it has to be in exactly the right spot (I tried it before and after each map definition, and every result was different) and at first I had the syntax a bit wrong too.

 

So the diffuse stage becomes:

	{
	blend diffusemap
	map textures/darkmod/sd/window1
	blend bumpmap
	map addnormals (textures/darkmod/sd/pebbly_glass_noframe01_lit_local, textures/darkmod/sd/window1_local)
}

 

Next I guess is the task of not drawing on the parts where the frame is. Sounds familiar. :rolleyes:

 

(Obviously this isn't a real normalmap, I just needed something as POC and so I could see if it's working.)

 

 

Edit: Well, there's a possibility the last item can't be done. :-/ Trying to add a normalmap to only alpha blocked areas is not working. Attempts to add it to the first stage gives the result in the POC image; attempts to add it to the glass stage leave it blacked out. I'm about out of ideas on this one. Haven't tried adding speculars yet, but I imagine that will suffer the same limitation. This sorta sucks, but it's not a big deal compared to what has succeeded. It could still possibly be achieved with frames as decals.

post-58-1207001629_thumb.jpg

Link to comment
Share on other sites

  • 1 year later...

Hoping to spark this to life again; maybe some new knowledge or opinions are out there.

 

To recap:

Our /window texture folder is one of the ones most needing some TLC. It's currently disorganized: different methods are employed, none committed to, some things in folders and others not, and the majority of textures are quite bad and should not be distributed to users (there are some really good ones too).

 

In this thread the method being explored was one of using separate diffuses for the glass and the frame. The benefit of this is big: you can apply different RGB values to the glass stage, which makes the glass brighter or darker, and not to the frame, which receives local light instead, and the result is you can have many windows of varying brightness, no need for expensive light entities, and all from just two DDS files.

 

The two techniques used for this method here were:

1. using a frame decal laid over a window

2. using two diffuse stages in one definition

 

The drawbacks found in these methods are, respectively:

1. bad jaggies and alphatest degrading (see images 1, 2)

2. limited to one normalmap (the frame) so the glass will always be 'flat' (see images 3, 4)

 

IMO, #2 is the way to go, as the glass normals are usually not terribly important. Especially with a selection of nice diverse frames.

 

Following this setup, it also makes sense to use the sorting method used by Arcturus for his windows, that is the collection of same windows (different flavors, brightnesses) go within a single subfolder.

 

Questions:

* Your opinion on best method?

* Does anyone know why addnormals doesn't work here, to allow for two normalmaps? The assumption is that the use of an alpha interferes.

* Further input?

post-58-1238861527_thumb.jpg

post-58-1238861531_thumb.jpg

post-58-1238861534_thumb.jpg

post-58-1238861538_thumb.jpg

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

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 0 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
×
×
  • Create New...