Jump to content
The Dark Mod Forums

Complex Window Shaders


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 post
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 post
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 post
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 post
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.

×
×
  • Create New...