Skip to content

Time Of Day Colors for GLBs - #4111

Open
Jakjm wants to merge 22 commits into
open-goal:masterfrom
Jakjm:timeOfDayChanges
Open

Time Of Day Colors for GLBs#4111
Jakjm wants to merge 22 commits into
open-goal:masterfrom
Jakjm:timeOfDayChanges

Conversation

@Jakjm

@Jakjm Jakjm commented Dec 31, 2025

Copy link
Copy Markdown
Contributor

With help from @gratefulforest, I've implemented storing colours for each time of day for meshes,
and updated the code to store 32 channel colours (8 times of day * 4 rgba channels).

2025-12-27.12-33-08.mp4

In addition, I've implemented a system @gratefulforest suggested which makes adding different times of day
really easy for developers.

  • If some times of day are missing, they use the closest time of day that is defined, defaulting to the earlier of the two if there are two equally closest defined times of day.
  • If no times of day are defined, COLOR_0 is used, otherwise white is used.

Log messages are concise and very informative:

[46:23:278] [info] Reading gltf mesh: /home/jakjm/git/jak-project/custom_assets/jak1/levels/test-zone/test-zone2.glb
[46:23:278] [warn] Plane missing some times of day, using sunrise:_EVENING, morning:_EVENING, noon:_TWILIGHT, afternoon:_TWILIGHT, sunset:_TWILIGHT, twilight:_TWILIGHT, evening:_EVENING, green sun:_EVENING
[46:23:278] [error] Cube.001 didn't have any colors, using white.
[46:23:278] [warn] Cube.002 had colors but no times of day, using COLOR_0.
[46:23:278] [warn] Cube.003 missing some times of day, using sunrise:_SUNRISE, morning:_SUNRISE, noon:_SUNRISE, afternoon:_SUNSET, sunset:_SUNSET, twilight:_SUNSET, evening:_SUNSET, green sun:_SUNRISE
[46:23:278] [warn] Cube.004 had colors but no times of day, using COLOR_0.
[46:23:278] [error] Cube.005 didn't have any colors, using white.

@OpenGOALBot

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@Jakjm

Jakjm commented Dec 31, 2025

Copy link
Copy Markdown
Contributor Author

This is my first time contributing so please let me know if I've missed anything! I've tried to update the kd-tree color quantization code but there might be things I didn't implement right. @gratefulforest was able to verify that everything is working as expected so far...

Anyway yeah, please let me know what I can improve and how to fix up these changes to get them merged :)

@Jakjm

Jakjm commented Jan 1, 2026

Copy link
Copy Markdown
Contributor Author

To use this, create a Color Attribute or rename an existing one with a _ followed by the time of day:
_SUNRISE
_MORNING
_NOON
_AFTERNOON
_SUNSET
_TWILIGHT
_EVENING
_GREENSUN

Then, you need to ensure Data -> Mesh -> Attributes is checked on the GLB export window.

Has been tested by @gratefulforest in a variety of circumstances and also doesn't affect transparency.

@Jakjm
Jakjm marked this pull request as ready for review January 1, 2026 03:08
@dallmeyer

Copy link
Copy Markdown
Contributor

Have you tested this with jak 2 or 3 custom levels? From a quick glance, it looks like the code you're modifying is shared between all 3 games

@Jakjm

Jakjm commented Mar 13, 2026

Copy link
Copy Markdown
Contributor Author

Have you tested this with jak 2 or 3 custom levels? From a quick glance, it looks like the code you're modifying is shared between all 3 games

Not yet but I will try it for both later on 😊

@Jakjm
Jakjm force-pushed the timeOfDayChanges branch from ed8b73f to d590897 Compare April 23, 2026 19:48
@Jakjm
Jakjm force-pushed the timeOfDayChanges branch from d590897 to d1abc2b Compare May 13, 2026 13:26
@Jakjm

Jakjm commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Here are some videos demonstrating the use of the same test-zone2.glb file (that GratefulForest was using to test Jak 1) for the later games. Here is a video of me switching to each of the colours one-by-one in Jak 1 for reference:

2026-07-20.13-56-56.mp4

In Jak 1, test-zone uses the village1 mood function which blends mesh colours from different times of day, which can make the appearance of the mesh appear different from what you would expect at a given time of day. @dallmeyer showed me on discord that in Jak 2 and 3, test-zone does not use a mood function that blends time of day colours. However, Jak 2 and 3 handle times of day differently from Jak 1 in that they will artificially alter colours according to the time of day, with different multipliers for r,g,b according to the time of day (making them darker in the night and brighter in the day - see this video for more details: https://discord.com/channels/756287461377703987/1094301632776376400/1504260430657487109).

I suspect that this new time-of-day lighting system is what makes so many of the colours appear to be a different shade of blue in both Jak 2 and 3 - the colours of the plane are the same across both games.

Jak 2 with the same .glb

2026-07-20.14-05-48.mp4

Jak 3 with the same .glb (identical appearance to Jak 2)

2026-07-20.14-07-37.mp4

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants