Jump to content
The Dark Mod Forums

Dynamic moonlight


SteveL

Recommended Posts

This a demo map for the dynamic moonlight that varies with cloud cover. One of two moonlight tests I'm working on. Discussion and screenshots in the WIP thread today: http://forums.thedar...post__p__339257

 

Unfortunately I've not done a pk4 before and there's a problem with it -- I can't start the map using the New Mission route. It works when installed and loaded via the console. It's just called "moon" so install it like any mission but then try loading it with: map moon

 

The map starts off with the moon fully hidden behind a cloud for 20-30 seconds to give the player time to orient. Then it'll start to appear. Stand where you can see some shadows and look to the south west for the moon.

 

You might want to use the TIMESCALE console command to fast forward at any time.

 

As anyone who digs into the pk4 will see, the secret to this is a low-res (128x128) export of the cloud layer's alphamap (done in gimp), and stored in an entityDef. I'll be back to give a detailed explanation tomorrow (yawn!). Cloud position is preserved on save games. The script doesn't hold or need any variable data.

 

Hopefully someone will be able to tell me what I'm doing wrong with the pk4: [Link removed -- fixed version below]

Edited by SteveL
  • Like 3
Link to comment
Share on other sites

Did it work for you loading with console?

I never put a gui loading screen in, so I'm not missing a file. I'm not sure that can be the problem as I can create a new empty map and load it using the new mission route, again without adding a gui screen.

Edited by SteveL
Link to comment
Share on other sites

I tried it using the in-game loader and it crashed. But I'm using a debug version of the DLL, which crashes sometimes in situations where a release version doesn't. I haven't debugged the crash.

 

What happens when others try loading it this way?

 

I used the "map moon" console method and it came up fine. It's an impressive technique once it gets going. For demo purposes, however, you might want to make the clouds move much faster. At first i swore the clouds were stationary and the stars were moving. Probably an optical illusion.

Link to comment
Share on other sites

It crashes for me using the in game loader too. I have to load it via console map command. Thanks for testing it. I have no idea how to interpret the crashing when normal loader is used. If no-one can fix that for me, I'll rebuild it from scratch instead of cutting out loads of stuff from my test map (which is what I did to make the above demo).

 

You can see it's the clouds moving if you look at the horizon, but I'll speed up the clouds on the next upload. I'm just extending it to give my caulk-tubes "method" of propagating moonlight a workout, and I'm adding a switch so I can can toggle the dynamic moonlight reduction off for the purpose of testing the light reaching all corners. I'll also set the cloud direction differently. I used a 45% angle for this demo but of course that means the same clouds pass over the moon with each cycle of the texture. There's no need for that repetition. The clouds look quite different when seen at different angles, so setting it an oblique angle would give hours without repetition.

Link to comment
Share on other sites

It's not just the missing GUI, I copied/modified a GUI from another mission and it crashed in midst of loading.

"The measure of a man's character is what he would do if he knew he never would be found out."

- Baron Thomas Babington Macauley

Link to comment
Share on other sites

I will have a go at fixing it now by adding the dynamic moonlight bits only to a new map which loads ok. I'm hoping the glitch is down to me deleting loads of stuff from a much bigger map in DR to make this demo rather than the load of a big entityDef

 

Thinking about how to make this effect prefab-able, or at least reuseable in DR: the cloud direction / speed could be set with shaderparms on the cloud patch, because they'll be accessible to both the script and the material. It would be better if the mapper could choose a starting position for the clouds, so they can choose bright or clear over the moon, but that'll depend whether there's another free shaderparm we can co-opt. It might benefit from a higher-res texture too: 1024 gets pretty low-res when it's stretched over the sky. It's fine for most cloud layers but this one is meant to be looked at a lot.

Link to comment
Share on other sites

Fixed it! Phew! The moonlight setup wasn't the problem. It was something in my blueroom. I reacreated the blueroom with just the bits needed for this demo and it now works through the normal loader.

 

I'll upload a fresh version when I've made it go faster and tried another cloud direction and written up the caulk tubes bit.

Link to comment
Share on other sites

Ok guys, see if you can break this.

 

New version of the demo map with the crashing-at-start issue fixed, with faster clouds at an oblique direction so they don't repeat, and with extended areas to demo the second thing I want to test: a single parallel light flooding entire map with moonlight just like ambient world does (earlier discussion here: http://forums.thedar...post__p__338956 ). You still start off with 15 seconds of cloud, but overall the speed is tripled.

 

The moonlight effect looks less natural at this accelerated speed, but having to wait a minute between transitions in a test map is unhelpful. Please take that into account, as well as ignore missing walls.

 

