Jump to content
The Dark Mod Forums

Electrically flickering windows


Dragofer

Recommended Posts

In my mission I have a lot of flickering electric lights, but at the moment it somewhat stands out that the windows have a constant light intensity. They're lit up by those same electric lights from the interior, so they should be flickering in a similar way too.

 

So far Ive found 2 methods for making something flicker:

1) adding 'rgb candle_01 [ time * .05 ]' to the material, such as in diamond_pattern02_flicker02.

2) making the _color intensity depend on the sound volume, which is what the electric lamps use.

 

The problem with #1 is that it's more pulsating slowly than flickering, while #2 requires a sound to be played at an audible volume. Isn't there a better way to make a texture flicker in an electric kind of way?

Link to comment
Share on other sites

You can increase the speed of the flickering in 1 by using higher numbers than .05.

Link to comment
Share on other sites

Multiplying the speed by 3-5 looks fairly decent and I can work with that, but still it's constantly going up and down a sine curve. The ideal would be to make it blink off every now and then. Alright, I could think of a way to script it, but can it be done via a material?

Link to comment
Share on other sites

In regards to method 1 you should use the flickering method as used by the light shader of the nearby light. This way both light and window flickering will be in sync.

 

Another approach (especially if there are several light sources nearby) would be to make uses of the script function vector getLightInPVS(...). It computes the light hitting the respective entity. Note though that

  1. it requires you to write a scriptobject to be used by the respective windows
  2. the materials used by that windows must be altered, too
  3. it may get performance houngry if there are lots of lights/windows in the scenes your mission consists of
  4. the light calculation will most probably refer to the origin, which, depending on where that is, my lead to inaccurated results
  5. it may not take blocked off light sources into account.

I was thinking about creating such a script object on my own for a while now. It is already possible to change the skin of windows by adding them as a target to a nearby light source, as long as the latter uses the tdm_light_holder scripobject. Most stock combined light entities do so. That is a change introduced by me in 2.05 iirc. The above behaviour would be an extension to that behaviour, but I haven't found the time to completely think it through yet.

 

However, depending on your mission a simpler solution might already suffice.

  • Like 1

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Another approach (especially if there are several light sources nearby) would be to make uses of the script function vector getLightInPVS(...). It computes the light hitting the respective entity.

Alright, so this sounds like making a kind of lightgem calculation to find out how bright the exterior window should be. It's an interesting idea and I think it'd be especially useful for doors with windows in them, though for my usage a simpler solution can indeed be used because most of the time you can't see the light source and the exterior window simultaneously. In those cases where you do see both I can use a good light.

 

I'm thinking now of just using a fast-acting fading script that's called at random intervals on certain windows, if nothing else.

Edited by Dragofer
Link to comment
Share on other sites

Actually at a second glance it looks like

rgb candle_01 [ time * .05 ]

can be interpreted as 'let the intensity follow the pattern of candle_01 at a speed of [time * 0.5].

 

If I knew what kind of asset 'candle_01' is, then it'd be possible to create new patterns for electrical flickering. Any ideas where it's found?

  • Like 1
Link to comment
Share on other sites

Multiplying the speed by 3-5 looks fairly decent and I can work with that, but still it's constantly going up and down a sine curve. The ideal would be to make it blink off every now and then. Alright, I could think of a way to script it, but can it be done via a material?

 

The strength of each change is controled by the "table" the formla uses (that's what candle01 is). A table that uses "0, 0.5, 1, 0.5" will cycle from off to half brightness to full brightness to half and back to off. A table like " 1, 1, 1, 1, 1, 0, 1, 1, 1" would stay on full brightness most of the time but would blink off momentarily (the length of time each number occupies depends on the speed you set using the "time" formula).

 

You can make your own table in material files (the light material file has examples of the syntax). Or you can pick a table the already has the values you want and put that name in the material shader instead of the candle one currently being used.

  • Like 1
Link to comment
Share on other sites

Link to comment
Share on other sites

  • 3 weeks later...

Did you try to use the "sound" keyword in your material?

Right, you need it to be playing currently.

What would happen if you put the second sound on this side of the window and gag it? So that not only it's flickering but also mumbling.

Thanks for offering ideas duzenko - if I got your point correctly you'd make the windows themselves emit a muted flickering sound? The issue with that is that the colour intensity is tied to the sound intensity, so an audible sound has to be heard. Hmm... maybe I could make a custom soundshader where the sound is played with 0.01 range. Re-export each room's windows as a single model to reduce the number of speakers.

 

Well what I've settled on so far is to make new window materials and instruct them to follow a table of colour intensities + use healthier lamps for places where you can see both the lamp and the exterior window.

 

Ideal world would be to link the windows directly to the lamp entities, but there are good alternatives which I'm quite pleased with.

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

    • 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.
      · 2 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
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...