Odd lighting issue

I’m having some issues with my map. In large areas, static props are only being lit by the ambient value of the light_environment. Yet the same props in other areas are being lit by both. It’s not the props themselves or the origin. I’ve tried fixing that with the lighting origin setting. It seems that if a static prop is in that specific area, it doesn’t receive sun rays, only ambient rays. There are no brushes to explain why this is occurring. I compiled with -staticproppolys and -textureshadows on full and final. It also seems that while I do have staticproppolys enabled, static props do not cast shadows on the ground, at all. Dynamic entities such as prop_dynamic or props you spawn in garrysmod don’t seem to be affected by this issue.

https://dl.dropboxusercontent.com/u/52871438/Photos/rockford/2014-06-05_00001.jpg

The trees behind the fence are in the 3D skybox. The pine trees in the 3D sky are lit because I’m fairly certain the texture on the model is unlitgeneric.

Here’s a compile log:



================== VBSP ==================



materialPath: C:\Program Files (x86)\Steam\SteamApps\common\Half-Life 2\ep2\materials
Loading C:\mapsrc\rp_rockford_v0p.vmf
ConVarRef mat_reduceparticles doesn't point to an existing ConVar
Can't find surfaceprop asphalt for material OCRP/URBAN/ROAD_1_02, using default
material "ajacks/ben_paintblue" not found.
Material not found!: AJACKS/BEN_PAINTBLUE
Warning in .VMT file ($envmaptint): no ']' or '}' found in vector key "$envmaptint".
Did you forget to surround the vector with "s?
Could not locate 'GameData' key in c:\program files (x86)\steam\steamapps\common\half-life 2\ep2\gameinfo.txt
Patching WVT material: maps/rp_rockford_v0p/nature/blendmilground008b_2_wvt_patch
Patching WVT material: maps/rp_rockford_v0p/nature/blendgrassdirt01_noprop_wvt_patch
fixing up env_cubemap materials on brush sides...
0...1...2...3...4...5...6...7...8...9...100...1...2...3...4...5...6...7...8...9...10Processing areas...done (0)
Building Faces...done (0)
Chop Details...done (0)
Find Visible Detail Sides...
Merged 3358 detail faces...done (1)
Merging details...done (0)
FixTjuncs...
PruneNodes...
WriteBSP...
done (5)
writing C:\mapsrc\rp_rockford_v0p.prt...Building visibility clusters...
done (0)
Can't load skybox file skybox/painted to build the default cubemap!
Can't load skybox file skybox/painted to build the default cubemap!
Finding displacement neighbors...
Found a displacement edge abutting multiple other edges.
Finding lightmap sample positions...
Displacement Alpha : 0...1...2...3...4...5...6...7...8...9...10
Building Physics collision data...
done (2) (2661060 bytes)
Placing detail props : 0...1...2...3...4...5...6...7...8...9...10
Compacting texture/material tables...
Reduced 10673 texinfos to 6476
Reduced 1677 texdatas to 1487 (88537 bytes to 79556)
Writing C:\mapsrc\rp_rockford_v0p.bsp
28 seconds elapsed

================== VVIS ==================




8 threads
reading c:\mapsrc\rp_rockford_v0p.bsp
reading c:\mapsrc\rp_rockford_v0p.prt
3270 portalclusters
8375 numportals
0...1...2...3...4...5...6...7...8...9...100...1...2...3...4...5...6...7...8...9...10Optimized: 17164 visible clusters (0.82%)
Total clusters visible: 2091332
Average clusters visible: 639
Building PAS...
Average clusters audible: 2523
visdatasize:1763911  compressed from 2720640
writing c:\mapsrc\rp_rockford_v0p.bsp
2 hours, 15 minutes, 9 seconds elapsed

================== VRAD ==================




[Reading texlights from 'lights.rad']
[48 texlights parsed from 'lights.rad']

