You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The world shader is the shader program used for the world render stage, which is responsible for drawing units, buildings, ambience, and everything else that is displayed by a sprite. Making it configurable gives us some leeway in how these objects are rendered.
Our planned approach to configuration is to allow encoding of "commands" in the alpha channels of pixels in a texture. In short, every even alpha value can represent a "command", which means the pixel should be processed using custom shader code. Odd alpha values are drawn without any processing. This gives us 128 possible commands to use in the shader.
The shader code that runs when such a command is encountered should be configurable by modders, e.g. to draw special pixels like player color or outlines. The final world shader would be assembled from the code snippets for each command individual command. These snippets would probably be embedded in a simple switch statement in the GLSL code like this:
# get command
int alpha =int(round(tex_val.a *255));
switch (alpha) {
case254:
# command 254
col =vec4(1.0f, 0.0f, 0.0f, 1.0f);
break;
case252:
# command 252
col =vec4(0.0f, 1.0f, 0.0f, 1.0f);
break;
default:
# no command
col = tex_val;
break;
}
Tasks:
Add method to define custom shader code for commands
Dynamically assemble world shader from template + command code
(later) Allow passing data to shader in uniforms for use in custom shader code
The text was updated successfully, but these errors were encountered:
The world shader is the shader program used for the world render stage, which is responsible for drawing units, buildings, ambience, and everything else that is displayed by a sprite. Making it configurable gives us some leeway in how these objects are rendered.
Our planned approach to configuration is to allow encoding of "commands" in the alpha channels of pixels in a texture. In short, every even alpha value can represent a "command", which means the pixel should be processed using custom shader code. Odd alpha values are drawn without any processing. This gives us 128 possible commands to use in the shader.
The shader code that runs when such a command is encountered should be configurable by modders, e.g. to draw special pixels like player color or outlines. The final world shader would be assembled from the code snippets for each command individual command. These snippets would probably be embedded in a simple switch statement in the GLSL code like this:
Tasks:
The text was updated successfully, but these errors were encountered: