Open EatThePath opened 3 years ago
an update to this: Attaching the cone light directly to the player ship does not reproduce the flickering, so that flickering has to be somehow related to the way the camera light is being positioned relative to the player via sexp, or maybe something about it being culled sometimes? Not in the glowpoint or light code, in any case.
The light splinters still do arise in that case, though.
An issue @MjnMixael brought to light, cone lights as glowpoint overrides have two issues. I dug into them, and offer my findings for future headaches.
MJN provided a text mission and some demo video: https://www.youtube.com/watch?v=fkwqu2cUTFc flashlight.zip
Due to limitations surrounding lightcasting from player ship glowpoints, the light is cast by a sexp-positioned invisible ship,which causes it's bumpy movement.
I rooted around in debug and renderdoc and found the following things: The light splinters are drawn on as part of the directional light pass, I believe I've gotten them to appear without having the flashlight and they don't appear if shadows are off or there is no sun. I'd have made this a separate issue as a consequence but, as @qazwsxal pointed out to me, they do seem affected by the flashlight's position, since in the video you can see splinters move when the light does. Maybe the light's volume isn't being properly ignored by shadow rendering? But the splinters show up on surfaces that shouldn't be sunlit anyway, so, hard to say.
Now the flickering, it's very strange. The frames where it's dark just straight up don't get the light added to them. I traced cone light adding down to
model_render_glow_points
inmodelrender.cpp
. With the power of conditional breakpoints I found that the function is called on the frames that have no light, but it doesn't add the light. Why? Beats me. I examined the state and it looks like it should have flowed through properly to adding them. I crammed the loop full of breakpoints, conditional and otherwise, to try to catch it on the way out one of the early exits or about to skip the adding, and no dice. One thing I didn't do is step through the loop manually from start to finish on a bad frame.... because I have no idea tell it's a bad frame at that point and stepping through dozens of frames hoping I notice something was a step too far.Maybe I'll come back to this sometime else, but if anyone else wants to take a swing feel free.