PadWorld-Entertainment / worldofpadman

World of PADMAN game repository
https://worldofpadman.net
Other
37 stars 8 forks source link

RENDERERGL2: Strange shadows on skyboxes when looking through glass shaders #266

Open kai-li-wop opened 1 month ago

kai-li-wop commented 1 month ago

One very strange thing is that the skybox gets shadows, but only when looking through a glass shader. Since WoP works a lot with glass shaders, I think this affects the user experience a lot when using the OpenGL2 renderer. Screenshots are take from PadShip but it also occurs in many other maps like CybJourney. Maybe @zturtleman could have a look because this should also appear with ioquake3. See example shader how it is used in PadShip to create the glass effect.

textures/pad_pirate/pglass04
{
    qer_editorimage textures/pad_pirate/pglass04
    surfaceparm trans
    cull none
    surfaceparm nolightmap
    qer_trans   0.5

    {
        map textures/pad_pirate/pglass04
        blendFunc GL_ONE GL_ONE
        rgbGen identity
    }
    {
        map $lightmap
        rgbGen identity
        blendFunc filter
    }
}

grafik

grafik

zturtleman commented 1 week ago

I looked into this a month ago and I don't know what's going on with the shadows. Rotating the player left/right rotates the shadows in front of you like a clock. Wrong shadow projection/axis maybe? I don't really know how the shadow mapping works.

However it seems like all the glass shaders have a lightmap stage and surfaceParm nolightmaps. I think nolightmaps forces lightmapIndex to LIGHTMAP_BY_VERTEX which uses white image for lightmap? The opengl2 renderer could probably disable sun shadows on shaders with surfaceParm nolightmaps (or possibly negative lightmapIndex) to fix the issue. I haven't got round to specifically testing and committing a solution to ioquake3 though.