Docs/Pollution

From Sunshine Wiki
Jump to navigation Jump to search

Basic Information[edit]

All pollution requires four parts to work; the bitmap image(s), the visual model(s), the heightmap(s), and pollution type data.

The bitmap images are found in the related BMP files, and each contains a binary-color raster image representing where the pollution will appear, with white pixels indicating pollution. The game updates this image in real-time, increasing or decreasing the number of white pixels when pollution is spread or removed respectively. The image is applied as a texture to the visual model so that changes to the pollution can be displayed in-game.

The visual models are found in the related BMD files, and each contains a set of faces, usually taken from the stage map's collision model, that allow the pollution to be displayed in-game. Even if the bitmap image is completely white, pollution will only be displayed within the visual model's faces. It is important to note that these faces contain no collision information for the pollution. This is handled instead by the heightmap.

The heightmaps are found in the related YMP file, listed as an array. Heightmaps contain a grayscale image, storing height information using the brightness value of each pixel, where absolute white represents the maximum height and absolute black represents the minimum height.

Finally, the pollution type data is found in the header of the related YMP file. It indicates the physical properties of the pollution. The various types are discussed in the Pollution Type Data section below.

Each stage has multiple BMP and BMD files associated with the different sections of pollution around the map. Conversely, there is only one YMP file per stage, as it contains all the information related to heightmaps and pollution type.

In some instances, such as Noki Bay, paint can be drawn vertically, along walls. It is currently unknown in what ways they handle differently, but it is known that they still work according to the four parts discussed above.

Example[edit]

There are a total of 5 pollution sections found in Bianco Hills Episode 1. This section indicates the area south of the Big Windmill, next to the river. Notice how the visual model has a default BMP texture with "256•128" crudely drawn onto it. This was likely used to remind developers what size the final BMP and heightmap files should be and to check that it was displaying properly in-game. This texture is overwritten by the final BMP image as soon as the stage loads.

It's important to note that the visual model is only concerned with displaying pollution. It’s actually the heightmap (in conjunction with the BMP file) that defines where the ground will act like pollution, even if the visual model does not cover that area.

If we overlay the heightmap with the BMP image, you can see there is a grey rectangular area on the left of the heightmap that is not covered by either the BMP image or the visual model. This corresponds to an outcropping of a wall found in the game. Note, that the floating face shown in the visual model above is the adjacent wall. According to the brightness value of the heightmap, it begins sunken into the ground.

By editing the BMP image to fill this area with pollution, the YMP file will make the ground act like it’s covered, even though it won’t be displayed because the faces of the visual model don’t cover this area. Mario will now interact with the ground as if it's covered in pollution, Swoopin' Stus and particle effects will spawn from the ground, and the pollution can be spread or washed away, according to the BMP image.

Section where goop model and ymp don't match up

How To Make Custom Pollution Maps[edit]

Pollution Type Data[edit]

Types[edit]

ymap.ymp contains a pollution region entry. The first 2 bytes determine the pollution type for that region.

Value Type
0 Causes Mario to sink and take damage (Unused)
1 Burns Mario
2 Causes Mario to slip and take damage
3 Prevents all lateral movement (Unused)
4 Shocks Mario
5 Kills Mario instantly (Unused)
6 Does nothing (Unused)
7 Burns Mario (Unused)
8+ No effect