jdolan / quetoo-data

Quetoo ("Q2") game data. Creative Commons Attribution license.
http://quetoo.org
Creative Commons Attribution Share Alike 4.0 International
14 stars 3 forks source link

Lightmaps wrong on mingw32 #103

Closed Paril closed 7 years ago

Paril commented 7 years ago

https://gm1.ggpht.com/NsFLUjMST8DmwVMe4BcUCnmD30lkKSUZFHQ9Q3s6-484zoyPNV3QdYRvcEJYxkSsSUEwi0Nil0ICOk5aXUS-LLzGT2wpBcfbvv8jz2F865pYvnA5izNJE9HmuwTmzoNuF5F2XMPUDEyJcYfuG3-FG186Mvu62XEPe1f9ncsSdihVaKWia29Rb003cojR7UBix17SNMde7U3155ph7a-EXb_fm81Ivn0k8vfv44sJaMZRuGC52cmlc5OZ1NH1sD9lZDdvkQoR2f_fQyc1wHFqQX1A3E-_sCMZZjubHKVlZgpIpleuqecIaGgBUp724qFQMa8ooU7eqgYcziSAUsv7WZsKMis0G4V_EGT3SnUZm_Ki9jE1UdEDnS3YiJ1w0PBlVzagy1ZbsyYDeYTYQXaWCnRhggq7tPOnTApfQVrE0Jk2HGOQ0M0pjcaxQDZ3PYwRp_yJ5ZJyOF-WdaMCD-hYWuFNRaHxQC0qT5Vef3i_v5FJ3AzKiaKIKQnD-cORWahl8FodLukPUL5KSBEwoXK4xcULXDrwVHOfGjPzmchHqoT1IcXHALBA0UQ4YN6JVa-4XkIy4A5nnnC1-Yt1ve39ndP4saJf_q-5MoYzPOiPCixcyObpd6A7eEvgopHjuBg22OVL7ML0SHZMajz8ni7jEP3oGXogADBTNFLKtN0B9pTwWPzRRxU=w2048-h1152-l75-ft

This was reported by @Panjoo. Pan, can you try running r_draw_bsp_lightmaps 1 and see if the lighting errors show up there? If not, it's likely related to diffuse lighting shader and not lightmaps.

Panjoo commented 7 years ago

Okay, this is with r_draw_bsp_lights 1 and the errors show up there as you can see;

quetoo067

It's nothing I haven't seen before when it comes to lighting bugs, but it's strange that this wasn't there and suddenly pops up. I already tried some things like making new lights and moving them around but that doesn't fix it. Doublechecked the light properties and compared them with lights that don't have this problem but I can't find anything. There are some more things I could try like moving the entire map to another location on the worldgrid but that could sometimes cause other oddities.

kaadmy commented 7 years ago

Is there a light inside geometry there?

Paril commented 7 years ago

Had you updated your grunt.bsp at all or is it the same one in master? I can't reproduce these issues there. It looks more like it's using the wrong piece of the lightmap for that surface rather than the lightmap itself being corrupt. Are you loading any other maps before this one?

Can you load into map grunt immediately after launching, do r_dump_images, then attach the lightmap files that are generated inside My Games\Quetoo\default\imgdump\ ? That'll help us rule out whether it's the actual lightmap or the geometry using the wrong one.

lightmap 0

This is the lightmap that it should be generating, for comparison.

EDIT: it just hit me that it might be a mingw-related problem. I'll try grunt in mingw and see if it's any different.

Paril commented 7 years ago

This is related to mingw build. :(

Paril commented 7 years ago

lightmap 0

Panjoo commented 7 years ago

@Paril, ^Yep, the generated lightmap 0.png looks the same as the one above, with the larger black area. Lol, I never knew a lightmap looked like this, kinda cool actually. I did check out some other maps and Grunt seems the only one that shows this problem.

@Kaadmy, nope there are no lights inside geometry, it was all fine before. To see if it was maybe a map error I did some tests (locally), put new lights in and even tried rebuilding the geometry there but that didn't help. Only if I took out those particular lights the floor looked normal, that is with just the ambient light.

Paril commented 7 years ago

@panjoo the issue is limited to the mingw build, which is why we never noticed it. It may be a regression from jdolan updating the build tools. I'll figure this one out today. Also: that's just how Quetoo turns the light map into a texture, the light map is actually entirely 1 dimensional in the BSP, which is even cooler (its a long string of data rather than a rectangle like ours).

kaadmy commented 7 years ago

@Paril well technically all images (PNG, TGA, etc) are all 1d ;)

Paril commented 7 years ago

Fixed in latest commit.

jdolan commented 7 years ago

Crazy.

So what happened here, @Panjoo, is that before @Paril merged his OpenAL changes into master, I did some routine maintenance on the build machine, to ensure that it had the OpenAL and libVorbis libraries installed etc -- so that the build would succeed.

Part of that routine maintenance was updating the tool chain (the C compiler and other standard things). For whatever reason, the new version of the compiler that was installed through the system update utility changed how floating point variables were handled. @Paril narrowed in on this after hours of debugging.

The fix was to add some compiler flags for floating point precision to just the MinGW build -- it's the only build that was affected.

Crazy. But anyway, I guess it's fixed!

Panjoo commented 7 years ago

Wow dudes, good work finding the problem. Why does everything has to be so complicated, ugh!

I found it was also screwing with Warehouse's lightmap. The bastard! badlightmap