Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output: handle common lighting in TRX #2358

Merged
merged 9 commits into from
Jan 23, 2025

Conversation

lahm86
Copy link
Collaborator

@lahm86 lahm86 commented Jan 22, 2025

Checklist

  • I have read the coding conventions
  • I have added a changelog entry about what my pull request accomplishes, or it is an internal change
  • I have added a readme entry about my new feature or OG bug fix, or it is a different change

Description

This shifts (most) lighting output handling to TRX. Dynamic lighting is technically now supported in TR1, but we don't call it anywhere yet: I thought it would be best to check over this change first. Dynamic lights are handled in three slightly different ways, hence the move now to standardize the shared logic.

There are a couple of temporary public functions while the modules remain split - fog calculation and accessing the TR2 shade tables. Otherwise, I've standardized most struct properties, such as shades, vertex info etc to make things easier to manage. TR1 will default where applicable.

I carried out some logging of generated output values while a demo runs between develop and this branch, and values are identical. For testing, room lighting, game object lighting (Lara, enemies, pickups, doors etc) and static mesh lighting should be as it currently is in both games.

@lahm86 lahm86 added Internal The invisible stuff TR2 TR1 labels Jan 22, 2025
@lahm86 lahm86 self-assigned this Jan 22, 2025
@lahm86 lahm86 requested review from a team as code owners January 22, 2025 20:16
@lahm86 lahm86 requested review from rr-, walkawayy and aredfan and removed request for a team January 22, 2025 20:16
Copy link

github-actions bot commented Jan 22, 2025

@lahm86
Copy link
Collaborator Author

lahm86 commented Jan 22, 2025

^ Fixed a stale include

@aredfan
Copy link
Collaborator

aredfan commented Jan 22, 2025

I found an issue - I think Lara's lighting in one of the dark rooms in TRUB looks incorrect:

PR build:
20250122_204105_Temple_of_the_Cat

Recent dev snapshot:
20250122_204118_Temple_of_the_Cat

@lahm86
Copy link
Collaborator Author

lahm86 commented Jan 22, 2025

Thank you @aredfan. I'm hoping that should be fixed now. I'll do some further extensive tests myself as well, but pushed the build for you to check.

@Richard-L
Copy link
Collaborator

She looks almost better in the second screen to me?

Copy link
Collaborator

@aredfan aredfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @aredfan. I'm hoping that should be fixed now. I'll do some further extensive tests myself as well, but pushed the build for you to check.

Anytime, and thank you for pushing a new build. I can confirm the issue is fixed. 👍

The flat lighting on Lara can also happen in certain rooms in OG - namely rooms 21/42. It seems your fix also fixed those rooms as well.

Copy link
Collaborator

@rr- rr- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually a request from me to keep the OG behavior.

OG:

2025-01-23_00-01-05.mp4

PR:

2025-01-22_23-59-49.mp4

This changes the signature for adding dynamic light to accept XYZ_32
rather than separator coordinates.
This removes the global dynamic light count and moves it to output
module scope, introducing a function instead to reset it as needed.
This changes the signature for calculating light to accept XYZ_32
rather than separator coordinates.
This changes the signatures for calculating light to accept XYZ_32
rather than separator coordinates.
This names the various room light modes that exist in TR2.
This removes the unused second ambient on TR2 rooms, renames the first
ambient to match TR1, and adds the light mode property to TR1,
defaulting to normal.
This introduces a SHADE struct for items and static meshes, and a
FALLOF struct for lights to allow easier handling in common logic
between TR1 and TR2.
This makes TR1 room vertices more in line with TR2.
This moves common lighting functions to TRX. This temporarily
introduces some helper functions to access TR2 specifics, like shade
tables, while the module remains split. These can later be eliminated.
@lahm86
Copy link
Collaborator Author

lahm86 commented Jan 23, 2025

This should be resolved now. I've split some of the logic out into their own functions to make reading Output_CalculateLight a little easier. The difference here in Temple of the Cat is when a room has no lights and Lara then steps into one that has. TR2 treats this scenario differently, and I'd read it all differently during the initial merger.

@aredfan Sorry to be a pain, but would you mind checking TR1 and TR2 again?

@lahm86 lahm86 requested review from aredfan and rr- January 23, 2025 11:46
Copy link
Collaborator

@aredfan aredfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aredfan Sorry to be a pain, but would you mind checking TR1 and TR2 again?

No worries. 👍

The dark rooms in Temple of the Cat now matches OG behaviour. The lightings in TR1X and TR2X both LGTM.

Copy link
Collaborator

@rr- rr- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 😌

@lahm86 lahm86 merged commit e9a4a37 into LostArtefacts:develop Jan 23, 2025
7 checks passed
@lahm86 lahm86 deleted the refactor-lights branch January 23, 2025 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internal The invisible stuff TR1 TR2
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants