messing around with the beacon shader
This commit is contained in:
parent
8d6acdfef0
commit
336ca81adf
|
@ -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);
|
||||||
|
}
|
|
@ -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 ] }
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in a new issue