A random sentence for a random mind.

Unreal Level file content - reverse engineering

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: Semfry, ividyon

jammer64
Skaarj Scout Skaarj Scout
Posts: 45
Joined: 05 Jan 2010, 02:38

Subject: Unreal Level file content - reverse engineering

Post Posted: 20 Jul 2020, 17:46

Has anyone tried to disassemble unr file to check where are actors, where's lightmap stuff etc.? I wonder if, for example, lightmaps could be replaced with externally calculated ones, having nice baked global illumination, smooth edges and stuff :)

yrex
Skaarj Warrior Skaarj Warrior
Posts: 99
Joined: 07 Oct 2015, 11:19

Subject: Re: Unreal Level file content - reverse engineering

Post Posted: 20 Jul 2020, 20:14

Has anyone tried to disassemble unr file to check where are actors, where's lightmap stuff etc.?

Yes.

I wonder if, for example, lightmaps could be replaced with externally calculated ones, having nice baked global illumination, smooth edges

No. Lightmaps aren't stored as ordinary textures, but as one-bit "hits/doesn't hit" data per each light. This also allows dynamic non-moving lights to have shadows. At best, you could fuzz the borders and hope they look good after Unreal smooths them.
e-mail: ampoyrex at wp dot pl

jammer64
Skaarj Scout Skaarj Scout
Posts: 45
Joined: 05 Jan 2010, 02:38

Subject: Re: Unreal Level file content - reverse engineering

Post Posted: 13 Aug 2020, 14:43

That's actually very interesting! So how are lightmaps generated? Engine bakes them in runtime before level shows up, just using masking data from file?

I've just peeked into map file in hex viewer. I guess I see which data portion is lightmap but it seems to display different values than $00/$FF from time to time. Isn't the mask 8bit grayscale by any chance? Unless one byte is just a combination of up to 8 lights on/off per texel.

yrex
Skaarj Warrior Skaarj Warrior
Posts: 99
Joined: 07 Oct 2015, 11:19

Subject: Re: Unreal Level file content - reverse engineering

Post Posted: 13 Aug 2020, 18:20

You can observe when lightmaps are generated by doing something like "set light lightbrightness/hue/saturation <number>" and walking around until you see the changes. I think this happens after PreBeginPlay. You can also do "flush" to update all lightmaps. UsePrecache may also affect this somehow.

No, one byte stores 8 texels, although these masks are blurred on runtime, creating grayscale images.
e-mail: ampoyrex at wp dot pl

jammer64
Skaarj Scout Skaarj Scout
Posts: 45
Joined: 05 Jan 2010, 02:38

Subject: Re: Unreal Level file content - reverse engineering

Post Posted: 14 Aug 2020, 18:16

I know that 'flush' updates all lights but I didn't know the command for specific lights ;) Thanks, that was very insightful! Did you use this file research in any particular project? Is map format breakdown published anywhere? :)

yrex
Skaarj Warrior Skaarj Warrior
Posts: 99
Joined: 07 Oct 2015, 11:19

Subject: Re: Unreal Level file content - reverse engineering

Post Posted: 15 Aug 2020, 16:43

Yes, some time ago, I wrote a program which after taking tons of shortcuts and cutting tons of corners could approximate the experience of playing Unreal maps.

Here's a partial specification of the format:

http://utgl.unrealadmin.org/UT_Package_ ... at_pdf.zip

But it doesn't mention level-related structures like the BSP tree or lightmaps. To get that, visit the other link and look into the source code.
e-mail: ampoyrex at wp dot pl

jammer64
Skaarj Scout Skaarj Scout
Posts: 45
Joined: 05 Jan 2010, 02:38

Subject: Re: Unreal Level file content - reverse engineering

Post Posted: 18 Aug 2020, 12:25

Thanks a lot! <3


Who is online

Users browsing this forum: No registered users and 3 guests

Copyright © 2001-2024 UnrealSP.org

Powered by phpBB® Forum Software © phpBB Limited