Lighting issues on a single 'room' prop

So I’ve been working with a friend to create and get this model into GMod for my TARDIS addon.

However, we’ve come across a strange issue. The lighting on the model constantly glitches out depending on where i’m looking, if there’s another entity in the players FOV etc. This video should explain it best.

Has anyone come across similar issues before, and more importantly does anyone know a fix?

Can you send over the prop and maybe the other required stuff, just having that video doesn’t help me a lot, also, which map you use, etc. Does it happen on every map or just this one? Are you sure you haven’t spawned the prop 2 times?(dumb question but might be the reason) Does it use a special material? What is the polygon count?

The more you test, the more results you will get and it will be easier to fix. I remember I had a similar issue, but it was caused because the entity gets spawned twice, one shadowing the another and because they are at the same place, doing light glitches. For mappers, you know what I mean by putting a small bit of a brush into another with the same material and see the effect.

Ehhhhhh, g’d ol’ TARDIS, so much memories out of it.

It’s possible that the model is just too big and it’s grabbing light information from places you wouldn’t expect.

Try seperating it into multiple props and putting them together in game.

More information:

  • It happens on every map I’ve tried it on (inc. both skypaint/not skypaint maps)
  • Poly count is 138,052
  • 3DS Max used for export to SMD
  • SFM compiler used (SteamApps\common\SourceFilmmaker\game\bin)
  • Compile log
  • One dynamic light and standard map lighting
  • Actual model/addon
  • Model works fine in SFM itself as far as I can see
  • Cutting the model up doesn’t work
  • Using the orangebox compiler doesn’t work
  • QC
  • Putting an entity into the players view temporarily fixes the issue (this one is very interesting)
  • Turning off smoothing doesn’t work
  • Turning off $scale doesn’t work
  • There are no materials on the model, random ones are used however interestingly translucent materials seem to work fine
  • Changing $illumposition doesn’t seem to work

how many lights do you have in the scene?

One dynamic light at the center of the model (code) and just standard map lighting I guess. The actual model and early addon can be found here if you want to test it for yourself.

I’m not sure how SFM handles lighting but Source generally uses $illumposition. The entire model is lit based on the lighting hitting the illumposition. If you leave a model half in a shadow and half in a light, the model won’t have half a shadow, it’ll simply depend on which level of lighting the illumposition is hitting. Try splitting the model like wraithcat said.

Okay I’ll try splitting it. I’ll get back to you with results after I’ve done it.

[editline]5th June 2014[/editline]

Even with half the model basically ripped off it’s still doing it as seen above. (Eye angles are very slightly different in the two shots)

[editline]5th June 2014[/editline]

I did notice this error in console though: ‘MDLCache: drmatt ardis
ewinterior.mdl needs to be recompiled’. I asked a modelling friend when I first saw it but he just said it’s because of the SFM compiler and it’s nothing to worry about.

I shoved the full model in SFM itself and it seemed fine.

I also just stripped it down to this (which is below the general poly limit of ~40k) and tried it with the usual orangebox and SFM compiler. Exactly the same results apart from no ‘model needs to be recompiled’ msg in console with the orangebox compiler.

I’m officially stuck.

Edit: whoops sorry about that double post, auto-merge not working

The reason it might be okay in SFM is because SFM has a vastly improved lightning system and might actually ignore illumpositions to an extent.

Do try to to see where exactly your illumposition actually is, it might help.

EDIT

  1. Do you have a normal map?
  2. Try compiling a version with no smoothing groups at all.

According to the valve wiki, the $illumposition is in the center of the geometry by default.

If it’s any help here’s my QC.

Try removing the scale command for and manually move the illumposition around to see if you can change how the model acts.
Ideally put it above the model. (there’s a chance the illumposition is actually below the ground)

I haven’t started working on the materials yet, so I just apply random ones to it such as ‘models/combine_advisor/mask’ or ‘models/debug/debugwhite’. Interestingly enough the issue isn’t there with transparent materials such as ‘models/shadertest/shader3’ and also not with fullbright materials like the default pink ‘missing texture’ one.

No change.

No change.

I used ‘$illumposition 0.000 0.000 500.000’ and there was still no change.

[editline]5th June 2014[/editline]

I think I’ve fixed it! Based on my finds with it working with transparent materials, I simply made a simple vmt containing this:



"VertexLitGeneric"
{
	"$basetexture" "models/combine_advisor/mask"
	"$translucent" 1
}


And then I set the model to that texture. As far as I can tell it’s working great. I appreciate your help wraithcat, CaptainBigButt, Johnny Guitar and icis4.