Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Grass Block (Minecraft 4k): Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Sync: updated from Minecraft
SyncBot (talk | contribs)
Sync: updated from Minecraft
 
(One intermediate revision by the same user not shown)
Line 11: Line 11:


== Texture ==
== Texture ==
{{info needed section|describe the code used - can be found at https://github.com/NeRdTheNed/MC-TextureGen}}
[[File:Upscaled 4k grass side texture.png|thumb|right|The grass block's side texture if it was 512×512 instead of 16×16]]
[[File:Upscaled 4k grass side texture.png|thumb|right|The grass block's side texture if it was 512×512 instead of 16×16]]
The texture for the Grass block was generated by the game at runtime (similarly to [[Minecraft:Procedural animated texture generation|what was done in Java Edition at that time for water and lava]]), rather than being stored inside of the jar as an image file.
The texture for the Grass block was generated by the game at runtime (similarly to [[Minecraft:Procedural animated texture generation|what was done in Java Edition at that time for water and lava]]), rather than being stored inside of the jar as an image file.


A sinusoidal function is used to determine which of the pixels on the side belong to grass and which belong to dirt. This function becomes much more obvious when a higher-resolution version of the texture is generated.<ref>https://github.com/NeRdTheNed/MC-TextureGen/releases/tag/v1.7.0</ref>
As with all other block textures in Minecraft 4k, the grass block's textures are generated by going over every pixel in the texture left to right, top to bottom.
 
For each texture, there is a value that will be called "subTexture".
* subTexture = 0 is the top texture
* subTexture = 1 is the side texture
* subTexture = 2 is the bottom texture
For each pixel, the game generates a new "randomVariation", which is calculated by subtracting a random value from 0 to 95 from 255, resulting in a random value between 160 and 255.
 
After that, the game does the following algorithm to determine the current pixel's "color".
# The game evaluates ((3x<sup>2</sup> + 81x) &div; 4) & (i &div; 4 &minus; 1) where x and y are the "index" of the pixels; that is the amount of pixels from the left and topmost pixels respectively, and i is the size of the generated texture. (note that & represents a {{w|Bitwise_operation#AND|bitwise AND|newtab=1}}, and is responsible for keeping the grass color in roughly the top quarter of the block, as well as the pattern that it creates) The output of this operation will be called "grassCheck".
# The game then takes the performs the following comparisons in order:
#* If y + i &times; subTexture < grassCheck + {{frac|9|8}} i, it will set color to {{color|#6AAA40}} and proceed to the next step. (does not evaluate the next condition)
#* If y + i &times; subTexture < grassCheck + {{frac|9|8}} i + 1, it will set randomVariation to {{frac|2|3}} randomVariation and proceed to the next step. This will "blend" the grass texture into the dirt texture by darkening the dirt below the grass.
#** This will also cause the grass generation to fall through into the dirt's texture generator, which sets "color" to {{color|#966C4A}}
#* If subTexture is 0, the first condition will always be met, and if subTexture is 2, both conditions will be not be met.
# The game then creates a new value, that will be called "randomVariationWithBlockSideLight", where
#* If subTexture = 2 (the bottom texture) set randomVariationWithBlockSideLight to randomVariation &div; 2.
#* Else, set randomVariationWithBlockSideLight to randomVariation.
# The game multiplies each of "color"'s RGB channels by randomVariationWithBlockSideLight to get the final RGBA color of the pixel on the texture.<ref>https://github.com/NeRdTheNed/MC-TextureGen/blob/main/mc-texture-gen-impl/src/main/java/com/github/nerdthened/mctexturegen/generators/MC4k2Generator.java</ref>


== Data values ==
== Data values ==
Line 36: Line 53:
== Gallery ==
== Gallery ==
=== Textures ===
=== Textures ===
<gallery>
<gallery class="pixel-image">
4k-2 Grass Block (top texture).png|Top texture
4k-2 Grass Block (top texture).png|Top texture
4k-2 Grass Block (side texture).png|Side texture
4k-2 Grass Block (side texture).png|Side texture

Latest revision as of 11:07, 30 August 2026

Template:Italic title Template:Exclusive Template:Infobox In Minecraft:Minecraft 4k, the grass block has a block ID of 1. It was originally the Minecraft:XOR Block. Unlike normal Minecraft:Minecraft, grass blocks do not turn into dirt when a block is placed above it.

Texture

File:Upscaled 4k grass side texture.png
The grass block's side texture if it was 512×512 instead of 16×16

The texture for the Grass block was generated by the game at runtime (similarly to what was done in Java Edition at that time for water and lava), rather than being stored inside of the jar as an image file.

As with all other block textures in Minecraft 4k, the grass block's textures are generated by going over every pixel in the texture left to right, top to bottom.

For each texture, there is a value that will be called "subTexture".

  • subTexture = 0 is the top texture
  • subTexture = 1 is the side texture
  • subTexture = 2 is the bottom texture

For each pixel, the game generates a new "randomVariation", which is calculated by subtracting a random value from 0 to 95 from 255, resulting in a random value between 160 and 255.

After that, the game does the following algorithm to determine the current pixel's "color".

  1. The game evaluates ((3x2 + 81x) ÷ 4) & (i ÷ 4 − 1) where x and y are the "index" of the pixels; that is the amount of pixels from the left and topmost pixels respectively, and i is the size of the generated texture. (note that & represents a Template:W, and is responsible for keeping the grass color in roughly the top quarter of the block, as well as the pattern that it creates) The output of this operation will be called "grassCheck".
  2. The game then takes the performs the following comparisons in order:
    • If y + i × subTexture < grassCheck + Template:Frac i, it will set color to Template:Color and proceed to the next step. (does not evaluate the next condition)
    • If y + i × subTexture < grassCheck + Template:Frac i + 1, it will set randomVariation to Template:Frac randomVariation and proceed to the next step. This will "blend" the grass texture into the dirt texture by darkening the dirt below the grass.
      • This will also cause the grass generation to fall through into the dirt's texture generator, which sets "color" to Template:Color
    • If subTexture is 0, the first condition will always be met, and if subTexture is 2, both conditions will be not be met.
  3. The game then creates a new value, that will be called "randomVariationWithBlockSideLight", where
    • If subTexture = 2 (the bottom texture) set randomVariationWithBlockSideLight to randomVariation ÷ 2.
    • Else, set randomVariationWithBlockSideLight to randomVariation.
  4. The game multiplies each of "color"'s RGB channels by randomVariationWithBlockSideLight to get the final RGBA color of the pixel on the texture.<ref>https://github.com/NeRdTheNed/MC-TextureGen/blob/main/mc-texture-gen-impl/src/main/java/com/github/nerdthened/mctexturegen/generators/MC4k2Generator.java</ref>

Data values

ID

Template:ID table

History

Template:HistoryTable

Gallery

Textures

References

Template:Reflist

Navigation

Template:Navbox Minecraft 4k

Minecraft:pt:Minecraft 4k/Bloco de Grama