DaemonEngine / Daemon

The Dæmon game engine. With some bits of ioq3 and XreaL.
https://unvanquished.net
BSD 3-Clause "New" or "Revised" License
304 stars 60 forks source link

Bad translucent texture in procyon #1405

Open illwieckz opened 2 hours ago

illwieckz commented 2 hours ago

The central hologram should not look like that:

unvanquished_2024-10-30_072954_000

But like this:

unvanquished_2024-10-30_074144_000

illwieckz commented 2 hours ago

Here is the shader:

textures/procyon/starchart512
{
        qer_editorimage textures/procyon/starchart512.tga
    qer_trans .5
        surfaceparm trans
        surfaceparm nomarks
    surfaceparm nolightmap
    surfaceparm nonsolid
    cull none
    {
                map $lightmap
                rgbgen identity
        blendfunc gl_dst_color gl_zero
        }
    {
        map textures/procyon/holocloud.tga
        blendfunc gl_dst_color gl_src_alpha
        //blendfunc filter
        tcmod scroll .00 .1
    }
    {
        map textures/procyon/starchart512.tga
        alphafunc GE128
        depthwrite
        tcmod scroll .01 .00
    }
}

The problems is likely because there is an actual lightmap stage while the shader uses nolightmap, so the lightmap stage is rendered as fullbright with a full black texture, but fullbright surfaces use overbright cancelling, so that's not white (1) that is multiplied with what's behind, but 1/obb, darkening what's behind.

illwieckz commented 2 hours ago

In the future, we may add some code that simply removes useless fullbright lightmap stage on nolightmap shaders before rendering, but we better make sure the engine handles all the cases properly anyway.