Procedural animated texture generation/Water
Minecraft Wiki article. Categories: Removed_features, Articles_to_be_expanded, Information_needed
This article is reproduced from Procedural animated texture generation/Water on the Minecraft Wiki. Mirrored from revision 3416543. It is licensed CC BY-NC-SA 3.0 by the Minecraft Wiki contributors — not under the Codex’s CC BY-SA 4.0, and it may not be used commercially. Edits belong upstream, not here.
Still water
Adapted from https://github.com/UnknownShadow200/ClassiCube/wiki/MInecraft-Classic-lava-animation-algorithm#water
Every frame, for each position in the still water texture array, the respective values for soup_heat, pot_heat and flame_heat are calculated as detailed below:
Calculates a local_soup_heat equal to the sum of the 3x1 soup_heat neighborhood around the current element.Calculates the new soup_heat as the sum of the local_soup_heat divided by 3.3F plus the pot_heat times 0.8FCalculates the new pot_heat as the current pot_heat plus the flame_heat times 0.05. pot_heat is clamped to a minimum of 0.Calculates the new flame_heat as the current flame_heat minus 0.1F.However, there is a 0.05 in 1 random chance that flame_heat is set to 0.5.
Once the above arrays have been updated, for each pixel in the water texture, the color and alpha values are calculated based on soup_heat:
Calculates a color_heat as the soup_heat clamped between 0 and 1 inclusive.Then it calculates the color components of the pixel as follows:float red = 32 + color_heat^2 * 32float green = 50 + color_heat^2 * 64float blue = 255float alpha = 146 + color_heat^2 * 50
The red, green and blue values are then converted to bytes and assigned to the texture accordingly.
Flowing water
- how the flowing texture was generated - presumably similarly to still water
- how it was generated before late infdev added the translational aspect
In addition, the flowing water texture also uses a spatial translation to give the appearance of movement. This transformation moves the flowing water texture downwards by one pixel after a fixed amount of time,[more information needed] wrapping the bottom layer of the texture back to the top.
Sources
- Procedural animated texture generation/Water — Minecraft Wiki, CC BY-NC-SA 3.0, revision 3416543.