etfdevs / ETe

Improved Wolfenstein: Enemy Territory Engine
GNU General Public License v3.0
56 stars 17 forks source link

r_vbo breaks lightmap drawing with r_lightmap #79

Open Aciz opened 1 year ago

Aciz commented 1 year ago

r_vbo 0; r_lightmap 1 2022-09-26-183349-warbell

r_vbo 1; r_lightmap 1 2022-09-26-183403-warbell

r_vbo 0; r_lightmap 1 (Oasis is compiled with -approx so some surfaces are expected to not have lightmap) 2022-09-26-183422-oasis

r_vbo 1; r_lightmap 1 2022-09-26-183429-oasis

Looking closer at the surfaces with vbo + lightmap, there is some weirdness with blending going on 2022-09-26-183806-oasis

And as a bonus: r_detailtextures 0; r_vbo 1; r_lightmap 1 is completely borked, with only very few surfaces being lightmapped (the canopys in this scene) 2022-09-26-184033-oasis

Mateos81 commented 1 year ago

The "weirdness" seems to be the detail part of the shader

ensiform commented 1 year ago

At the moment I'm not sure if I've derped in the port or if this also affects Quake3e.

Aciz commented 1 year ago

Seems to work fine on q3e/oDFe, both OpenGL and Vulkan.

Aciz commented 1 year ago

Never mind, on another map I do have issues (dfwc2012-3), but this seems to be limited to OpenGL. I see 0 lightmapped surfaces with r_vbo 1.

shot-20220926-232632

shot-20220926-232637

ensiform commented 1 year ago

Maybe @ec- has some ideas where we can look.

As I said above, not sure if this is because of external lightmaps or something entirely different.

Aciz commented 1 year ago

I can test tomorrow in ET with a map I know for a fact that uses internal lightmaps. Did not check if dfwc2012-3 used internal or extlmhack

Aciz commented 1 year ago

Doesn't seem to be limited to external lightmaps, this map (Snatch 3) uses internal lightmaps. DFWC2012-3 is also using internals. 2022-09-27-084116-snatch3 2022-09-27-084125-snatch3

ensiform commented 1 year ago

Is that map also available in Q3 to check there

Aciz commented 1 year ago

Snatch 3? No, but the reason I brought that up is that it's one of the few ET maps that uses internal lightmaps, which is the standard for most (especially older) Q3 maps, which also have this problem, therefore I doubt it's got anything to do with internal/external lightmaps.

ec- commented 1 year ago

\r_lightmap is a debug feature which:

Personally I wouldn't bother making code more complex so just disable \r_vbo if you need \r_lightmap for some reason, for now

ensiform commented 1 year ago

I did find that this code block,

https://github.com/etfdevs/ETe/blob/master/src/renderer/tr_shade.c#L1237-L1245

Does not have VBO equivalent but I tried implementing as the following it and it made no visual difference.

if ( r_lightmap->integer && ( pStage->bundle[0].isLightmap || pStage->bundle[1].isLightmap ) ) {
            stateBits &= ~(GLS_SRCBLEND_BITS | GLS_DSTBLEND_BITS);
            stateBits |= (GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO);
        }

Another note, I guess I might want to check the fading code above the r_lightmap block too as I do not know if that is implemented either. :sweat_smile: But do not know what effects make use of it to verify broken-ness.