Loading c:\mapsrc\rp_rockford_v0p.bsp
Loaded alpha texture materials\models\props_foliage\cedar01_mip0.vtf
Loaded alpha texture materials\models\props_foliage\arbre01.vtf
Loaded alpha texture materials\Models\props_wasteland\fence_alpha.vtf
Error! Unable to load file "models/props_foliage/urban_streettree01.dx80.vtx"
Error! Unable to load file "models/props_foliage/mall_pot_large01.dx80.vtx"
Error! Unable to load file "models/props_foliage/mall_small_palm01.dx80.vtx"
Loaded alpha texture materials\models\props_foliage\Mall_trees_branches01.vtf
Error! Unable to load file "models/props_foliage/mall_big_plant01.dx80.vtx"
Error! Unable to load file "models/props_foliage/mall_bigleaves_plant03.dx80.vtx"
Error! Unable to load file "models/props_foliage/mall_bush02.dx80.vtx"
Error! Unable to load file "models/props_foliage/mall_pot_squarexl01.dx80.vtx"
Error! Unable to load file "models/props_foliage/urban_tree_giant01_skysphere.dx80.vtx"
Loaded alpha texture materials\models\props_forest\FenceBarbedWire_Wire.vtf
Loaded alpha texture materials\models\props_forest\FenceBarbedWire_Wire2.vtf
Error! Unable to load file "models/props_foliage/urban_tree_giant01.dx80.vtx"
30565 faces
22 degenerate faces
23960970 square feet [3450379776.00 square inches]
729 Displacements
8164477 Square Feet [1175684736.00 Square Inches]
30543 patches before subdivision
565693 patches after subdivision
1071 direct lights
0...1...2...3...4...5...6...7...8...9...100...1...2...3...4...5...6...7...8...9...10transfers 80329404, max 2082
transfer lists: 612.9 megs
0...1...2...3...4...5...6...7...8...9...10	Bounce #1 added RGB(829839, 776389, 667952)
0...1...2...3...4...5...6...7...8...9...10	Bounce #2 added RGB(311629, 254043, 184465)
0...1...2...3...4...5...6...7...8...9...10	Bounce #3 added RGB(130400, 99871, 65654)
0...1...2...3...4...5...6...7...8...9...10	Bounce #4 added RGB(58981, 42966, 25838)
0...1...2...3...4...5...6...7...8...9...10	Bounce #5 added RGB(29331, 20785, 11473)
0...1...2...3...4...5...6...7...8...9...10	Bounce #6 added RGB(14703, 10047, 5069)
0...1...2...3...4...5...6...7...8...9...10	Bounce #7 added RGB(7907, 5244, 2409)
0...1...2...3...4...5...6...7...8...9...10	Bounce #8 added RGB(4216, 2686, 1121)
0...1...2...3...4...5...6...7...8...9...10	Bounce #9 added RGB(2355, 1447, 547)
0...1...2...3...4...5...6...7...8...9...10	Bounce #10 added RGB(1302, 765, 262)
0...1...2...3...4...5...6...7...8...9...10	Bounce #11 added RGB(742, 418, 129)
0...1...2...3...4...5...6...7...8...9...10	Bounce #12 added RGB(419, 225, 63)
0...1...2...3...4...5...6...7...8...9...10	Bounce #13 added RGB(242, 124, 31)
0...1...2...3...4...5...6...7...8...9...10	Bounce #14 added RGB(139, 68, 16)
0...1...2...3...4...5...6...7...8...9...10	Bounce #15 added RGB(81, 38, 8)
0...1...2...3...4...5...6...7...8...9...10	Bounce #16 added RGB(47, 21, 4)
0...1...2...3...4...5...6...7...8...9...10	Bounce #17 added RGB(27, 12, 2)
0...1...2...3...4...5...6...7...8...9...10	Bounce #18 added RGB(16, 6, 1)
0...1...2...3...4...5...6...7...8...9...10	Bounce #19 added RGB(9, 4, 0)
0...1...2...3...4...5...6...7...8...9...10	Bounce #20 added RGB(5, 2, 0)
0...1...2...3...4...5...6...7...8...9...10	Bounce #21 added RGB(3, 1, 0)
0...1...2...3...4...5...6...7...8...9...10	Bounce #22 added RGB(2, 1, 0)
0...1...2...3...4...5...6...7...8...9...10	Bounce #23 added RGB(1, 0, 0)
0...1...2...3...4...5...6...7...8...9...10	Bounce #24 added RGB(1, 0, 0)
Build Patch/Sample Hash Table(s).....Done<0.4621 sec>
0...1...2...3...4...5...6...7...8...9...10FinalLightFace Done
Computing detail prop lighting : 0...1...2...3...4...5...6...7...8...9...10
0 of 0 (0% of) surface lights went in leaf ambient cubes.
0...1...2...3...4...5...6...7...8...9...10Writing leaf ambient...done
Ready to Finish

Object names       Objects/Maxobjs  Memory / Maxmem  Fullness 
------------       ---------------  ---------------  -------- 
models                  99/1024         4752/49152    ( 9.7%) 
brushes               7308/8192        87696/98304    (89.2%) VERY FULL!
brushsides           50789/65536      406312/524288   (77.5%) 
planes               19400/65536      388000/1310720  (29.6%) 
vertexes             58906/65536      706872/786432   (89.9%) VERY FULL!
nodes                 9596/65536      307072/2097152  (14.6%) 
texinfos              6476/12288      466272/884736   (52.7%) 
texdata               1487/2048        47584/65536    (72.6%) 
dispinfos              729/0          128304/0        ( 0.0%) 
disp_verts           46673/0          933460/0        ( 0.0%) 
disp_tris            72096/0          144192/0        ( 0.0%) 
disp_lmsamples     4537620/0         4537620/0        ( 0.0%) 
faces                30565/65536     1711640/3670016  (46.6%) 
hdr faces                0/65536           0/3670016  ( 0.0%) 
origfaces            19996/65536     1119776/3670016  (30.5%) 
leaves                9696/65536      310272/2097152  (14.8%) 
leaffaces            38643/65536       77286/131072   (59.0%) 
leafbrushes          17205/65536       34410/131072   (26.3%) 
areas                   11/256            88/2048     ( 4.3%) 
surfedges           202623/512000     810492/2048000  (39.6%) 
edges               149438/256000     597752/1024000  (58.4%) 
LDR worldlights       1071/8192        94248/720896   (13.1%) 
HDR worldlights          0/8192            0/720896   ( 0.0%) 
leafwaterdata            4/32768          48/393216   ( 0.0%) 
waterstrips              0/32768           0/327680   ( 0.0%) 
waterverts               0/65536           0/786432   ( 0.0%) 
waterindices             0/65536           0/131072   ( 0.0%) 
cubemapsamples         586/1024         9376/16384    (57.2%) 
overlays                49/512         17248/180224   ( 9.6%) 
LDR lightdata         [variable]    37939916/0        ( 0.0%) 
HDR lightdata         [variable]           0/0        ( 0.0%) 
visdata               [variable]     1763911/16777216 (10.5%) 
entdata               [variable]      930489/393216   (236.6%) VERY FULL!
LDR ambient table     9696/65536       38784/262144   (14.8%) 
HDR ambient table     9696/65536       38784/262144   (14.8%) 
LDR leaf ambient     45755/65536     1281140/1835008  (69.8%) 
HDR leaf ambient      9696/65536      271488/1835008  (14.8%) 
occluders                0/0               0/0        ( 0.0%) 
occluder polygons        0/0               0/0        ( 0.0%) 
occluder vert ind        0/0               0/0        ( 0.0%) 
detail props          [variable]           1/2458060  ( 0.0%) 
dtl prp lght          [variable]           1/275114   ( 0.0%) 
HDR dtl prp lght      [variable]           1/4        (25.0%) 
static props          [variable]           1/274862   ( 0.0%) 
pakfile               [variable]      479634/0        ( 0.0%) 
physics               [variable]     2661060/4194304  (63.4%) 
physics terrain       [variable]      205561/1048576  (19.6%) 

Level flags = 0

Total triangle count: 61319
Writing c:\mapsrc\rp_rockford_v0p.bsp
47 minutes, 1 second elapsed


I’ve tried rebuilding the 3D skybox. I’ve tried rebuilding the entire maps skybox. I’ve tried lighting origin. I’ve tried creating clean new static prop entities (instead of copypasta props). I’ve tried not using any compile prarmeters.

Any ideas?

On your prop_statics, you should see a property called “lighting origin”. Create an entity called info_lighting, name it, lighting_01 or something, make sure the entity is above the tree or to the side etc. Go back to that lighting origin property and put lighting_01. Recompile, don’t do a fast compile because that will give you choppy lighting. Also I don’t know what your making by entdata at 236%? Not good. Also brushes and vertex’s at 89%? OK completely ignore that ive just re-read your post lol, will think of another fix.

[editline]6th June 2014[/editline]

Ok on further inspection of that picture, it seems no shadows are being cast at all and prop polys vertex lighting etc hasn’t even loaded. Looking at your compile log, Vrad seems to have run fine with no leaks. If you have tried the lighting origin fix with no help, I would disable -staticproppolys and -textureshadows recompile and see if there is any difference. If that doesn’t help, re-enable them. Make a new map and construct a box 2048x2048 with a 3d skybox at the top. put your tree’s in and test on full with the same settings as your huge map, see the outcome. Im starting to think its going to be possibly with the size of the map. If that does work, I would try reducing entdata to under 100% and recompiling the larger map to see if it makes a difference. Also make sure you have a shadow control.

Ah. Thanks for the feedback. The origin doesn’t work as I mentioned before. I’ll try compiling a final without those parameters and see if it does anything. Another map I have, Ineu Valley 2, is the same size as this map and has a 3D skybox which has an entdata of like 140% (its all the bloody models) yet it compiled fine with the same parameters and HDR so I dont think its the sheer size of the map. Entdata isnt going under 100%. This is a vast City RP map so I’d have to delete a LOT of things. And yes I have a shadow controller.

