Skip to content

Conversation

@nooodles-ahh
Copy link

This PR primarily implements transparent viewmodels in the same vein as the mod found in TF2, originally described here.
To briefly explain the technical implementation; rather than changing the render amount, which causes you to see obscured model geometry and doesn't look very good, the viewmodel is rendered to a separate texture and drawn over the frame buffer. The texture is created by writing to the stencil buffer, then clearing the alpha channel of the texture according to that.
A gross part of the implementation is the repurposing of the STUDIO_DRAWTRANSLUCENTSUBMODELS flag to control the model draw and drawn functions. This was done so I can stencil out sprites drawn with the viewmodel as it looks a lot nicer than the sprite just showing through and stenciling doesn't really deal with transparency. The naming kind makes sense but I'm happy to redefine the flag with a different name or alter the implementation a bit.
This also implements IClientRenderTargets for HL2 derivative mods so I also added hl2_water_resolution and hl2_monitor_resolution convars copied over from TF2's implementation.

Screenshots

image1
Occlusion enabled
image3
Occlusion disabled
image2
Occlusion enabled
image4
Occlusion disabled
image5
0% opacity
image6


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

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