Lighting fix for Dr Caroll cutscene#665
Conversation
|
I resolved a merge conflict with other recent changes. Should be ready to merge again. |
|
Same problem as #667. Would be nice to find a solution that does not require hardcoding this for that specific room in that specific stage. I know the code is already full of that kind of crap, but it would be better to avoid adding more. |
|
This one might tough to avoid a hard coded fix, but I'll explore some options. The only thing that comes to mind is finding a way to modify the background geometry so that the right wall doesn't trigger the background hit test. Might be able to do it by assigning a special texturenum that we can skip within bgTestHitInVtx. |
|
I guess you could just check if the stage has been replaced. Though I'm struggling to remember what the best way to do that would be. |
|
I noticed bgTestHitInRoom returns hitthing, which has access to the texturenum. This means we could remove the hard coded room in favor of testing whether texturenum points to something like SURFACETYPE_NONE. Then all I'd have to do is mod the background geometry to point to SURFACETYPE_NONE for that wall. That seems more useful since it provides a way for other modders to handle similar camera angles. I'll take a look at putting together a mod for this level that handles the lights from #667 and the background geometry in this cutscene. My apologies for missing the mod documentation earlier. Nyxem64 helped point me in the right direction. |
|
Ok, I think I found a solution for this without resorting to a hard coded room number. I used the Setup Editor to switch the right wall in this room from the primary OPA render pass:
In favor of using the secondary XLU render pass with the texture transparency turned on:
These are the same settings used to render grates that have opaque and transparent portions with lights behind them, such as the elevator at the beginning of the Investigation level. This works as long as we don't care about correctly rendering bullet hits and there are no overlapping transparent objects (true here since neither are in the cutscene). Changing to the secondary render pass fixes the lighting behavior since we exclude the XLU pass from the line-of-sight test. That makes it so we no longer trigger a background hit. I included a .zip with the modified background geometry in #667 (comment) |



This PR addresses the missing background lights in the cutscene, shown below, where Dr Caroll first appears at the end of dataDyne research.
Root Cause
The missing lights seem to come from placing the camera just outside the level geometry when it cuts to the view with Dr Caroll rising up. This can be seen in the figure below, which plots the camera position (green) relative to the light locations (blue) on the back wall of the cutscene. The line-of-sight test for light visibility intersects background hit locations (orange) very close to the camera location. The camera is probably just outside of the right wall in the room that Joanna approaches to find Dr Caroll.
Solution
Given that the room (number 100 in stagenum 51) with these lights is only accessible via a cutscene, I added an exception for it within the line-of-sight test for light visibility. The exception ignores the background hit test for lights in this stagenum + room.
The image below shows that this change correctly renders these lights in this portion of the cutscene. The lights are correctly blocked by the prop geometry in the rest of the cutscene.