-
Notifications
You must be signed in to change notification settings - Fork 60
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
Fix portal blending with portal surfaces #1019
Conversation
Enables writing to color buffer when rendering the portal surface in FinalisePortalCommand::ExecuteSelf(). Changes glStencilOp to avoid depth test failing and clears stencil buffer in case there were multiple portals on the screen. Fixes DaemonEngine#1011.
Awesome ! 😲️ |
Apparently that is the light stage. If the output from it is incorrect, then that issue is likely with lighting. It could also be that tremulous was rendering it wrong. |
On second thought, that might be for recursive portals. This pr might break them, but we don't seem to have any maps with those, so I'd need a test case map for that. |
spacetracks map, viewpos |
They don't seem to be in view of each other though? I've just got a test map from @cu-kai and it looks like recursive portals don't even work in 0.54.1. |
It probably works, but not entirely. The fact we can see the two mirrors of spacetracks at the same time in 0.54.1 is only possible because I enabled portal recursion some time ago. If we disable recursion, only one portal is displayed at a time and a warning is printed. I also made a test map and recursion seems to only be half working. |
Interesting, I think it might be linked to one of the issues described in #1005 (comment), since it looks like things that should be drawn through a recursive portal aren't added correctly. |
For now ignore any lightmap issue, there is an ongoing PR to fix many lightmap issues and trying to fix lightmap issues before merging that other PR is likely to introduce more bugs and create strong merge conflicts: That PR does much more than what the title says. Also I have some ideas about why there may be lightmap issues with portals, but I will not investigate those ideas before that lightmap PR is merged. So any lightmap issue remaining when rendering portals should not block the merge of that PR. |
Ah, that's good to hear. |
Closing this in favour of #1031, which fixes this issue among some other things without breaking recursive portals. |
Enables writing to color buffer when rendering the portal surface in FinalisePortalCommand::ExecuteSelf(). Changes glStencilOp to avoid stencil test failing in light pass, and clears stencil buffer in case there were multiple portals on the screen. Fixes #1011.
glStencilOp( GL_KEEP, GL_KEEP, GL_DECR )
was likely intended to prevent incorrect rendering with multiple portals on the screen, but it was preventing the portal surface from rendering.Here's some screenshots:
The colour is slightly off because for some reason the portal surfaces are rendered twice, so they blend with themselves.The colour is off due to light pass, which may or may not be a bug with the lighting system. Using Nsight confirms that the first draw produces the expected result (this is not the final colour that will be in the frame, but it illustrates the issue):