I was poking around yesterday. This little blotch of light seems to be lined up with an areaportal to the main city. It’s an areaportal with the state set to always open. I’m going to nuke some areaportals and see if that helps at all too.

Update: I figured out a pattern in this. Any static prop that is in line of sight of the light_environment entity is lit by it. All others are only lit by the ambience. I’m going to try putting the entity in the 3D skybox and see what happens.

light_environment defines light from the skybox texture

Uh. Yeah like I didnt know that or anything…

I compiled it with the light_environment in the skybox, it’s confirmed that the lighting pattern of the ‘brightness’ keyvalue lights all static props that can ‘see’ the light_environment entity (by see i mean with visleafs, not geometry) I moved the light_environment entity from the main world to the 3D skybox. All the prop_static entities in the 3D skybox are now lit by the brightness keyvalue, but the prop_static entities in the rest of the world are only lit by the ambient keyvalue.

https://dl.dropboxusercontent.com/u/52871438/Photos/rockford/2014-06-10_00002.jpg

I’m going to look into the 22 degenerate faces…

What is the light_environment settings? It kinda looks like you have the casting direction inverted.

If the casting direction was inverted, the geometry would be lit inverted too dont you think? When you look at the hills in the background, they’re lit normally.

Also, in theory, moving the light_environment entity shouldn’t affect what props are it, but it does. This leads me to believe there is another bug there somewhere causing this weird issue. I heard that on rare occasions, degenerate faces can cause strange things to happen so I’m currently hunting them down. Its taking a long ass time though.

Finding and fixing degenerate faces is like trying to find an infinite number of needles in an infinite number of haystacks of infinite size, it’s not possible. You’re always going to have at least a few degenerate faces because of the way the VMF format stores brushes.

Brush faces are stored as clipped intersected planes, instead of the more precise method of storing brush verticies. Not only is this a problem because of the method, but it’s further a problem because the VMF format doesn’t have enough decimal precision. The endgame is that every time you save your VMF, the entire world is slightly corrupted.

When a brush is corrupted, the plane intersections have a chance of being ever so slightly off to where a new vert point is created. So now you have multiple vert points on the same corner on the same brush which causes a degenerate face. These are extremely difficult to find because you basically have to be zoomed in the maximum amount to see the problem and Hammer’s error check usually won’t find it.

Basically this happens:

Do you perhaps have another solution? Cause I’ve tried pretty much everything I know to fix this issue other then hunting those degenerate faces down.

I’ve heard that simply copying the entire map and pasting it into a new vmf can fix bugs too. I’m going to try this. Probably gonna crash hammer but fuck it, worth a shot.

Would this compile setting on Vrad help? -noskyboxrecurse

I’ve never used it, but it’s description is “Turn off recursion into 3d skybox (skybox shadows on world).”

“-noskyboxrecurse” just prevents objects in the skybox from casting shadows in the map. So if you have a bunch of huge buildings in the skybox with that option, you won’t have shadows in the map if they block the sun casting rays.

Ah, i went up and re-read the post, I misunderstood what he needed help with. I just noticed that shadow along the edge of the map.

Anyways, Do you have a .rad file that has those props included, if not you could try writing one and see if that resolves the problem. Other than that, I’m not sure.

i suggest shutting off everything but world brushes in your vis groups and cordon off the map piece by piece. start by compiling one half, then the other etc. it can help you hunt down the area where the degenerate faces are.

do you have anything in the map that you made and copy pasted a few times? or shift dragged?

its possible you made something originally with a degenerate face and copied it a few times. just a guess by the number of degenerate faces.

Hm. I did look around a little bit for the degenerate faces using cordons scanning in 256 segments along the y plane. I marked about 11 areas that have 1-3 degenerate faces in them. I’m going to try and narrow that down to 1 face per area, then do the same along the y plane. Wherever my markers cross, I’m going to look closely for these faces.

I forgot to mention I hit the indices limit on the t-junctions so I was compiling with -notjunc which I didn’t believe would cause these issues but it’s worth looking into. Currently I’m trying to cut down on my func_detail entities using displacements and func_brush entities so I can compile without that parameter. I’ve already used propper to make models of door frames and windows and parking blocks so that’s a bit of a last resort option as I’d be making a model for only one piece of the map.

No idea how but in my laziness, I wanted to change the lighting to HDR like my Ineu Valley 2 map so I just copied the sun from there. Fixed this problem.

Wtf source engine… wtf… Thanks for the support guys anyway.

Ok just for the record, in case anyone gets this error again, here’s what was causing it because I just caused it again. If you add the keyvalue ‘targetname’ to your light_environment entity for daynight cycle use, it can cause this.