=============== HOW TO MAKE FUNCTIONAL CUSTOM SCENE CONTROLLER PARAMETERS ===============
THERE ARE 2 FILES YOU NEED TO OPEN INSIDE OF THE SHADERPACK FOLDER AS TO OPERATE WITHIN
- the "shaders.properties" file located in shaderpacks/bliss/shaders/shaders.properties
- the "scene_controller.glsl" file located in shaderpacks/bliss/shaders/lib/scene_controller.glsl (you are already in it reading its contents)
you can create a custom configuration of parameters that appear in specific circumstances within minecraft.
to do this, you first need to know when you are in a specific circumstance.
you need to create "triggers", which have 2 states, a true and a false state. these are known as "boolean" variables
here is a step by step process of how to create and use your own custom uniform "trigger", and use it to activate your own parameters in the scene controller.
------------- STEP 1 -------------
create a "custom uniform". it should be a boolean value that returns as true or false.
these are created and named in the "shaders.properties" file
take note of writing style and syntax or errors will happen
examples:
blank slates for syntax clarity
uniform.bool.blankBool = if(VALUE <is greater/less than, or equal to> ANOTHER_VALUE)
there are many things you can detect (this is by no means a complete list, links to the iris documentation of what you can detect are linked below)
-if it is raining/thunderstorming (snowing and raining are one in the same here sadly)
-what biome the player is standing in
-the torch/sky light level the player is standing in
-the position in world coordinates the player is standing in
-if the player is above or under water/lava/powderedsnow
-if the player has above or below specific health/armor/hunger values
-if the player has nightvision/darkness/blindness/invisibility (theres only a few potion status effects you can detect)
-if the player is on fire or not
documentation for creating custom uniforms in shaders.properties https://shaders.properties/current/reference/shadersproperties/custom_uniforms/
documentation for player status related uniforms https://shaders.properties/current/reference/uniforms/status/
documentation for player position/camera related uniforms https://shaders.properties/current/reference/uniforms/camera/
------------- STEP 2 -------------
declare/call the variable in the "scene_controller.glsl" file
this is required to make use of the custom uniform you made in the shader.properties file
take note of writing style and syntax or errors will happen
example:
uniform bool nameWhateverYouWant_isExampleBool1;
uniform bool nameWhateverYouWant_isExampleBool2;
uniform bool nameWhateverYouWant_isExampleBool3;
------------- STEP 3 -------------
use the custom uniform
in the scene_controller.glsl file, within the applySceneControllerParameters() function, there is a designated area.
in that area, you will check if the custom uniforms you have made are true or false or "triggered", and if any are true, make the parameters equal whatever values you want.
take note of writing style and syntax or errors will happen
example:
blank slate for syntax clarity
if( <arguements go here> ){
<what runs does when the arguement is true>;
}
if( nameWhateverYouWant_isExampleBool1 ){
smallCumulusCoverage = 1.0;
smallCumulusDensity = 0.5;
fogColor = vec3(1.0, 0.0, 0.0);
}
if( nameWhateverYouWant_isExampleBool2 ){
smallCumulusCoverage = 0.0;
smallCumulusDensity = 0.2;
fogColor = vec3(1.0, 1.0, 1.0);
}
if( nameWhateverYouWant_isExampleBool3 ){
smallCumulusCoverage = 0.0;
smallCumulusDensity = 0.2;
fogColor = vec3(1.0, 1.0, 1.0);
}
for color picking, the shader is mixing RGB values together. the values are in the 0.0 to 1.0 range instead of 0.0 to 255.0
-use of semicolons ; (they should be a stopper at the end-point of EVERY line of code but only in scene_controller.glsl. DO NOT use them like that in shaders.propertes, or it will error)
-use of brackets ()
-use of other brackets {}
=============== IMPORTANT NOTES ===============
different custom uniforms SHOULD NOT be allowed to return true at the same times, otherwise they will overwrite eachother in order of what is done last, reading from the top of the file to the bottom.
example:
if you make a custom uniform that returns true if the player is in the swamp, and a second different custom uniform that returns true when a player is above the Y coord of 40
if( isInSwampBiome ){
smallCumulusCoverage = 1.0;
smallCumulusDensity = 0.5;
}
if( isAboveYCoord ){
smallCumulusCoverage = 0.2;
smallCumulusDensity = 0.1;
}
THIS WILL CONFLICT if you are at the same time in a swamp, and above Y coord 40.
in this case, isAboveYCoord's settings wins and will overwrite isInSwampBiome's settings.
this will not cause an error or warning, its just how the math works and how the shader compiler reads the code.
YOU CANNOT ADD NEW PARAMETERS TO CONTROL, YOU ARE ONLY ABLE TO CONTROL PRE-EXISTING ONES
BECAUSE ADDING NEW ONES IS ALOT MORE COMPLEX AND REQUIRES KNOWING HOW TO CODE IN GLSL AND KNOWLEDGE OF HOW THE SHADER IS DESIGNED
//=============== EVERYTHING BELOW HERE IS NOT FOR CUSTOM SCENE CONTROLLER STUFF AND SHOULD NOT BE MODIFIED UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING ===============
// write various parameters within singular pixels of a texture, which is a non-clearing buffer reprojecting the previous frame of itself, onto itself.
// this allows smooth interpolation over time from any old parameter value, to any new parameter value.
// read in vertex stage of post processing passes (deferred, composite), so it only runs on 4 vertices
// pass to fragment stage for use.
// the parameters are stored as such:
// smallCumulus = (coverage, density)
// largeCumulus = (coverage, density)
// altostratus = (coverage, density)
// fog = (uniform fog density, cloudy fog density)
// ... and more, eventually
flat varying struct sceneController {
vec2 smallCumulus;
vec2 largeCumulus;
vec2 altostratus;
vec2 fog;
} parameters;
vec3 writeSceneControllerParameters(
vec2 uv,
vec2 smallCumulus,
vec2 largeCumulus,
vec2 altostratus,
vec2 fog
){
// in colortex4, data is written in a 3x3 pixel area from (1,1) to (3,3)
// avoiding use of any variation of (0,0) to avoid weird textture wrapping issues
// 4th compnent/alpha is storing 1/4 res depth so i cant store there lol