Lighting Problems

I’m making a gamemode that needs to have changing days. The world lighting is fine, it’s the entity lighting that has the problem.
This is the lighting code :



function GM:Think()
if SERVER then
engine.LightStyle( 0, string.char( time.light ) )--Lights the map fine
elseif CLIENT then
render.RedownloadAllLightmaps()
end
end


The map lighting is fine, except the entity lighting is the same. When it’s night, the entities have daylight lighting and are bright compared to the dark around them.

Pretty sure it can’t be fixed.

Correct me if I’m wrong but the lighting of models and the map itself are baked into it when compiled. You would need some serious changes to the source engine in order to get this to work properly. That or completely custom models and maps.

It’d take some map logic to fake a day-to-night system. Even then; it would be very expensive, file size intensive, and cause graphical bugs in-game.

But if you can do this all with lua; that’d be pretty fantastic.

[editline]16th June 2015[/editline]

A way that I can think of off the top of my head is not utilizing prop_statics and instead use prop_dynamics. The file size will be very heavy and it’ll take extra optimization; but this may help you get closer to your goal.

Cubemaps will have to be disabled, or else you’ll get funky reflections.

-Snip- Here’s Cube maps with [lua]lua_run engine.LightStyle( 0, “\001” )[/lua]

http://images.akamai.steamusercontent.com/ugc/519385362700292532/314236AC5950BA0ACE365CB7E59CFB8629595EA2/

Cube map seems to adapt to brightness change, but its not very good.

And yeah, just replace all the prop_static with prop_dynamic

I know Team Fotress 2 made it so that static props started using lightmaps instead of being lit from the vertex.

Maybe if Garry got this feature into Garrysymod’s client.dll and VBSP, static props would work properly with a day/night cycle.