Jump to content
The Dark Mod Forums

Complex Window Shaders


Springheel

Recommended Posts

I had two ideas for making some window textures with a little life in them.

 

Imagine walking through Jdude's city, and seeing a light suddenly go on in a window above your head, or seeing the shadows of people moving through the tavern window across the street.

 

I'm pretty sure both are doable with texture shaders, but I'm not totally sure how to set them up properly.

 

1. Make a window texture that fades from fully lit to unlit and then back again. I know this could be done easily with a gui, but could probably also be done with a texture shader by someone who knows what they're doing (Gildoran?). For best effect, the pattern of fading would have to be randomized, however, and I'm not sure how to do that. Is this possible, and if so how would it be done?

 

2. Use a gui or roq file to create the murky shape of moving figures behind a lit window. I could do this with a regular scrolling texture, but really it needs to be randomized for best results.

Link to comment
Share on other sites

I like that tavern shadows idea. That would likely be the animating shader, I'd guess. Would have to keep the player out of areas like that of course, unless it was scripted to turn off when they're inside.

 

Hm, then again, I assume it could be done in a more straight-forward way: maybe have one of those spectrum3 windows Gildoran demonstrated, and just have AI walking back and forth such that their shadow is cast on it. Doesn't give the illusion of bodies behind an opaque screen though... for that the shader would be better.

 

For the other, the light going on or off, I would probably just have a timed light which turns on and off (and maybe switching skins if necessary) controlled by a trigger_timer.

Link to comment
Share on other sites

Would have to keep the player out of areas like that of course, unless it was scripted to turn off when they're inside.

 

You'd only do it on the outside, presumably. But you'd want to avoid situations where you could see into the room and see the outside of the window at the same time.

 

Hm, then again, I assume it could be done in a more straight-forward way: maybe have one of those spectrum3 windows Gildoran demonstrated, and just have AI walking back and forth such that their shadow is cast on it.

 

I want to avoid the mapper having to actually put AI behind a window--that's way too heavy on performance. I know a scrolling texture would work, it's just the randomizing part I'm not clear on. I'm pretty sure Gildoran said you could randomize animated textures, but I don't recall how.

Link to comment
Share on other sites

You could certainly do things with the window brightness fading in/out over time and with having "shadows" move across the brightness. You'd probably just use tables to control the animation. However tables loop over time and aren't random. You can't have truly random materials without some outside source influencing their parameters (which would require the window to be on an entity).

 

If you have a bunch of windows just applied to worldspawn, they will all animate the same way, all in-sync. There may be ways to mitigate that by having different animations for different parts of the texture space, but it could be difficult for the texture artist to set up, and would require the mapper to have each window occupy a different part of the texture space. It might also require more render passes per window, leading to performance problems.

 

If you want to have randomly animated windows which behave independently, by far the easiest way would be to put each window on a separate entity designed to control the window, though that could quickly eat up the 4096 entity limit. (it may be possible to economize by having a single entity control up to 12 independent windows) The other challenge would be having the window controller only running when in PVS; I think my previous solution to this may be buggy on multi-core systems, but using a more conservative approach should work almost as well.

 

I'm pretty sure Gildoran said you could randomize animated textures, but I don't recall how.
It's not possible for a texture to be truly random by itself. I might have been referring to using textures to cause stars to pseudo-randomly twinkle, or to using entities to randomly control textures...
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...