Skip to content

Commit

Permalink
Copy shader code to vulkan shader
Browse files Browse the repository at this point in the history
  • Loading branch information
Monsterovich committed Oct 28, 2024
1 parent 3b54ccc commit 5ebe62f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 16 additions & 1 deletion data/base/shaders/vk/tcmask_instanced.frag
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ layout(location = 0) out vec4 FragColor;

#include "pointlights.glsl"

float random(vec2 uv)
{
return fract(sin(dot(uv.xy, vec2(12.9898, 78.233))) * 43758.5453123);
}

float getShadowMapDepthComp(vec2 base_uv, float u, float v, vec2 shadowMapSizeInv, int cascadeIndex, float z)
{
vec2 uv = base_uv + vec2(u, v) * shadowMapSizeInv;
Expand Down Expand Up @@ -381,5 +386,15 @@ void main()
fragColour = mix(fragColour, vec4(fogColor.xyz, fragColour.w), fogFactor);
}

FragColor = fragColour;
if (shieldEffect == 1)
{
float cycle = 0.66 + 0.66 * graphicsCycle;
vec3 col = vec3(random(vec2(fragColour.x * cycle, fragColour.y * cycle)));
col.b *= 1.5;
FragColor = vec4(col, fragColour.a / 6.0);
}
else
{
FragColor = fragColour;
}
}
1 change: 1 addition & 0 deletions data/base/shaders/vk/tcmask_instanced.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ layout(std140, set = 1, binding = 0) uniform meshuniforms
int normalmap;
int specularmap;
int hasTangents;
int shieldEffect;
};

0 comments on commit 5ebe62f

Please sign in to comment.