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

Feature Request: Reflections (Save Crystals and Midas Gold Lara) #154

Closed
annlyt opened this issue Oct 30, 2021 · 7 comments · Fixed by #1501
Closed

Feature Request: Reflections (Save Crystals and Midas Gold Lara) #154

annlyt opened this issue Oct 30, 2021 · 7 comments · Fixed by #1501
Labels
Feature New functionality TR1

Comments

@annlyt
Copy link

annlyt commented Oct 30, 2021

Now the majority of the game has been decompiled, I think it would be a good idea to port the reflection feature from TR2Main over if possible.

Specifically for the Save Crystals and Midas Gold Lara, that will make them a million times better.

@annlyt annlyt changed the title Feature Request: Reflections Feature Request: Reflections (Save Crystals and Midas Gold Lara) Oct 30, 2021
@rr- rr- added the Feature New functionality label Oct 30, 2021
@rr-
Copy link
Collaborator

rr- commented Jan 13, 2022

I believe this can be done with shaders, specifically with a technique called screen space reflections.

@ANoDE85
Copy link

ANoDE85 commented Oct 1, 2022

In case you didn't know, CroftEngine has added support for reflections a few months back. I have no clue about graphics programming, so I don't understand what exactly was done, but it looks like it's using a (relatively simple) shader and a new reflective mesh attribute.

It looks really phenomenal, so I'd love to see something similar come to Tomb1Main.

@Richard-L
Copy link
Collaborator

Croftengine is a totally different engine though.

TR1M (at least so far) has been about mimicking vanilla behaviour, or making it accessible on modern hardware.

I think Arsunt has pretty good knowledge about how the "fake" reflections were done for TR1 and 2.

@ANoDE85
Copy link

ANoDE85 commented Oct 2, 2022

Fair enough.
Adding reflections exactly like the PS version did surely sounds like a sensible goal for a project trying to stay true to the original.

I'm not sure if most people actually care about how exact the effect is replicated, though.
It stands to consider, that the reflection effect in TR1 was done in a way so the PS1 could handle it easily. These days, even not-so-modern hardware should be able to do a similar effect right out of the box.

Given that the original effect actually reflects everything on screen (including the reflective object itself), I don't think anyone would really complain if the effect wouldn't be 100% accurate - as long as it's there, and as long as it's optional.

@Richard-L
Copy link
Collaborator

Some PS1 reference clips because why not.

Crystal

crystal1.mp4
crystal2.mp4
crystal3.mp4

Midas

midas-hands.mp4

Arsunt's explanation of TR UV reflection mapping:

Preparing the article about all of it. Here is a "teaser" for you. It's about how TR reflection UV mapping works. The square central area of the last rendered frame is taken as texture. Only the centred incircle area is used for reflection, everything beyond is never reflected. Let's suppose for now that radius of the circle is 1 and coordinates of its center is (0; 0).

For each vertex of the mesh, a view rotated normal vector is taken (vertex itself coordinate does not matter). Normal vector coordinates in the XY plane will indicate the desired point of the texture. Since the length of the normal vector is always equal to 1, and the Z coordinate is discarded, it is guaranteed to stay inside the circle.

So now the XY coordinates inside this "circle area" are in range -1..1, but for UV we want 0..1. This part is fairly simple:

U = (X+1)/2;
V = (Y+1)/2;

Source: https://discord.com/channels/218414493355606016/394838132643725314/704968088042340384

@MarkPremier
Copy link

Any update with this feature. I would love to see this implemented for parity with the PS1 version.

@Richard-L
Copy link
Collaborator

I just found Arsunt had posted about the effect in great detail here: https://www.tombraiderforums.com/showthread.php?t=226585

rr- added a commit that referenced this issue Sep 11, 2024
rr- added a commit that referenced this issue Sep 11, 2024
@rr- rr- mentioned this issue Sep 11, 2024
2 tasks
rr- added a commit that referenced this issue Sep 12, 2024
rr- added a commit that referenced this issue Sep 12, 2024
@rr- rr- closed this as completed in 1cb8ae9 Sep 12, 2024
@rr- rr- added the TR1 label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New functionality TR1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants