Wikia

Dax's Wiki

Editing Shaders (Shaders)

Comments11
31pages on
this wiki

Shaders Edit

The active shaders should be located in the contents/files/shaders folder. There are four shaders that can be used. The outputs of the base shaders are sent to the final shaders in the form of textures.

base.vsh :D Edit

Structures Edit

lightSource Edit

struct lightSource {
    int itemId;
    float magnitude;
    vec4 specular;
};

Attributes Edit

vec4 mc_Entity Edit

mc_Entity.x Edit

The x component of mc_Entity is the entity id. Currently this is only set for blocks. In future updates it will be set for items and mobs. It will have a value of -1.0 for unknown entities.

mc_Entity.y Edit

The y component of mc_Entity contains information regarding lighting. It is currently calculated as lightValue * 16 + brightness. In future updates other additions may be made to this (such as the sides exposed to the sky).

In the shaders, lightValue can be obtained by mod(floor(mc_Entity.y / 16.0), 16.0). brightness can be obtained by mod(mc_Entity.y, 16.0).

mc_Entity.z Edit

Reserved

mc_Entity.w Edit

Reserved

Uniforms Edit

There are several uniforms available to the shaders.

Global Uniforms Edit

float displayWidth Edit

The width of the display.

float displayHeight Edit

The height of the display.

float aspectRatio Edit

The aspect ratio of the display (displayWidth / displayHeight).

float near Edit

The near viewing plane.

float far Edit

The far viewing plane.

int fogMode Edit

The current fog mode. The possible values are as follows:

const int GL_LINEAR = 9729;
const int GL_EXP = 2048;

float sunVector Edit

The position of the sun in eye coordinates.

float moonVector Edit

The position of the moon in eye coordinates.

int worldTime Edit

The world time of day (ranges from 0 to 23999).

lightSource heldLight Edit

The properties of the item currently being held.

Base Uniforms Edit

sampler2D sampler0 Edit

The texture of the current element.

sampler2D sampler1 Edit

The normals and height-map for the current texture (loaded from XXXXX_nh.png). At the moment this is only accurate when renderType is equal to RENDER_TYPE_TERRAIN.

Final Uniforms Edit

sampler2D sampler0 Edit

The rendered scene.

sampler2D sampler1 Edit

The depth of the rendered scene, excluding the player's arm.

sampler2D sampler2 Edit

The depth of the player's arm.

Tips Edit

Anti-Aliasing Edit

To avoid anti-aliasing on polygon edges, texture coordinates should be declared as centroid in the base vertex and fragment shaders.

Advertisement | Your ad here

Around Wikia's network

Random Wiki