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

Minecraft:Starfield: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Sync: updated from Minecraft
SyncBot (talk | contribs)
Sync: updated from Minecraft
Line 24: Line 24:
There are two subtly different gateway effects, referred to by the {{code|end_cube}} special model type as {{code|portal}} (used for end portal blocks, the dimension loading screens for entering and exiting the End, and the credits sequence and preceding poem) and {{code|gateway}}, used specifically for end gateways. The latter renders an extra layer of blue pixels which are absent from the former, which can be seen by placing the two blocks next to each other; blue pixels will disappear when they migrate to the space where the end portal is present. See later in this section for a technical explanation of the difference.
There are two subtly different gateway effects, referred to by the {{code|end_cube}} special model type as {{code|portal}} (used for end portal blocks, the dimension loading screens for entering and exiting the End, and the credits sequence and preceding poem) and {{code|gateway}}, used specifically for end gateways. The latter renders an extra layer of blue pixels which are absent from the former, which can be seen by placing the two blocks next to each other; blue pixels will disappear when they migrate to the space where the end portal is present. See later in this section for a technical explanation of the difference.


Two different texture files are utilised in generating the starfield effect:
Two different texture files are utilized in generating the starfield effect:


{| class="wikitable" style="text-align:center; margin: auto;"
{| class="wikitable" style="text-align:center; margin: auto;"
Line 36: Line 36:
The "End sky" texture, which is indeed the same texture used for the actual [[Minecraft:End sky]], is used as the "background" texture: it is sampled using screen-projected coordinates and multiplied by {{color|#06191C}}. The shader uses the projected screen-space y-coordinate directly as the vertical texture coordinate; because the screen-projected vertical coordinate increases upwards while the texture image is displayed with its vertical axis running downwards, the background texture appears vertically mirrored.
The "End sky" texture, which is indeed the same texture used for the actual [[Minecraft:End sky]], is used as the "background" texture: it is sampled using screen-projected coordinates and multiplied by {{color|#06191C}}. The shader uses the projected screen-space y-coordinate directly as the vertical texture coordinate; because the screen-projected vertical coordinate increases upwards while the texture image is displayed with its vertical axis running downwards, the background texture appears vertically mirrored.


The "End portal" texture is sampled in multiple layers on top of this background. Each layer uses a different colour multiplier, scale, rotation, fixed horizontal offset, and time-based vertical offset. In the fragment shader, the RGB results of the layers are combined additively before the final colour is output with full opacity. The End portal uses 15 layers of the "End portal" texture, while the End gateway uses 16 layers. The first 15 layers are shared between both effects, while the End gateway has an additional layer using {{color|#1550A9}}.
The "End portal" texture is sampled in multiple layers on top of this background. Each layer uses a different color multiplier, scale, rotation, fixed horizontal offset, and time-based vertical offset. In the fragment shader, the RGB results of the layers are combined additively before the final color is output with full opacity. The End portal uses 15 layers of the "End portal" texture, while the End gateway uses 16 layers. The first 15 layers are shared between both effects, while the End gateway has an additional layer using {{color|#1550A9}}.


The colour values used by the layers are as follows. Index 0 is also used for the "End sky" background, but the velocity listed for index 0 applies only to the first layer of the "End portal" texture. The End portal uses indices 0 through 14, while the End gateway uses indices 0 through 15. The Velocity column gives the rate at which the time-based vertical offset increases. In the current Windows behaviour, this is also the apparent downward velocity of the layer. In the pre-25w07a behaviour, where the apparent travel direction follows each layer's rotation, the same listed velocity is transformed by the layer's rotation and scale.
The color values used by the layers are as follows. Index 0 is also used for the "End sky" background, but the velocity listed for index 0 applies only to the first layer of the "End portal" texture. The End portal uses indices 0 through 14, while the End gateway uses indices 0 through 15. The Velocity column gives the rate at which the time-based vertical offset increases. In the current Windows behavior, this is also the apparent downward velocity of the layer. In the pre-25w07a behavior, where the apparent travel direction follows each layer's rotation, the same listed velocity is transformed by the layer's rotation and scale.


{| class="wikitable" style="text-align:center;"
{| class="wikitable" style="text-align:center;"
Line 45: Line 45:
! rowspan="2" | {{abbr|Rotation|Shader rotation angle, reduced modulo 360; 0° corresponds to downward travel, and positive values are clockwise}}
! rowspan="2" | {{abbr|Rotation|Shader rotation angle, reduced modulo 360; 0° corresponds to downward travel, and positive values are clockwise}}
! rowspan="2" | {{abbr|Scale|The scale factor applied to the sampled texture coordinates; higher values make the texture pattern appear smaller}}
! rowspan="2" | {{abbr|Scale|The scale factor applied to the sampled texture coordinates; higher values make the texture pattern appear smaller}}
! rowspan="2" | Colour
! rowspan="2" | Color
! colspan="2" | Used by
! colspan="2" | Used by
|-
|-
Line 181: Line 181:
For the ''n''th layer, where ''n'' starts at 1 and equals the table index plus 1, the horizontal offset is {{frac|17|''n''}}, the rotation angle is (''n''×''n''×4321+''n''×9)×2 degrees,{{info needed|What would the equation be for radians? I think both the JE and BE tables should list both degrees and radians}} and the scale is (4.5-{{frac|''n''|4}})×2. The vertical offset is (2+{{frac|''n''|1.5}})×(GameTime×1.5). Since GameTime increases by {{frac|1|24000}} per game tick, the Velocity value listed in the table is {{frac|(3+''n'')|24000}}. In unaffected rendering behaviour, the Rotation value gives the apparent travel direction, while the apparent travel velocity is the listed Velocity divided by the listed Scale.
For the ''n''th layer, where ''n'' starts at 1 and equals the table index plus 1, the horizontal offset is {{frac|17|''n''}}, the rotation angle is (''n''×''n''×4321+''n''×9)×2 degrees,{{info needed|What would the equation be for radians? I think both the JE and BE tables should list both degrees and radians}} and the scale is (4.5-{{frac|''n''|4}})×2. The vertical offset is (2+{{frac|''n''|1.5}})×(GameTime×1.5). Since GameTime increases by {{frac|1|24000}} per game tick, the Velocity value listed in the table is {{frac|(3+''n'')|24000}}. In unaffected rendering behaviour, the Rotation value gives the apparent travel direction, while the apparent travel velocity is the listed Velocity divided by the listed Scale.


On some AMD Windows systems, the layers appear to move vertically downwards instead of following the directions listed in the table. This behaviour is unintentional. On some,sustems, only OpenGL exhibits this behaviour, whereas the Vulkan renderer does not, although on other systems both are affected. It does not affect OpenGL on macOS, Linux, or when using Nvidia graphics hardware.<ref>{{bug|MC-308516}}</ref>
On some AMD Windows systems, the layers appear to move vertically downwards instead of following the directions listed in the table. This behaviour is unintentional. On some systems, only OpenGL exhibits this behavior, whereas the Vulkan renderer does not, although on other systems both are affected. It does not affect OpenGL on macOS, Linux, or when using Nvidia graphics hardware.<ref>{{bug|MC-308516}}</ref>


The starfield effect is completely constant regardless of view: while moving and rotating the camera will change the position of the object using the starfield effect itself on screen, the starfield itself will remain fixed in place. In effect, anything using the starfield effect effectively creates what can be seen as a "hole" in the world, behind which the starfield rests. The shape of the starfield also changes with the window size, although this is presumably not intentional.<ref>{{bug|MC-265456}}</ref>
The starfield effect is completely constant regardless of view: while moving and rotating the camera will change the position of the object using the starfield effect itself on screen, the starfield itself will remain fixed in place. In effect, anything using the starfield effect effectively creates what can be seen as a "hole" in the world, behind which the starfield rests. The shape of the starfield also changes with the window size, although this is presumably not intentional.<ref>{{bug|MC-265456}}</ref>


=== ''Bedrock Edition'' ===
=== ''Bedrock Edition'' ===
{{Info needed section|Colour reproduction may vary slightly between different devices (https://discord.com/channels/447104142729674753/449243256849563648/1512793138526294156)}}
{{Info needed section|Color reproduction may vary slightly between different devices (https://discord.com/channels/447104142729674753/449243256849563648/1512793138526294156)}}
The starfield effect in Bedrock Edition is rendered using a layered parallax system.
The starfield effect in Bedrock Edition is rendered using a layered parallax system.


Line 195: Line 195:
In both effects, one layer forms an opaque base layer, while the remaining 16 render the pixels making up the starfield. The geometry of the 17 layers overlaps exactly within each effect; the depth and parallax of the starfield are produced by the different texture coordinates and layer parameters used by each layer.
In both effects, one layer forms an opaque base layer, while the remaining 16 render the pixels making up the starfield. The geometry of the 17 layers overlaps exactly within each effect; the depth and parallax of the starfield are produced by the different texture coordinates and layer parameters used by each layer.


Two different texture files are utilised in generating the effect:
Two different texture files are utilized in generating the effect:


{| class="wikitable" style="text-align:center; margin: auto;"
{| class="wikitable" style="text-align:center; margin: auto;"
Line 205: Line 205:
|}
|}


The {{code|end_portal.png}} texture supplies the starfield pattern, while the {{code|end_portal_colors.png}} texture supplies the colours used by the individual starfield layers. Both textures use nearest-neighbour filtering and wrap addressing on both texture-coordinate axes, so coordinates outside the texture range continue sampling from the opposite side.
The {{code|end_portal.png}} texture supplies the starfield pattern, while the {{code|end_portal_colors.png}} texture supplies the colors used by the individual starfield layers. Both textures use nearest-neighbor filtering and wrap addressing on both texture-coordinate axes, so coordinates outside the texture range continue sampling from the opposite side.


The opaque base layer has a layer parameter of 1. In this case, the pixel shader enters the base-layer branch and generates the output colour from the current fog colour and fog factor. At positions unaffected by fog, the fog factor is 0, causing the layer to appear black; as the fog factor increases, the colour of the base layer approaches the fog colour of the scene.
The opaque base layer has a layer parameter of 1. In this case, the pixel shader enters the base-layer branch and generates the output color from the current fog color and fog factor. At positions unaffected by fog, the fog factor is 0, causing the layer to appear black; as the fog factor increases, the color of the base layer approaches the fog color of the scene.


The remaining 16 layers render the starfield pixels and are indexed from 0 through 15. Their layer parameters are {{frac|239|255}}, {{frac|223|255}}, and {{frac|207|255}}, decreasing by {{frac|16|255}} for each subsequent layer until {{frac|15|255}} at index 14; the layer parameter at index 15 is 0.
The remaining 16 layers render the starfield pixels and are indexed from 0 through 15. Their layer parameters are {{frac|239|255}}, {{frac|223|255}}, and {{frac|207|255}}, decreasing by {{frac|16|255}} for each subsequent layer until {{frac|15|255}} at index 14; the layer parameter at index 15 is 0.


Each starfield layer has a fixed set of colour texture coordinates. The 16 coordinate pairs form a 4x4 grid, with both coordinates successively taking the values {{frac|9|16}}, {{frac|11|16}}, {{frac|13|16}}, and {{frac|15|16}}. With nearest-neighbour filtering, these coordinates fall within the bottom-right 2x2-pixel region of the colour texture, so four colours are used,{{verify|not in my experience}} each by four starfield layers.
Each starfield layer has a fixed set of color texture coordinates. The 16 coordinate pairs form a 4x4 grid, with both coordinates successively taking the values {{frac|9|16}}, {{frac|11|16}}, {{frac|13|16}}, and {{frac|15|16}}. With nearest-neighbor filtering, these coordinates fall within the bottom-right 2x2-pixel region of the color texture, so four colors are used,{{verify|not in my experience}} each by four starfield layers.


The parameters used by the starfield layers are as follows. The Rotation column gives the exact angle in radians, reduced to the range from 0 to 2π:
The parameters used by the starfield layers are as follows. The Rotation column gives the exact angle in radians, reduced to the range from 0 to 2π:
Line 221: Line 221:
! {{abbr|Virtual depth|Depth value used to calculate the parallax sampling position}}
! {{abbr|Virtual depth|Depth value used to calculate the parallax sampling position}}
! {{abbr|Layer brightness|Brightness factor applied before fog attenuation}}
! {{abbr|Layer brightness|Brightness factor applied before fog attenuation}}
! Colour texture coordinates
! Color texture coordinates
! Colour{{verify|maybe "intended colour", and go into detail on deviations on other devices? also, some are absent on end portals, but not end gateways, and this too is device dependent}}
! Color{{verify|maybe "intended colour", and go into detail on deviations on other devices? also, some are absent on end portals, but not end gateways, and this too is device dependent}}
|-
|-
| 0
| 0
Line 355: Line 355:
For a starfield layer with a layer parameter of ''p'', the virtual depth is 32''p'', the rotation angle of the texture coordinates is 32''p''×{{frac|5π|7}} radians, and the layer brightness is 1-''p''.
For a starfield layer with a layer parameter of ''p'', the virtual depth is 32''p'', the rotation angle of the texture coordinates is 32''p''×{{frac|5π|7}} radians, and the layer brightness is 1-''p''.


The RGB components of the vertex colour encode the direction of the current block face, while the alpha component stores the layer parameter. The vertex shader uses the vertex position, block-face direction, viewpoint position, and virtual depth to calculate the position projected from the viewpoint onto a virtual sampling plane. The actual geometry of all 17 layers overlaps exactly, but the virtual sampling planes corresponding to the layers lie at different depths, producing multiple levels of parallax as the camera moves.
The RGB components of the vertex color encode the direction of the current block face, while the alpha component stores the layer parameter. The vertex shader uses the vertex position, block-face direction, viewpoint position, and virtual depth to calculate the position projected from the viewpoint onto a virtual sampling plane. The actual geometry of all 17 layers overlaps exactly, but the virtual sampling planes corresponding to the layers lie at different depths, producing multiple levels of parallax as the camera moves.


The virtual sampling position is then converted into two-dimensional coordinates according to the direction of the block face and scaled to {{frac|1|16}} of its original size. The coordinates are rotated by the rotation angle of the layer, then offset by 32''p'' in the same direction. The time value supplied by the renderer is divided by 256 and added to the second texture coordinate, causing the starfield pattern to move continuously. All layers use the same time increment, while their different rotation angles and virtual depths produce different apparent directions of travel and degrees of parallax.
The virtual sampling position is then converted into two-dimensional coordinates according to the direction of the block face and scaled to {{frac|1|16}} of its original size. The coordinates are rotated by the rotation angle of the layer, then offset by 32''p'' in the same direction. The time value supplied by the renderer is divided by 256 and added to the second texture coordinate, causing the starfield pattern to move continuously. All layers use the same time increment, while their different rotation angles and virtual depths produce different apparent directions of travel and degrees of parallax.
Line 361: Line 361:
The time value supplied by the renderer increases in seconds, so the time offset increases by {{frac|1|256}} of a texture-coordinate unit per second. The parallax texture uses wrap addressing; with the camera position and other rendering parameters kept unchanged, the starfield animation returns to the same texture phase every 256 seconds.
The time value supplied by the renderer increases in seconds, so the time offset increases by {{frac|1|256}} of a texture-coordinate unit per second. The parallax texture uses wrap addressing; with the camera position and other rendering parameters kept unchanged, the starfield animation returns to the same texture phase every 256 seconds.


The output colour of an ordinary starfield layer is obtained by multiplying the colour texture, parallax texture, layer brightness, and fog attenuation component-wise. If the layer parameter is ''p'' and the fog factor is ''f'', the colour of the layer is the component-wise product of the colour texture, the parallax texture, 1-''p'', and 1-''f''.
The output color of an ordinary starfield layer is obtained by multiplying the color texture, parallax texture, layer brightness, and fog attenuation component-wise. If the layer parameter is ''p'' and the fog factor is ''f'', the color of the layer is the component-wise product of the color texture, the parallax texture, 1-''p'', and 1-''f''.


The blend state causes the base layer to replace the existing colour in the framebuffer, after which the 16 starfield layers are added successively. Different graphics backends may use different output alpha values and destination blend factors to produce the same colour-compositing result.
The blend state causes the base layer to replace the existing color in the framebuffer, after which the 16 starfield layers are added successively. Different graphics backends may use different output alpha values and destination blend factors to produce the same color-compositing result.


The effect uses depth testing and depth writing, with the depth comparison function set to less than or equal. As all 17 layers of each effect use the same geometry and depth, each layer can pass the test at equal depth and take part in the final composition.
The effect uses depth testing and depth writing, with the depth comparison function set to less than or equal. As all 17 layers of each effect use the same geometry and depth, each layer can pass the test at equal depth and take part in the final composition.
Line 539: Line 539:
The background layer, rather than being a fixed background, was treated much more similarly to the starfield particle layers on top of it; it was scaled, tessellated, and would move over time. That is, the "layer" furthest back used {{code|end_sky}} rather than {{code|end_portal}}, but otherwise behaved as the {{code|end_portal}} layers do, being rotated, repeated and gradually moving.
The background layer, rather than being a fixed background, was treated much more similarly to the starfield particle layers on top of it; it was scaled, tessellated, and would move over time. That is, the "layer" furthest back used {{code|end_sky}} rather than {{code|end_portal}}, but otherwise behaved as the {{code|end_portal}} layers do, being rotated, repeated and gradually moving.


Rather than being explicitly defined, the set of colours used were generated using a fixed numeric seed (31100).{{info needed|What algorithm was used to generate these colours?}} The same set of colours were generated on every session. End portals and end gateways used different colour multipliers.{{info needed|Did this result in any visual differences from one block to the other besides the former not using the biggest, bluest layer?}}
Rather than being explicitly defined, the set of colors used were generated using a fixed numeric seed (31100).{{info needed|What algorithm was used to generate these colours?}} The same set of colors were generated on every session. End portals and end gateways used different color multipliers.{{info needed|Did this result in any visual differences from one block to the other besides the former not using the biggest, bluest layer?}}


{| class="wikitable" style="text-align:center"
{| class="wikitable" style="text-align:center"
Line 547: Line 547:
! rowspan="2" | {{abbr|Rotation|Shader rotation angle, reduced modulo 360; 0° corresponds to downward travel, and positive values are clockwise}}
! rowspan="2" | {{abbr|Rotation|Shader rotation angle, reduced modulo 360; 0° corresponds to downward travel, and positive values are clockwise}}
! rowspan="2" | {{abbr|Scale|The scale factor applied to the sampled texture coordinates; higher values make the texture pattern appear smaller}}
! rowspan="2" | {{abbr|Scale|The scale factor applied to the sampled texture coordinates; higher values make the texture pattern appear smaller}}
! rowspan="2" | Colour
! rowspan="2" | Color
! colspan="2" | Used by
! colspan="2" | Used by
|-
|-
Line 803: Line 803:
| [[File:Starfield (even colors only) BE.gif|300px]]
| [[File:Starfield (even colors only) BE.gif|300px]]
| [[File:Starfield BE.gif|300px]]
| [[File:Starfield BE.gif|300px]]
| End portals only use even colours
| End portals only use even colors
|}
|}



Revision as of 11:14, 6 July 2026

Template:Conjecture Template:Rewrite Starfield is a unique graphical effect used for rendering certain features related to Minecraft:the End.

Use cases

Starfield effects are used for the following:

Minecraft:Falling block entities of the End portal and End gateway do not render the starfield effect, and it seems highly unlikely (although unproven) that Minecraft:moving piston blocks would either.<ref>Template:Bug</ref>

How it is rendered

Java Edition

The rendering of the starfield effect has changed several times throughout the game's history.

There are two subtly different gateway effects, referred to by the Template:Code special model type as Template:Code (used for end portal blocks, the dimension loading screens for entering and exiting the End, and the credits sequence and preceding poem) and Template:Code, used specifically for end gateways. The latter renders an extra layer of blue pixels which are absent from the former, which can be seen by placing the two blocks next to each other; blue pixels will disappear when they migrate to the space where the end portal is present. See later in this section for a technical explanation of the difference.

Two different texture files are utilized in generating the starfield effect:

Template:Code Template:Code
Template:Pximg Template:Pximg

The "End sky" texture, which is indeed the same texture used for the actual Minecraft:End sky, is used as the "background" texture: it is sampled using screen-projected coordinates and multiplied by Template:Color. The shader uses the projected screen-space y-coordinate directly as the vertical texture coordinate; because the screen-projected vertical coordinate increases upwards while the texture image is displayed with its vertical axis running downwards, the background texture appears vertically mirrored.

The "End portal" texture is sampled in multiple layers on top of this background. Each layer uses a different color multiplier, scale, rotation, fixed horizontal offset, and time-based vertical offset. In the fragment shader, the RGB results of the layers are combined additively before the final color is output with full opacity. The End portal uses 15 layers of the "End portal" texture, while the End gateway uses 16 layers. The first 15 layers are shared between both effects, while the End gateway has an additional layer using Template:Color.

The color values used by the layers are as follows. Index 0 is also used for the "End sky" background, but the velocity listed for index 0 applies only to the first layer of the "End portal" texture. The End portal uses indices 0 through 14, while the End gateway uses indices 0 through 15. The Velocity column gives the rate at which the time-based vertical offset increases. In the current Windows behavior, this is also the apparent downward velocity of the layer. In the pre-25w07a behavior, where the apparent travel direction follows each layer's rotation, the same listed velocity is transformed by the layer's rotation and scale.

Index Velocity Template:Abbr Template:Abbr Color Used by
Template:Code Template:Code
0 Template:Frac 20° 8.5 Template:Abbr Template:Tc Template:Tc
1 Template:Frac 44° 8 Template:Abbr Template:Tc Template:Tc
2 Template:Frac 72° 7.5 Template:Abbr Template:Tc Template:Tc
3 Template:Frac 104° 7 Template:Abbr Template:Tc Template:Tc
4 Template:Frac 140° 6.5 Template:Abbr Template:Tc Template:Tc
5 Template:Frac 180° 6 Template:Abbr Template:Tc Template:Tc
6 Template:Frac 224° 5.5 Template:Abbr Template:Tc Template:Tc
7 Template:Frac 272° 5 Template:Abbr Template:Tc Template:Tc
8 Template:Frac 324° 4.5 Template:Abbr Template:Tc Template:Tc
9 Template:Frac 20° 4 Template:Abbr Template:Tc Template:Tc
10 Template:Frac 80° 3.5 Template:Abbr Template:Tc Template:Tc
11 Template:Frac 144° 3 Template:Abbr Template:Tc Template:Tc
12 Template:Frac 212° 2.5 Template:Abbr Template:Tc Template:Tc
13 Template:Frac 284° 2 Template:Abbr Template:Tc Template:Tc
14 Template:Frac 1.5 Template:Abbr Template:Tc Template:Tc
15 Template:Frac 80° 1 Template:Abbr Template:Tc Template:Tc

For the nth layer, where n starts at 1 and equals the table index plus 1, the horizontal offset is Template:Frac, the rotation angle is (n×n×4321+n×9)×2 degrees,Template:Info needed and the scale is (4.5-Template:Frac)×2. The vertical offset is (2+Template:Frac)×(GameTime×1.5). Since GameTime increases by Template:Frac per game tick, the Velocity value listed in the table is Template:Frac. In unaffected rendering behaviour, the Rotation value gives the apparent travel direction, while the apparent travel velocity is the listed Velocity divided by the listed Scale.

On some AMD Windows systems, the layers appear to move vertically downwards instead of following the directions listed in the table. This behaviour is unintentional. On some systems, only OpenGL exhibits this behavior, whereas the Vulkan renderer does not, although on other systems both are affected. It does not affect OpenGL on macOS, Linux, or when using Nvidia graphics hardware.<ref>Template:Bug</ref>

The starfield effect is completely constant regardless of view: while moving and rotating the camera will change the position of the object using the starfield effect itself on screen, the starfield itself will remain fixed in place. In effect, anything using the starfield effect effectively creates what can be seen as a "hole" in the world, behind which the starfield rests. The shape of the starfield also changes with the window size, although this is presumably not intentional.<ref>Template:Bug</ref>

Bedrock Edition

Template:Info needed section The starfield effect in Bedrock Edition is rendered using a layered parallax system.

For Minecraft:end portals, the effect consists of 17 overlapping horizontal quadrilateral layers with identical positions, dimensions, and depths. Each layer covers the full horizontal area of a block and consists of 2 triangles.

For Minecraft:end gateways, the effect consists of 17 overlapping layers with identical positions, dimensions, and depths. Each cube layer occupies a full block space and consists of 6 faces and 12 triangles.

In both effects, one layer forms an opaque base layer, while the remaining 16 render the pixels making up the starfield. The geometry of the 17 layers overlaps exactly within each effect; the depth and parallax of the starfield are produced by the different texture coordinates and layer parameters used by each layer.

Two different texture files are utilized in generating the effect:

Template:Code Template:Code
Template:Pximg Template:Pximg

The Template:Code texture supplies the starfield pattern, while the Template:Code texture supplies the colors used by the individual starfield layers. Both textures use nearest-neighbor filtering and wrap addressing on both texture-coordinate axes, so coordinates outside the texture range continue sampling from the opposite side.

The opaque base layer has a layer parameter of 1. In this case, the pixel shader enters the base-layer branch and generates the output color from the current fog color and fog factor. At positions unaffected by fog, the fog factor is 0, causing the layer to appear black; as the fog factor increases, the color of the base layer approaches the fog color of the scene.

The remaining 16 layers render the starfield pixels and are indexed from 0 through 15. Their layer parameters are Template:Frac, Template:Frac, and Template:Frac, decreasing by Template:Frac for each subsequent layer until Template:Frac at index 14; the layer parameter at index 15 is 0.

Each starfield layer has a fixed set of color texture coordinates. The 16 coordinate pairs form a 4x4 grid, with both coordinates successively taking the values Template:Frac, Template:Frac, Template:Frac, and Template:Frac. With nearest-neighbor filtering, these coordinates fall within the bottom-right 2x2-pixel region of the color texture, so four colors are used,Template:Verify each by four starfield layers.

The parameters used by the starfield layers are as follows. The Rotation column gives the exact angle in radians, reduced to the range from 0 to 2π:

Index Layer parameter Template:Abbr Template:Abbr Template:Abbr Color texture coordinates ColorTemplate:Verify
0 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
1 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
2 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
3 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
4 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
5 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
6 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
7 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
8 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
9 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
10 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
11 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
12 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
13 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
14 Template:Frac Template:Fracπ Template:Frac Template:Frac (Template:Frac,Template:Frac) Template:Color
15 0 0 0 1 (Template:Frac,Template:Frac) Template:Color

For a starfield layer with a layer parameter of p, the virtual depth is 32p, the rotation angle of the texture coordinates is 32p×Template:Frac radians, and the layer brightness is 1-p.

The RGB components of the vertex color encode the direction of the current block face, while the alpha component stores the layer parameter. The vertex shader uses the vertex position, block-face direction, viewpoint position, and virtual depth to calculate the position projected from the viewpoint onto a virtual sampling plane. The actual geometry of all 17 layers overlaps exactly, but the virtual sampling planes corresponding to the layers lie at different depths, producing multiple levels of parallax as the camera moves.

The virtual sampling position is then converted into two-dimensional coordinates according to the direction of the block face and scaled to Template:Frac of its original size. The coordinates are rotated by the rotation angle of the layer, then offset by 32p in the same direction. The time value supplied by the renderer is divided by 256 and added to the second texture coordinate, causing the starfield pattern to move continuously. All layers use the same time increment, while their different rotation angles and virtual depths produce different apparent directions of travel and degrees of parallax.

The time value supplied by the renderer increases in seconds, so the time offset increases by Template:Frac of a texture-coordinate unit per second. The parallax texture uses wrap addressing; with the camera position and other rendering parameters kept unchanged, the starfield animation returns to the same texture phase every 256 seconds.

The output color of an ordinary starfield layer is obtained by multiplying the color texture, parallax texture, layer brightness, and fog attenuation component-wise. If the layer parameter is p and the fog factor is f, the color of the layer is the component-wise product of the color texture, the parallax texture, 1-p, and 1-f.

The blend state causes the base layer to replace the existing color in the framebuffer, after which the 16 starfield layers are added successively. Different graphics backends may use different output alpha values and destination blend factors to produce the same color-compositing result.

The effect uses depth testing and depth writing, with the depth comparison function set to less than or equal. As all 17 layers of each effect use the same geometry and depth, each layer can pass the test at equal depth and take part in the final composition.

History

Java Edition

Template:Info needed section Template:HistoryTable

Table of visual changes

Parallax
Versions Template:Code Template:Code Changes
Beta 1.9 Prerelease 3
to
12w22a
File:Parallax Portal Starfield JE1.gif - Portal introduction
12w23a
to
1.8.9
File:Parallax Portal Starfield JE2.gif End Sky texture change
15w31a
to
15w32c
File:Parallax Gateway Starfield JE1.gif Gateway introduction
15w33a
to
1.9.4
- Gateway now camera-independent
16w20a
to
16w39c
File:Parallax Portal Starfield JE3.gif The starfield is darker and greener
Parallax starfield no longer exists from 16w40a onward
Fixed
Versions Template:Code Template:Code Changes
15w33a
to
1.9.4
- File:Fixed Gateway Starfield JE1.gif Fixed starfield added, used by end gateway
16w20a
to
16w39c
File:Fixed Gateway Starfield JE2.gif The starfield is darker and greener
16w40a
to
21w08b
File:Fixed Portal Starfield JE1.gif Portal now camera-independent
21w10a File:Fixed Portal Starfield JE2.gif File:Fixed Gateway Starfield JE3.gif Background now stretched instead of repeating, particle size increased
21w11a
to
present
File:Fixed Portal Starfield JE3.gif File:Fixed Gateway Starfield JE4.gif Particle size reverted
Blocks
Versions Template:Code Template:Code Changes
Beta 1.9 Prerelease 3
to
12w22a
File:End Portal JE2.gif Template:Tc Portal introduction
12w23a
to
1.8.9
File:End Portal JE3.gif Template:Tc End Sky texture change
15w31a
to
15w32c
File:End Gateway JE1.gif Gateway introduction
15w33a
to
1.9.4
File:End Gateway JE2.gif Gateway now camera-independent
16w20a
to
16w39c
File:End Portal JE4.gif File:End Gateway JE3.gif The starfield is darker and greener
16w40a
to
21w08b
File:End Portal JE5.gif Portal now camera-independent
21w10a File:End Portal JE6.gif File:End Gateway JE4.gif Background now stretched instead of repeating, particle size increased
21w11a
to
present
File:End Portal JE7.gif File:End Gateway JE5.gif Particle size reverted

Data changes

21w10a rendering changes

From 15w33aTemplate:Verify to 21w08b, the starfield effect was defined in the game's code. 21w10a introduced resource-pack-configurable core shaders, with the shader file Template:Code containing the starfield's definition.

Before

The background layer, rather than being a fixed background, was treated much more similarly to the starfield particle layers on top of it; it was scaled, tessellated, and would move over time. That is, the "layer" furthest back used Template:Code rather than Template:Code, but otherwise behaved as the Template:Code layers do, being rotated, repeated and gradually moving.

Rather than being explicitly defined, the set of colors used were generated using a fixed numeric seed (31100).Template:Info needed The same set of colors were generated on every session. End portals and end gateways used different color multipliers.Template:Info needed

Index Texture Velocity Template:Abbr Template:Abbr Color Used by
Template:Code Template:Code
0 Template:Code Template:Frac 20° 4.25 Template:Abbr Template:Tc Template:Tc
1 Template:Code Template:Frac 44° 4 Template:Abbr Template:Tc Template:Tc
2 Template:Code Template:Frac 72° 3.75 Template:Abbr Template:Tc Template:Tc
3 Template:Code Template:Frac 104° 3.5 Template:Abbr Template:Tc Template:Tc
4 Template:Code Template:Frac 140° 3.25 Template:Abbr Template:Tc Template:Tc
5 Template:Code Template:Frac 180° 3 Template:Abbr Template:Tc Template:Tc
6 Template:Code Template:Frac 224° 2.75 Template:Abbr Template:Tc Template:Tc
7 Template:Code Template:Frac 272° 2.5 Template:Abbr Template:Tc Template:Tc
8 Template:Code Template:Frac 324° 2.25 Template:Abbr Template:Tc Template:Tc
9 Template:Code Template:Frac 20° 2 Template:Abbr Template:Tc Template:Tc
10 Template:Code Template:Frac 80° 1.75 Template:Abbr Template:Tc Template:Tc
11 Template:Code Template:Frac 144° 1.5 Template:Abbr Template:Tc Template:Tc
12 Template:Code Template:Frac 212° 1.25 Template:Abbr Template:Tc Template:Tc
13 Template:Code Template:Frac 284° 1 Template:Abbr Template:Tc Template:Tc
14 Template:Code Template:Frac 0.75 Template:Abbr Template:Tc Template:Tc
15 Template:Code Template:Frac 80° 0.5 Template:Abbr Template:Tc Template:Tc
After

Template:Info needed

Comparison

For a 128×128 Template:Code which is completely white in the center, and has a one-pixel-thick red border around the edges, we get the following results (recolored to the input texture) for a 1024×1024 window:

21w11a value changes
Index Template:Abbr
21w10a 21w11a
0 4.25 8.5
1 4 8
2 3.75 7.5
3 3.5 7
4 3.25 6.5
5 3 6
6 2.75 5.5
7 2.5 5
8 2.25 4.5
9 2 4
10 1.75 3.5
11 1.5 3
12 1.25 2.5
13 1 2
14 0.75 1.5
Template:Abbr 0.5 1

Bedrock Edition

Template:HistoryTable

Table of visual differences

Host Template:Code Template:Code Notes
Windows 11
AMD Radeon RX 7800 XT
File:Starfield BE.gif All 16 colors are used
Kubuntu 24.04
AMD Radeon RX 7800 XT
File:Starfield (even colors only) BE.gif File:Starfield BE.gif End portals only use even colors

Legacy Console Edition

Template:Info needed section Template:HistoryTable

New Nintendo 3DS Edition

Template:HistoryTable

Notes

Template:Notelist

References

Template:Reflist

Navigation

Template:Navbox visuals