I've added a big switch near map start that lets you turn off the dynamic moon dimming, and leaves it shining bright cloud or not, to make it easier to test the moonlight propagation.

 

 

 

Notes on the single moonlight setup

 

post-29566-0-15436200-1394311837_thumb.pngpost-29566-0-01258600-1394310523_thumb.png

 

DISCLAIMER: I have no idea why this method works or whether it will tomorrow. I'm just sharing it because I've not been able to break it yet in 3 maps I've tried it in.

 

There's a single parallel light in the box high above the map. It's connected up to every exterior visleaf by caulk tubes, and to every interior visleaf that needs moon shadow. The end of each route has a single VP between the visleaf and the moonlight. The big area has a single caulk tube which floods a box that sits over the whole area. If you open up that top ceiling, you'll see lots of little VPs inside the box, one for each visleaf in the big area below.

 

If you brick up any of the visportals in the ceiling above a visleaf, the moonlight will glitch in that visleaf.

 

I've found the portals don't need to be open. You can use permanently closed func portals if you want, but I see no need. The extra portals don't open unless the leaf below them is to be rendered anyway.

 

You need a func static ceiling if you have a VP in the ceiling of a room of course. I've left off the FS ceiling in the building at the top right/northeast of the map so you can see sky through the VPs, and you can see they cast a small square of moonlight on the walls of the room.

 

The test map: https://www.amazon.c...yRr0shA-cB3zC38

 

EDIT: Added 2nd image

 

Update Nov 2014: I know a bit more about how this works now and I don't necessarily recommend it for a big map. It makes all areas in the map "connected" areas which means all the entities in those areas get tested for shadow interactions with the current view. That's not necessarily a big problem -- it's a bounding-box test rather than an expensive test on the exact shadow -- but the technique is disabling a (problematic) performance optimization in the engine so use with caution and if there are performance issues maybe try to break up the exterior into more than one parallel light separated by an indoor section or tunnel to cover the seam between the parallel lights.

Edited by SteveL
  • Like 2
Link to comment
Share on other sites

Wow, this is really cool use of caulk tubes. Where'd you get that idea? :P

 

Just kidding of course! Its cool that the caulk tube trick can be used to do something useful and imaginative.

 

Really interesting use here. This will help outdoor immersion a great deal.

 

Does this work without the visportals in the tube ends or did you add those to fix the flicker?

 

Also, visportals close when you have your back to them so if you turn away from the tube visportal in the ceiling, does the moon light effect stop?

Edited by Lux
Link to comment
Share on other sites

Thanks for the confirmation grayman.

 

@Lux: have you found something cool to do with caulk tubes too? I'm interested in any other tricks. This one I stumbled on independently, you'll see my thought process gradually taking shape in the first thread I linked :-)

Link to comment
Share on other sites

\o/ I (may) have contributed something to TDM finally! Cool and thanks, SteveL.

 

The whole reason I did that was because I wasn't aware of how to make the mini scale city background or skybox stuff so it was just a workaround for my ignorance.

 

I haven't had time to run it yet as I'm at work but I'm going to check it out when I get home this evening and I'll let you know.

Edited by Lux
  • Like 1
Link to comment
Share on other sites

Really neat. I didn't notice any issues at all and walked around thoroughly. After taking a look at the map in DR its crazy how that works though I guess I've never really seen moon light like this before in TDM because of the previous issues.

 

In that back forest area with the hallway that had the square cutouts in the ceiling... the moon light came through and made a parallelogram on the wall because of the angle which was very cool... I started thinking... now make the moon light move with a script and timer and move the light across the wall and we have Raiders of the Lost Ark! Hehe.

 

Really great effect and opens a lot of possibilities.

 

I initially took the files out and put them in my test directory and tried running it that way but there were black patch textures and no skybox so I tried dmapping and got 3 leaks so I wasn't sure what was going on. Probably the directory it was being dmapped from I guess, because the .pk4 worked fine installing and running from the menu.

  • Like 1
Link to comment
Share on other sites

 

In that back forest area with the hallway that had the square cutouts in the ceiling... the moon light came through and made a parallelogram on the wall because of the angle which was very cool... I started thinking... now make the moon light move with a script and timer and move the light across the wall and we have Raiders of the Lost Ark! Hehe.

 

 

FYI. The most optimized way to move the apparent projection for a light is to move it's "light_center" value rather than moving the light itself.

 

GoliathVT over at Doom3world made a dynamic daylight script that did just that along with changing color to match sunset etc.

  • Like 1

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

  • 1 year later...

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.
      · 5 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...