Actions

SCHG

Difference between revisions of "Sonic Heroes/Visibility Editing"

From Sonic Retro

(Created page with "{{SCHG SH}} Visibility data for level models is set in sLL_blk.bin files located in the dvdroot folder. They are little endian binary files which define boundary boxes. When...")
 
m (Text replacement - " Layout==" to " layout==")
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{SCHG SH}}
 
{{SCHG SH}}
  
Visibility data for level models is set in sLL_blk.bin files located in the dvdroot folder. They are little endian binary files which define boundary boxes. When the camera is inside the box (its XYZ coordinates fit inside the specified maximums and minimums), the specified chunk of level geometry (loaded from the BSP files packed inside the sLL.one file) is rendered.
+
Visibility data for level models is set in sLL_blk.bin files located in the dvdroot folder. They are big endian binary files which define boundary boxes. When the camera is inside the box, the specified chunk of level geometry is rendered.
  
== File Layout ==
+
==File layout==
Each sLL_blk.bin file contains 64 (0x40) entries for boundary boxes, which seems to be the maximum. Most levels are split into 5 to 15 chunk, so usually the majority of those entries is left unused.<br />
+
Each sLL_blk.bin file contains 64 entries for boundary boxes. Most levels are split into fewer chunks, so the majority of those entries is left unused.<br />
 
Each entry is 0x1B bytes long and is set like this:
 
Each entry is 0x1B bytes long and is set like this:
  
{{grey|00 00 00 00}} {{red|00 00 00 00}} {{green|00 00 00 00}} {{blue|00 00 00 00}} {{cyan|00 00 00 00}} {{magenta|00 00 00 00}} {{{yellow|00 00 00 00}}<br />
+
{{grey|00 00 00 00}} {{red|00 00 00 00}} {{green|00 00 00 00}} {{blue|00 00 00 00}} {{cyan|00 00 00 00}} {{magenta|00 00 00 00}} {{yellow|00 00 00 00}}<br />
  
{| class="prettytable"
+
{| class="prettytable" style="width:auto;"
 
!Offset||Type||Description
 
!Offset||Type||Description
 
|-
 
|-
 
| {{grey|0x00}}
 
| {{grey|0x00}}
 
| {{grey|Long}}
 
| {{grey|Long}}
| {{grey|Chunk number}}
+
| {{grey|Chunk number (-1 for blank entry)}}
 
|-
 
|-
 
| {{red|0x04}}
 
| {{red|0x04}}
Line 41: Line 41:
 
|}
 
|}
  
The XYZ coordinates for the maximum and minimum of the boundary boxes are '''not''' floats. They are read the following way:
+
The XYZ coordinates for the maximum and minimum of the boundary boxes are signed 32 bit integers, allowing for positive and negative values.
*If the first word of the long is 0x0000, then the second word is loaded as the coordinate as a positive integer
+
The minimum value for each coordinate must be lower than the maximum, but the minimum doesn't have to be positive or the maximum negative.
*If the first word of the long is 0xFFFF, then the second word is subtracted from 0x10000 (65536 in dec) and the result is loaded as the coordinate as a negative integer
+
The same chunk can be specified to load from more than one entry, and multiple chunks can be loaded at the same time from overlapping boxes.<br />
  
This means that 65536 units to either positive or negative directions in any of the three axes is the maximum distance for the game to be able to render the level model. It is possible to pass those distances with the characters, though.<br />
+
==References==
The same chunk can be specified to load from more than one entry, and multiple chunks can be loaded at the same time from overlapping boxes.<br />
+
<references />
Note that the chunks are specified in the form of S{{red|LL}}_{{green|XX}}_{{blue|NN}}.BSP files located in the sLL.one file. {{red|LL}} is the level number, {{green|XX}} are letters that identify which part of the geometry is in that file (ground, walls, detail, skybox, water) and {{blue|NN}} is the chunk number. All files with the same number make up the same chunk and are loaded at the same time<br />
 
  
 
{{SCHGuides}}
 
{{SCHGuides}}
[[Category:Sonic Community Hacking Guide]]
 

Latest revision as of 16:36, 24 March 2020

SCHG: Sonic Heroes
Main Article
Mechanic Editing

DOL Editing
EXE Editing
Music Pointers
Object Parameter Data
Relocatable Editing (PC)
File Offsets

Model Editing
Collision Format
Model Format
Level Editing

Camera Editing
Event Editing
ID list
Indirect Editing
Light Editing
Level List
Object Editing
Object Porting
Spline Editing
Texture Animation Editing
Visibility Editing

Particle Editing
Particle Editing
Sound Editing
Music List

Sound Editing
Voices

SCHG How-Tos

Custom Object Material Effect Tutorial
Level Editing Tutorial


Visibility data for level models is set in sLL_blk.bin files located in the dvdroot folder. They are big endian binary files which define boundary boxes. When the camera is inside the box, the specified chunk of level geometry is rendered.

File layout

Each sLL_blk.bin file contains 64 entries for boundary boxes. Most levels are split into fewer chunks, so the majority of those entries is left unused.
Each entry is 0x1B bytes long and is set like this:

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Offset Type Description
0x00 Long Chunk number (-1 for blank entry)
0x04 Long Minimum X
0x08 Long Minimum Y
0x0C Long Minimum Z
0x10 Long Maximum X
0x14 Long Maximum Y
0x18 Long Maximum Z

The XYZ coordinates for the maximum and minimum of the boundary boxes are signed 32 bit integers, allowing for positive and negative values. The minimum value for each coordinate must be lower than the maximum, but the minimum doesn't have to be positive or the maximum negative. The same chunk can be specified to load from more than one entry, and multiple chunks can be loaded at the same time from overlapping boxes.

References


Sonic Community Hacking Guide
General
SonED2 Manual | Subroutine Equivalency List
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (Master System) | Sonic 3 | Sonic 3 & Knuckles | Chaotix | Sonic Jam | Sonic Jam 6 | Sonic Adventure | Sonic Adventure DX: Director's Cut | Sonic Adventure DX: PC | Sonic Adventure (2010) | Sonic Adventure 2 | Sonic Adventure 2: Battle | Sonic Adventure 2 (PC) | Sonic Heroes | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Colours | Sonic Generations | Sonic Forces
Technical information
Sonic Eraser | Sonic 2 (Nick Arcade prototype) | Sonic CD (prototype; 1992-12-04) | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Tails Adventures | Sonic Crackers | Sonic 3D: Flickies' Island | Sonic & Knuckles Collection | Sonic R | Sonic Shuffle | Sonic Advance | Sonic Advance 3 | Sonic Battle | Shadow the Hedgehog | Sonic Rush | Sonic Classic Collection | Sonic Free Riders | Sonic Lost World
Legacy Guides
The Nemesis Hacking Guides The Esrael Hacking Guides
ROM: Sonic 1 | Sonic 2 | Sonic 2 Beta | Sonic 3

Savestate: Sonic 1 | Sonic 2 Beta/Final | Sonic 3

Sonic 1 (English / Portuguese) | Sonic 2 Beta (English / Portuguese) | Sonic 2 and Knuckles (English / Portuguese)
Move to Sega Retro
Number Systems (or scrap) | Assembly Hacking Guide | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | SMPS Music Hacking Guide | Mega Drive technical information