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

Handle partial transparency #4440

Open
L-P opened this issue Jan 16, 2024 · 1 comment
Open

Handle partial transparency #4440

L-P opened this issue Jan 16, 2024 · 1 comment
Labels
Prio:3 Low priority: Minor problems and nice to have features Type:Enhancement New features

Comments

@L-P
Copy link
Contributor

L-P commented Jan 16, 2024

System Information

TrenchBroom 2023.1 Build v2023.1-472-g94049d6d2 Debug Linux-

Expected Behavior

Sprites and entity icons should be rendered using the full range of their alpha channel.
This would allow for nicer icons and proper preview of GoldSrc sprites.

Steps to Reproduce

Display an image with 8-bit transparency using model(). Unzip valve_addon.zip in your Half-Life folder for a quick repro.

Here's the original image for the repro above, its alpha channel is a linear vertical gradient from white to black:
debug_gradient

Here's how it looks in TrenchBroom:
render

It's cut below alpha .5. I suspect this bit from the fragment shader to be the culprit:

    // Assume alpha masked or opaque.
    // TODO: Make this optional if we gain support for translucent textures
    if (EnableMasked && gl_FragColor.a < 0.5) {
        discard;
    }

This also affects GoldSrc Additive and IndexAlpha sprites.

@kduske kduske added Type:Enhancement New features Prio:3 Low priority: Minor problems and nice to have features labels Jan 16, 2024
@SirYodaJedi
Copy link
Contributor

SirYodaJedi commented Jan 16, 2024

This also affects GoldSrc Additive and IndexAlpha sprites.

The additive rendermode in the SPR isn't actually used by the engine (both opaque and additive act the same); instead any SPR or MDL can be made additive (via KV) regardless of what mode is set. GoldSrc's additive translucency for SPRs is better handled with a new alphamode parameter in model({}) (after OP's issue is resolved).

In fact, it seems SpriteMaker makes sprites as additive by default, since they're basically the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Prio:3 Low priority: Minor problems and nice to have features Type:Enhancement New features
Projects
None yet
Development

No branches or pull requests

3 participants