mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-25 19:16:52 +01:00
[BotW] Update night star shader
With Cemu 1.15.12 's gl_PointCoord support, night stars now have proper (varying) alpha value. Should be no need for workaround anymore, just scale its size accordingly.
This commit is contained in:
parent
3c270be471
commit
01f7fa002f
@ -1,22 +1,34 @@
|
||||
#version 420
|
||||
#extension GL_ARB_texture_gather : enable
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_packing : enable
|
||||
// shader 01ba1a725af9facf
|
||||
// Used for: Creating randomly sized stars (only on > Cemu 1.12.1) like the original game has.
|
||||
// Shader made by Kiri
|
||||
const float resScale = $width/720;
|
||||
#ifdef VULKAN
|
||||
#define gl_VertexID gl_VertexIndex
|
||||
#define gl_InstanceID gl_InstanceIndex
|
||||
#define SET_POSITION(_v) gl_Position = _v; gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0
|
||||
#else
|
||||
#define SET_POSITION(_v) gl_Position = _v
|
||||
#endif
|
||||
|
||||
layout(binding = 1, std140) uniform uniformBlockVS1
|
||||
const float resScale = $height/720.0;
|
||||
|
||||
// Night star (size)
|
||||
|
||||
// shader 01ba1a725afa0b96
|
||||
layout(binding = 1, std140)
|
||||
uniform uniformBlockVS1
|
||||
{
|
||||
vec4 uf_blockVS1[1024];
|
||||
};
|
||||
|
||||
layout(binding = 2, std140) uniform uniformBlockVS2
|
||||
|
||||
layout(binding = 2, std140)
|
||||
uniform uniformBlockVS2
|
||||
{
|
||||
vec4 uf_blockVS2[1024];
|
||||
};
|
||||
|
||||
uniform vec2 uf_windowSpaceToClipSpaceTransform;
|
||||
|
||||
layout(location = 0) in uvec4 attrDataSem0;
|
||||
out gl_PerVertex
|
||||
{
|
||||
@ -65,12 +77,8 @@ R0i.w = 0x3f800000;
|
||||
R0i.y = PV0i.z + int(1);
|
||||
R3i.xyzw = floatBitsToInt(uf_blockVS1[R0i.z].xyzw);
|
||||
R2i.xyzw = floatBitsToInt(uf_blockVS1[R0i.y].xyzw);
|
||||
|
||||
|
||||
// export
|
||||
gl_PointSize = 0.5+(float(R2i.y%5)/4.0)*resScale; // Randomize size of the stars. Relies on GL_VERTEX_POINT_SIZE, which is only enabled above Cemu 1.12.1.
|
||||
|
||||
|
||||
gl_PointSize = intBitsToFloat(R1i.x) * resScale;
|
||||
// 0
|
||||
backupReg0i = R0i.w;
|
||||
backupReg1i = R2i.w;
|
||||
@ -108,7 +116,7 @@ PV1i.z = tempi.x;
|
||||
PV1i.w = tempi.x;
|
||||
R1i.w = tempi.x;
|
||||
// export
|
||||
gl_Position = vec4(intBitsToFloat(R1i.x), intBitsToFloat(R1i.y), intBitsToFloat(R1i.z), intBitsToFloat(R1i.w));
|
||||
SET_POSITION(vec4(intBitsToFloat(R1i.x), intBitsToFloat(R1i.y), intBitsToFloat(R1i.z), intBitsToFloat(R1i.w)));
|
||||
// export
|
||||
passParameterSem1 = vec4(intBitsToFloat(R2i.x), intBitsToFloat(R2i.y), intBitsToFloat(R2i.z), intBitsToFloat(R2i.w));
|
||||
// export
|
@ -1,95 +0,0 @@
|
||||
#version 420
|
||||
#extension GL_ARB_texture_gather : enable
|
||||
// shader 5307d14d04250e61
|
||||
// Used for: Make stars visible
|
||||
|
||||
uniform ivec4 uf_remappedPS[4];
|
||||
layout(location = 0) in vec4 passParameterSem1;
|
||||
layout(location = 1) in vec4 passParameterSem2;
|
||||
layout(location = 0) out vec4 passPixelColor0;
|
||||
uniform vec2 uf_fragCoordScale;
|
||||
int clampFI32(int v)
|
||||
{
|
||||
if( v == 0x7FFFFFFF )
|
||||
return floatBitsToInt(1.0);
|
||||
else if( v == 0xFFFFFFFF )
|
||||
return floatBitsToInt(0.0);
|
||||
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
|
||||
}
|
||||
float mul_nonIEEE(float a, float b){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; }
|
||||
void main()
|
||||
{
|
||||
vec4 R0f = vec4(0.0);
|
||||
vec4 R1f = vec4(0.0);
|
||||
vec4 R2f = vec4(0.0);
|
||||
vec4 R123f = vec4(0.0);
|
||||
vec4 R125f = vec4(0.0);
|
||||
vec4 R126f = vec4(0.0);
|
||||
vec4 R127f = vec4(0.0);
|
||||
float backupReg0f, backupReg1f, backupReg2f, backupReg3f, backupReg4f;
|
||||
vec4 PV0f = vec4(0.0), PV1f = vec4(0.0);
|
||||
float PS0f = 0.0, PS1f = 0.0;
|
||||
vec4 tempf = vec4(0.0);
|
||||
float tempResultf;
|
||||
int tempResulti;
|
||||
ivec4 ARi = ivec4(0);
|
||||
bool predResult = true;
|
||||
vec3 cubeMapSTM;
|
||||
int cubeMapFaceId;
|
||||
R0f = passParameterSem1;
|
||||
R1f = passParameterSem2;
|
||||
// 0
|
||||
tempf.x = dot(vec4(R1f.x,R1f.y,R1f.z,-0.0),vec4(intBitsToFloat(uf_remappedPS[0].x),intBitsToFloat(uf_remappedPS[0].y),intBitsToFloat(uf_remappedPS[0].z),0.0));
|
||||
PV0f.x = tempf.x;
|
||||
PV0f.y = tempf.x;
|
||||
PV0f.z = tempf.x;
|
||||
PV0f.w = tempf.x;
|
||||
R127f.y = tempf.x;
|
||||
PS0f = abs(R2f.z);
|
||||
// 1
|
||||
backupReg0f = R0f.y;
|
||||
R123f.x = (PS0f * 2.0 + -(1.0));
|
||||
PV1f.x = R123f.x;
|
||||
PV1f.y = PV0f.x;
|
||||
PV1f.y = clamp(PV1f.y, 0.0, 1.0);
|
||||
R127f.z = mul_nonIEEE(R0f.x, intBitsToFloat(uf_remappedPS[1].w));
|
||||
PV1f.w = abs(R2f.w);
|
||||
R125f.w = mul_nonIEEE(backupReg0f, intBitsToFloat(uf_remappedPS[1].w));
|
||||
PS1f = R125f.w;
|
||||
// 2
|
||||
backupReg0f = R127f.y;
|
||||
PV0f.x = mul_nonIEEE(PV1f.x, PV1f.x);
|
||||
R127f.y = mul_nonIEEE(R0f.z, intBitsToFloat(uf_remappedPS[1].w));
|
||||
PV0f.y = R127f.y;
|
||||
R123f.z = (PV1f.w * 2.0 + -(1.0));
|
||||
PV0f.z = R123f.z;
|
||||
R127f.w = (mul_nonIEEE(backupReg0f,intBitsToFloat(uf_remappedPS[1].x)) + intBitsToFloat(uf_remappedPS[1].y));
|
||||
R127f.w = clamp(R127f.w, 0.0, 1.0);
|
||||
tempResultf = log2(PV1f.y);
|
||||
if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F;
|
||||
PS0f = tempResultf;
|
||||
// 3
|
||||
R126f.x = -(PV0f.y) + intBitsToFloat(uf_remappedPS[2].z);
|
||||
PV1f.y = mul_nonIEEE(intBitsToFloat(uf_remappedPS[3].y), PS0f);
|
||||
R123f.z = (mul_nonIEEE(PV0f.z,PV0f.z) + PV0f.x);
|
||||
PV1f.z = R123f.z;
|
||||
R126f.w = -(intBitsToFloat(uf_remappedPS[2].w)) + 0.0;
|
||||
// 4
|
||||
R127f.x = -(R127f.z) + intBitsToFloat(uf_remappedPS[2].x);
|
||||
PV0f.y = -(PV1f.z) + 1.0;
|
||||
PV0f.y = clamp(PV0f.y, 0.0, 1.0);
|
||||
R126f.z = -(R125f.w) + intBitsToFloat(uf_remappedPS[2].y);
|
||||
PS0f = exp2(PV1f.y);
|
||||
// 5
|
||||
PV1f.x = mul_nonIEEE(R127f.w, PV0f.y);
|
||||
R123f.z = (mul_nonIEEE(R126f.w,PS0f) + intBitsToFloat(uf_remappedPS[2].w));
|
||||
PV1f.z = R123f.z;
|
||||
// 6
|
||||
backupReg0f = R0f.w;
|
||||
R0f.x = (mul_nonIEEE(R127f.x,PV1f.z) + R127f.z);
|
||||
R0f.y = (mul_nonIEEE(R126f.z,PV1f.z) + R125f.w);
|
||||
R0f.z = (mul_nonIEEE(R126f.x,PV1f.z) + R127f.y);
|
||||
R0f.w = mul_nonIEEE(backupReg0f, PV1f.x);
|
||||
// export
|
||||
passPixelColor0 = vec4(R0f.x, R0f.y, R0f.z, 1.0);
|
||||
}
|
Loading…
Reference in New Issue
Block a user