Darkness Effect question

Hello people, I was wondering how I would go about doing a darkness effect, that whilst having something that produces light sorda effects the way you see in the darkness, my main question is how do I actually go about doing a darkness effect?

It might help if you give us a better explanation, a picture, or maybe a video that shows us what you want to accomplish.

An entity that emits darkness instead of light?
Something that makes it easier / harder to see in the dark?

It isn’t very clear what you are asking for.

Pretty much making the ENTIRE map dark is what I’m asking about, like pretty much pitch black, and any map lights or a flashlight lights up the area it’s in, if that is a bit more specific.

You’d call engine.LightStyle( 0, “z” ) on the server and then on the client you’d want to call render.RedownloadAllLightmaps( ).

Should only need to set the lightstyle once and then redownload only once on start assuming it doesn’t handle it automatically.

On maps that have a light_environment ( or 2, inside/outside ) like rp_evocity_v33x, you won’t need to call the render.RedownloadAllLightmaps( ) function ( it causes a freeze for most players anywhere from 200-600ms ) as it is built into the map.

On maps like rp_evocity2_v2p, which don’t have light_environments, you could do the render.RedownloadAllLightMaps( ), but the models will never update. Meaning, if you join during day and it switches to night the models ( trees, etc ) will be bright. If you join at night then it becomes day, the models will stay dark.

You can fake night-time by using fog to create a nice dark effect without using render.RedownloadAllLightMaps at all! This along with a good day_night system will give best results.

I’m mainly looking for a “night” system Acecool rather then a day-night, you’re described “Fake night-time” By using fog to create a nice dark effect, how dark would it physically be? Would it be pitch black? Light enough out to see everything, dark enough to see nothing without a light? Because I feel that it would be easier then using render.RedownloadAllLightMaps, and was curious about this.

You can set it to how you like. Here are some screenshots:

Without fog, should issues with the render.Redownload:


v2p with fog


v33 with fog


You can set it as light / dark as you like, and you can set it as close / far starting to end point as you like. It gives a much better representation of dark than just light-environment by itself. The downside is that you lose the ability to use fog effects for weather ( at least at night ).

I used Fog Density 0.9 I believe. Setting it to 0.99 is super dark and moving down makes things more visible, while 1 is solid black.

ENV_SKYPAINT.fog:SetKeyValue( "fogmaxdensity", _effect.FogDensity, 0 );

If you are going to only have a “NIGHT” time ONLY system, I’d recommend using the render.RedownloadAllLightMaps on join, and set it to a somewhat darker level to help with models being darker, etc…

How would I do this properly so that it is pretty much pitch black with very little visibility, but not completely pitch black?

Set the fogmaxdensity to 0.95 to 0.99
The color of the fog should be black.

ENV_SKYPAINT.fog:Fire( "SetColor", _r .. " " .. _g .. " " .. _b, 0 );
ENV_SKYPAINT.fog:Fire( "SetColorSecondary", _r .. " " .. _g .. " " .. _b, 0 );

where _r, _g, _b are 0, 0, 0 ( hard-code them if you like, this was copied from my day/night system )

Try those values and see how you like them. Also, when the client joins do a render.ReDownload… For the server, make sure to update the lightmap to “a”, or “b”… a is the darkest setting, but on some maps it makes the roads black, if that is the case you’ll need to use b.

Figured it out using
render.FogMaxDensity( x )
render.FogMode/FoxStart/FogEnd/FogColor works just fine. thanks for your help.