Skip to content

Color correction exclusion mask + top vignette in postprocess_controller#494

Open
Blixibon wants to merge 3 commits intomapbase-source:developfrom
Blixibon:mapbase/feature/cc-exclusion-mask-and-vignette
Open

Color correction exclusion mask + top vignette in postprocess_controller#494
Blixibon wants to merge 3 commits intomapbase-source:developfrom
Blixibon:mapbase/feature/cc-exclusion-mask-and-vignette

Conversation

@Blixibon
Copy link
Member

This PR adds the ability to selectively exclude certain entities from color correction (or make them exclusively affected by color correction) through a new entity called color_correction_exclude. This is done by writing those entities to the stencil buffer (similar to glow outlines), pushing that to a new RT texture called _rt_ColCorrectMask, and then sending the parameters + RT texture to new code in the SDK_Engine_Post shader.

Additionally, the ability to enable the top vignette texture (which was previously unused and had to be enabled by editing the engine_post VMT) has been added to postprocess_controller, using a keyvalue inspired by L4D2 (or at least as it was presented on the VDC). This means mappers can enable a mostly seamless vignette with a strength from 0-1. This feature is part of this branch because it involves changes to the SDK_Engine_Post shader as well.


Two notably general changes were needed to make this work:

  1. A new capability for certain entities to transmit EF_NODRAW to the client, which isn't normally possible because EF_NODRAW prevents entities from being transmitted. This was needed because, bizarrely enough, it is otherwise impossible for beams on the client to know that they are off. Since turning off beams adds EF_NODRAW, turning off a beam simply cuts off transmission to the client. I wasn't able to figure out how beams know to not appear in standard rendering, but due to the way color correction exclusion works, excluding a beam will cause it to always draw even if it is supposed to be turned off. I eventually decided to compromise by adding a custom user message that directly assigns an entity's clientside counterpart with EF_NODRAW even if the entity itself isn't transmitting. I generalized this as something that can be implemented on other entities in code in case it's useful for other applications, although if a better way to determine whether a beam is disabled on the client emerges before this PR is merged, then I would probably remove this. It is disrespectful and evil.
  2. New hl2_rendertargets.cpp/.h files containing a new CHL2RenderTargets class are included in this PR, and Mapbase's custom RT camera textures were moved to it. Previously, Mapbase's custom RT textures were done through the Mapbase game system in mapbase_shared.cpp, which were originally created as a workaround for baseclientrendertargets.cpp not defining its RT textures. The TF2 SDK has revealed that games need to individually override its interface in order to use it, and this PR adds a basic, extensible stub class. This is sort of a prerequisite change that's being clumped in due to this feature's requirement of a new render target.

PR Checklist

  • My PR follows all guidelines in the CONTRIBUTING.md file
  • My PR targets a develop branch OR targets another branch with a specific goal in mind

Made to prevent the CC exclusion mask from drawing beams when disabled, but designed with general use in mind
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.

1 participant

Comments