Skip to content

Instantly share code, notes, and snippets.

@SmokeyStack
Created August 9, 2024 15:12
Show Gist options
  • Save SmokeyStack/3a8f2a2409be17dd6e765df0ca588201 to your computer and use it in GitHub Desktop.
Save SmokeyStack/3a8f2a2409be17dd6e765df0ca588201 to your computer and use it in GitHub Desktop.

Sourced from @veka. from the Bedrock Add-Ons discord.

Ok so here are the facts:

  1. Material format was changed multiple times in previous previews - they added new properties which aren't being used anywhere in vanilla. Why would they add them and never use? And one of the added unused properties allows to overwrite texture properties through materials that are usually supplied by the game directly, why would they add that overwrite property to materials if they can (and always do) just set it from the game directly?
  2. Some time ago, a new function appeared in shader source code
struct StandardSurfaceOutput {
    vec3 Albedo;
    float Alpha;
    float Metallic;
    float Roughness;
    float Occlusion;
    float Emissive;
    float Subsurface;
    vec3 AmbientLight;
    vec3 ViewSpaceNormal;
};
void StandardTemplate_CustomSurfaceShaderEntryIdentity(vec2 uv, vec3 worldPosition, inout StandardSurfaceOutput surfaceOutput) {}

This function is present in a lot of fragment shaders, however currently it's completely empty and does nothing. It sure does have an interesting name tho, doesn't it.

  1. And now we have something called shadersdk which is supposed to be some kind of online material compiler service. Online build server provided by Mojang is the only solution I can think of for compiling shaders for platforms with proprietary shader SDKs like PlayStation and Switch.

My theory, based on the facts, is that it will be official shader support, but quite limited. We will be able to modify material.bin files by inserting our own shader code, and it all will be compiled on a remote server (but I hope they will also open source their compiler, without proprietary parts of course, so that we can use it locally or for unofficial 3rd party shaders that fully modify all source code). We will be able to load material.bin files from resource packs, which is huge. Shader capabilities will be (at least initially) very limited, currently it seems like we'd only be able to modify "inputs" for vanilla shader logic in fragment shader, such as albedo, alpha, MERS etc, but we wouldn't be able to change the underlying logic or calculations used in vanilla, which means you can't e.g. completely rewrite deferred, but you could add some specific small new features to it, like procedural puddles, rust or stylization effects. The scope of such shaders will be limited to VFX (e.g. flashlight, toon shading, dithering, color quantization) and utility shaders (e.g. chunk borders) But remember, this is just a theory, a game shader theory. I don't currently know for sure if this is how it's going to work, and I might've gotten something (or everything) wrong in my analysis.

@SuperLlama88888
Copy link

W mojang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment