Add Recipe Book #2

Merged
Lea merged 24 commits from :recipe-book into master 2023-08-26 10:50:53 +00:00
2 changed files with 65 additions and 0 deletions
Showing only changes of commit 336ca81adf - Show all commits

View file

@ -0,0 +1,39 @@
#version 150
#moj_import <fog.glsl>
uniform sampler2D Sampler0;
uniform mat4 ProjMat;
uniform vec4 ColorModulator;
uniform float FogStart;
uniform float FogEnd;
uniform vec4 FogColor;
uniform vec4 Pink;
in vec4 vertexColor;
in vec2 texCoord0;
out vec4 fragColor;
void main() {
vec4 color = texture(Sampler0, texCoord0);
color *= vertexColor * ColorModulator;
float fragmentDistance = -ProjMat[3].z / ((gl_FragCoord.z) * -2.0 + 1.0 - ProjMat[2].z);
float nuts = 0.0;
/* this is an excuse for me to play around with shaders but i guess it also looks kinda cool */
if (fragmentDistance > 10) {
nuts = 1.0;
} else {
nuts = fragmentDistance / 10;
}
nuts /= 3;
nuts += 0.25;
color.rgb = mix(color.rgb, Pink.rgb, nuts);
fragColor = linear_fog(color, fragmentDistance, FogStart, FogEnd, FogColor);
}

View file

@ -0,0 +1,26 @@
{
"blend": {
"func": "add",
"srcrgb": "srcalpha",
"dstrgb": "1-srcalpha"
},
"vertex": "rendertype_beacon_beam",
"fragment": "rendertype_beacon_beam",
"attributes": [
"Position",
"Color",
"UV0"
],
"samplers": [
{ "name": "Sampler0" }
],
"uniforms": [
{ "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] },
{ "name": "Pink", "type": "float", "count": 4, "values": [ 0.957, 0.722, 0.859, 1 ] }
]
}