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

Viewport fixes #283

Closed
wants to merge 3 commits into from
Closed

Viewport fixes #283

wants to merge 3 commits into from

Conversation

zear
Copy link
Collaborator

@zear zear commented Jan 21, 2023

This is a collection of fixes for #282.

zear added 3 commits January 21, 2023 22:27
When the `gRender_screen` is scaled such that it doesn't match
dimensions of `gBack_screen`, the depth buffer's position and size
differs from the color buffer, causing visible artifacts on the screen.

Update the depth buffer along the color buffer, so that they always
match, preventing any misalignment.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
The viewport height passed to the shader should be the one of the
renderer, not the color buffer. Otherwise, geometry behind transparent
materials is sampled at the wrong y offset.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
When map mode is enabled, the scene is rendered thrice to a single
frame. This breaks blending in GL renderer, which depends on a clear
depth buffer.

Don't wait for game loop to swap the frame buffers and manually clear
the depth buffer as soon as the scene is done rendering.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
@dethrace-labs
Copy link
Owner

#279 resolves 1 and 2 of the linked issues - different implementation for 1 but same for 2!

@@ -389,6 +389,10 @@ void GLRenderer_EndScene() {

generated_current_framebuffer_for_this_frame = 0;
CHECK_GL_ERROR("GLRenderer_EndScene");

/* Fixes blending in map mode, which renders the scene thrice per frame. */
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer_id);
Copy link
Owner

Choose a reason for hiding this comment

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

this has the effect of breaking shadow rendering. Instead, I'm happy to wrap the for loop in RenderAFrame in a #if DETHRACE_FIX_BUGS, which should also resolve the issue?

I've looked and looked and can't see any reason for it. My guess is it was some leftover from a debugging session that made it into the retail build as an oversight

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, the issue is gone if we only loop once. I also spent some time trying to understand the logic behind the loop and got nothing. So I'm fine with the workaround you're proposing.
Have we tried to hack CARMA95.EXE, so it only loops once, to see if anything breaks there?

Copy link
Owner

@dethrace-labs dethrace-labs Feb 13, 2023

Choose a reason for hiding this comment

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

We have an existing issue here #143 for it

Copy link
Owner

Choose a reason for hiding this comment

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

yes, I was curious again so just tried it (I updated the linked issue #143). Couldn't see anything broken :/

@dethrace-labs
Copy link
Owner

Closing this as we've resolved 2/3 issues as part of other earlier fixes, and the map rendering issue is resolved by #317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants