mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-26 18:22:33 +08:00
add strength slider for on-fire distortion effect. revisit large wave displacement and improve it a little
This commit is contained in:
@ -72,7 +72,7 @@ varying vec4 normalMat;
|
||||
varying vec3 binormal;
|
||||
varying vec3 flatnormal;
|
||||
#ifdef LARGE_WAVE_DISPLACEMENT
|
||||
varying vec3 shitnormal;
|
||||
varying vec3 largeWaveDisplacementNormal;
|
||||
#endif
|
||||
|
||||
uniform vec3 sunVec;
|
||||
@ -385,7 +385,6 @@ void Emission(
|
||||
|
||||
uniform vec3 eyePosition;
|
||||
|
||||
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
@ -487,28 +486,27 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
wave.normal = -wave.normal;
|
||||
}
|
||||
|
||||
normal = mix(normalize(gl_NormalMatrix * wave.normal), normal, PHYSICS_OCEAN_TRANSITION);
|
||||
normal = mix(normalize(gl_NormalMatrix * wave.normal), normal, PHYSICS_OCEAN_TRANSITION);
|
||||
Albedo = mix(Albedo, vec3(1.0), wave.foam);
|
||||
gl_FragData[0].a = mix(1.0/255.0, 1.0, wave.foam);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LARGE_WAVE_DISPLACEMENT
|
||||
if (isWater){
|
||||
normal = viewToWorld(normal);
|
||||
normal.xz = shitnormal.xy;
|
||||
normal = worldToView(normal);
|
||||
}
|
||||
#endif
|
||||
|
||||
vec3 worldSpaceNormal = viewToWorld(normal).xyz;
|
||||
vec2 TangentNormal = vec2(0); // for refractions
|
||||
|
||||
vec3 tangent2 = normalize(cross(tangent.rgb,normal)*tangent.w);
|
||||
#ifdef LARGE_WAVE_DISPLACEMENT
|
||||
if (isWater){
|
||||
normal = largeWaveDisplacementNormal;
|
||||
}
|
||||
#endif
|
||||
|
||||
vec3 tangent2 = normalize(cross(tangent.rgb, normal)*tangent.w);
|
||||
mat3 tbnMatrix = mat3(tangent.x, tangent2.x, normal.x,
|
||||
tangent.y, tangent2.y, normal.y,
|
||||
tangent.z, tangent2.z, normal.z);
|
||||
|
||||
|
||||
vec3 NormalTex = vec3(texture2D(normals, lmtexcoord.xy, Texture_MipMap_Bias).xy,0.0);
|
||||
NormalTex.xy = NormalTex.xy*2.0-1.0;
|
||||
NormalTex.z = clamp(sqrt(1.0 - dot(NormalTex.xy, NormalTex.xy)),0.0,1.0);
|
||||
@ -776,7 +774,10 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
|
||||
|
||||
bool WATER = texture2D(colortex7, gl_FragCoord.xy*texelSize).a > 0.0 && length(feetPlayerPos) > clamp(far-16*4, 16, maxOverdrawDistance) && texture2D(depthtex1, gl_FragCoord.xy*texelSize).x >= 1.0;
|
||||
|
||||
if(WATER) gl_FragData[0].a = 0.0;
|
||||
if(WATER) {
|
||||
gl_FragData[0].a = 0.0;
|
||||
MATERIALS = 0.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
gl_FragData[1] = vec4(Albedo, MATERIALS);
|
||||
|
@ -37,7 +37,7 @@ varying vec4 tangent;
|
||||
varying vec3 flatnormal;
|
||||
|
||||
#ifdef LARGE_WAVE_DISPLACEMENT
|
||||
varying vec3 shitnormal;
|
||||
varying vec3 largeWaveDisplacementNormal;
|
||||
#endif
|
||||
|
||||
uniform mat4 gbufferModelViewInverse;
|
||||
@ -87,8 +87,10 @@ vec4 toClipSpace3(vec3 viewSpacePosition) {
|
||||
|
||||
|
||||
float getWave (vec3 pos, float range){
|
||||
return pow(1.0-texture2D(noisetex, (pos.xz + frameTimeCounter * WATER_WAVE_SPEED)/150.0).b,2) * WATER_WAVE_STRENGTH / range;
|
||||
// return pow(1.0-texture2D(noisetex, (pos.xz + frameTimeCounter * WATER_WAVE_SPEED)/150.0).b,2.0) * WATER_WAVE_STRENGTH * range;
|
||||
return pow(1.0-texture2D(noisetex, (pos.xz + frameTimeCounter * WATER_WAVE_SPEED)/125.0).r,5.0) * WATER_WAVE_STRENGTH * range;
|
||||
}
|
||||
|
||||
vec3 getWaveNormal(vec3 posxz, float range){
|
||||
|
||||
float deltaPos = 0.5;
|
||||
@ -100,12 +102,13 @@ vec3 getWaveNormal(vec3 posxz, float range){
|
||||
float h3 = getWave(coord - vec3(0.0,0.0,deltaPos),range);
|
||||
|
||||
|
||||
float xDelta = (h1-h0)/deltaPos*1.5;
|
||||
float yDelta = (h3-h0)/deltaPos*1.5;
|
||||
float xDelta = (h1-h0)/deltaPos * 1.5;
|
||||
float yDelta = (h3-h0)/deltaPos * 1.5;
|
||||
|
||||
vec3 wave = normalize(vec3(xDelta, yDelta, 1.0-pow(abs(xDelta+yDelta),2.0)));
|
||||
vec3 wave = normalize(vec3(xDelta, yDelta,1.0-pow(abs(xDelta+yDelta),2.0)));
|
||||
|
||||
return wave;
|
||||
|
||||
}
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
//////////////////////////////VOID MAIN//////////////////////////////
|
||||
@ -133,25 +136,28 @@ void main() {
|
||||
vec2 lmcoord = gl_MultiTexCoord1.xy / 240.0;
|
||||
lmtexcoord.zw = lmcoord;
|
||||
|
||||
|
||||
|
||||
#ifdef LARGE_WAVE_DISPLACEMENT
|
||||
if(mc_Entity.x == 8.0) {
|
||||
vec3 displacedPos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz + cameraPosition;
|
||||
|
||||
vec3 playerPos = mat3(gbufferModelViewInverse) * position.xyz;
|
||||
|
||||
#ifdef DISTANT_HORIZONS
|
||||
float range = min(1.0 + pow(length(displacedPos - cameraPosition) / min(far,256.0),2.0), 256.0);
|
||||
float range = pow(1-pow(1-clamp(1.0 - length(playerPos) / far, 0.0,1.0),3.0),3.0);
|
||||
#else
|
||||
float range = min(1.0 + pow(length(displacedPos - cameraPosition) / 256,2.0), 256.0);
|
||||
float range = min(1.0 + pow(length(playerPos) / 256,2.0), 256.0);
|
||||
#endif
|
||||
|
||||
displacedPos.y -= (1.0-getWave(displacedPos, range)) * 0.5 - 0.2;
|
||||
shitnormal = getWaveNormal(displacedPos, range);
|
||||
position = mat3(gbufferModelView) * (displacedPos - cameraPosition) + gbufferModelView[3].xyz;
|
||||
vec4 displacedVertex = vec4(gl_Vertex.x, gl_Vertex.y + (getWave(gl_Vertex.xyz + cameraPosition, range)*0.6-0.5), gl_Vertex.z, gl_Vertex.w);
|
||||
position = mat3(gl_ModelViewMatrix) * vec3(displacedVertex) + gl_ModelViewMatrix[3].xyz;
|
||||
|
||||
playerPos = mat3(gbufferModelViewInverse) * position.xyz;
|
||||
largeWaveDisplacementNormal = getWaveNormal(playerPos + cameraPosition, range);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
// vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
|
||||
vec3 worldpos = mat3(gbufferModelViewInverse) * position + gbufferModelViewInverse[3].xyz;
|
||||
|
||||
#ifdef PLANET_CURVATURE
|
||||
float curvature = length(worldpos) / (16*8);
|
||||
worldpos.y -= curvature*curvature * CURVATURE_AMOUNT;
|
||||
@ -192,24 +198,24 @@ void main() {
|
||||
if (entityId == 1600) NAMETAG = 1;
|
||||
#endif
|
||||
|
||||
tangent = vec4(normalize(gl_NormalMatrix *at_tangent.rgb),at_tangent.w);
|
||||
|
||||
normalMat = vec4(normalize(gl_NormalMatrix * gl_Normal), 1.0);
|
||||
normalMat.a = mat;
|
||||
|
||||
vec3 tangent2 = normalize( gl_NormalMatrix *at_tangent.rgb);
|
||||
binormal = normalize(cross(tangent2.rgb,normalMat.xyz)*at_tangent.w);
|
||||
tangent = vec4(normalize(gl_NormalMatrix * at_tangent.rgb),at_tangent.w);
|
||||
normalMat = vec4(normalize(gl_NormalMatrix * gl_Normal), mat);
|
||||
binormal = normalize(cross(tangent.rgb,normalMat.xyz)*at_tangent.w);
|
||||
mat3 tbnMatrix = mat3(tangent.x, binormal.x, normalMat.x,
|
||||
tangent.y, binormal.y, normalMat.y,
|
||||
tangent.z, binormal.z, normalMat.z);
|
||||
|
||||
mat3 tbnMatrix = mat3(tangent2.x, binormal.x, normalMat.x,
|
||||
tangent2.y, binormal.y, normalMat.y,
|
||||
tangent2.z, binormal.z, normalMat.z);
|
||||
|
||||
if(mc_Entity.x == 8.0) {
|
||||
largeWaveDisplacementNormal = normalize(largeWaveDisplacementNormal * tbnMatrix);
|
||||
}else{
|
||||
largeWaveDisplacementNormal = normalMat.xyz;
|
||||
}
|
||||
flatnormal = normalMat.xyz;
|
||||
|
||||
viewVector = position.xyz;
|
||||
// viewVector = (gl_ModelViewMatrix * gl_Vertex).xyz;
|
||||
viewVector = normalize(tbnMatrix * viewVector);
|
||||
|
||||
viewVector = normalize(tbnMatrix * viewVector);
|
||||
|
||||
color = vec4(gl_Color.rgb, 1.0);
|
||||
|
||||
|
@ -89,7 +89,7 @@ void applyGameplayEffects(inout vec3 color, in vec2 texcoord, float noise){
|
||||
|
||||
vec2 UV = zoomin;
|
||||
|
||||
float flameDistort = texture2D(noisetex, UV * vec2(aspectRatio,1.0) - vec2(0.0,frameTimeCounter*0.3)).b * clamp(-texcoord.y*0.3+0.3,0.0,1.0) * 0.75 * exitLava;
|
||||
float flameDistort = texture2D(noisetex, UV * vec2(aspectRatio,1.0) - vec2(0.0,frameTimeCounter*0.3)).b * clamp(-texcoord.y*0.3+0.3,0.0,1.0) * ON_FIRE_DISTORT_EFFECT_STRENGTH * exitLava;
|
||||
|
||||
distortmask = max(distortmask, flameDistort);
|
||||
}
|
||||
|
@ -617,6 +617,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
|
||||
|
||||
#define WATER_ON_CAMERA_EFFECT
|
||||
#define ON_FIRE_DISTORT_EFFECT
|
||||
#define ON_FIRE_DISTORT_EFFECT_STRENGTH 0.7 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0]
|
||||
|
||||
#ifdef LOW_HEALTH_EFFECT
|
||||
#endif
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user