Skip to content

Fix _LightInfos V7→V8 migration and add dumpLightmapInfo diagnostic command#763

Draft
Copilot wants to merge 4 commits intocore4from
copilot/fix-lightmap-sunlight-issue
Draft

Fix _LightInfos V7→V8 migration and add dumpLightmapInfo diagnostic command#763
Copilot wants to merge 4 commits intocore4from
copilot/fix-lightmap-sunlight-issue

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

  • Analyze lightmap pipeline code (calc_lm, lightmap_optimizer, instance_lighter, rendering)
  • Understand lightmap factor system (LightGroup, AnimatedLight, LMC colors)
  • Identify potential issues in lightmap data migration (version 7→8 _LightInfos)
  • Fix _LightInfos version 7→8 migration in mesh_base.cpp (data silently dropped)
  • Add dumpLightmapInfo diagnostic command to Ryzom client for debugging lightmap issues
  • Enhance diagnostic command with effective factor resolution, zero-factor warnings, and animated light index info
  • Test changes compile correctly (nel3d, ryzom_client, lightmap_optimizer all build)
  • Code review and address feedback
  • Security scan (no issues found)
Original prompt

This section details on the original issue you should resolve

<issue_title>Sunlight missing from stage lightmap in Zora</issue_title>
<issue_description>image
image
</issue_description>

<agent_instructions>These assets are exported through the 3ds Max build process, and processed through the whole pipeline, which includes lightmap processing and such, there are steps which combine lightmaps and adjust the shapes and so on. I'm not sure if this is a gamedata build issue or an issue in rendering, although with the original data the issue does not occur, so I'm more inclined to assume either something is wrong in the gamedata export build or some asset property being misconfigured. If no solution can be found, then an asset diagnostic (debugging tool or command or other that may reveal more information) would be appreciated. The issue recurs on these same assets on every build</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@kaetemi ![image](https://user-images.githubusercontent.com/1581053/133887577-01b50f93-8a66-46cb-987a-a24788675622.png)

Similar sunlight issue in a section in the back of Pyr, but behaves differently on player light.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…command

Fix silent data loss in CMeshBase::serialMeshBase when reading shapes
saved with version < 8 format: the old TLightInfoMapV7 data was read
into a temp variable but never converted to the new TLightMapInfo
format, causing _LightInfos to remain empty. This could cause lightmap
factor animation to not work for meshes in the old format.

Add dumpLightmapInfo client command to dump detailed lightmap
information for diagnosing lightmap rendering issues such as missing
sunlight. The command outputs scene light group colors, shape light
info (animated light names, light groups), and per-material lightmap
properties (texture names, formats, factors, LMC ambient/diffuse).

Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix sunlight missing from stage lightmap in Zora Fix _LightInfos V7→V8 migration and add dumpLightmapInfo diagnostic command Feb 13, 2026
Copilot AI requested a review from kaetemi February 13, 2026 19:33
@ulukyn ulukyn force-pushed the copilot/fix-lightmap-sunlight-issue branch from 1a2b76a to b671d67 Compare February 13, 2026 19:35
@kaetemi
Copy link
Member

kaetemi commented Feb 13, 2026

@copilot Interesting find, although the assets I'm using should have the latest format, since they're freshly rebuilt, no? Feel free to look around more. I will test the command in a bit

…s, resolved anim indices

The diagnostic command now shows:
- All light groups up to index 6 (showing which are default vs explicitly set)
- Resolved animated lightmap index for each LightInfo entry
- Current effective factor from the scene's animated light system
- Explicit warnings when factors are ZERO (layer invisible/skipped by renderer)
- Count of active vs total lightmap layers per material

Co-authored-by: kaetemi <1581053+kaetemi@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 13, 2026

@copilot Interesting find, although the assets I'm using should have the latest format, since they're freshly rebuilt, no? Feel free to look around more. I will test the command in a bit

You're right — freshly rebuilt assets would already be in the latest format, so the V7→V8 migration fix wouldn't apply to your case. That fix is only relevant for legacy shapes still in the old format.

I did a deep dive through the pipeline (calc_lm export, lightmap_optimizer, runtime rendering). The most likely runtime cause I found: in CDriverGL::computeLightMapInfos, any lightmap layer whose Factor RGB is zero gets completely skipped from rendering (mat._LightMaps[i].Factor.getPacked() & RGBMaskPacked). The factor is set per-frame in CMeshBaseInstance::traverseAnimDetail() from the scene's animated light system based on the _LightInfos entries' AnimatedLight name and LightGroup value.

So if the AnimatedLight name doesn't match the scene's animation set, or if the LightGroup maps to a color that's currently black (e.g. night cycle during night), that layer becomes invisible.

I enhanced the diagnostic command in b9dcf1c to help pinpoint this. It now shows:

  • The resolved animated lightmap index (or -1 if unresolved) for each LightInfo entry
  • The current effective factor for each entry (what the renderer actually uses)
  • Explicit *** ZERO - layer will be invisible! *** warnings when a factor is black
  • Count of active vs total layers per material
  • All light groups up to 6 (showing default vs explicitly set)

Run dumpLightmapInfo <shape.shape> on an affected asset to see if any sun layer shows a zero factor or missing animation binding.

@kaetemi
Copy link
Member

kaetemi commented Feb 13, 2026

@copilot Please merge in the latest changes from the core4 branch (normal merge) and resolve any merge conflicts

Copy link
Contributor Author

Copilot AI commented Feb 13, 2026

@copilot Please merge in the latest changes from the core4 branch (normal merge) and resolve any merge conflicts

I'm unable to perform git merge operations or pull branches from GitHub in my sandboxed environment. Could you merge the core4 branch into this PR branch locally or via the GitHub UI? If there are merge conflicts afterward, I can help resolve them once the merge is done and the conflicts are visible in the files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Sunlight missing from stage lightmap in Zora

2 participants