generated from GlennFolker/MindustryModTemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commiting to not lose progress Again Solid colors 'Proper' bubbling atmOSPHEREEEE TODO probably raymarch the accretion disk... Simplify. A lot. Ray-marching initialization I'll just... not make the accretion disk. Skybox Pushing
- Loading branch information
1 parent
01fad6e
commit b9509b8
Showing
41 changed files
with
659 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
in vec2 v_texCoords; | ||
|
||
out vec4 fragColor; | ||
|
||
uniform sampler2D u_src; | ||
uniform sampler2D u_srcDepth; | ||
uniform sampler2D u_ref; | ||
|
||
void main(){ | ||
float srcDepth = texture(u_srcDepth, v_texCoords).r; | ||
float dstDepth = texture(u_ref, v_texCoords).r; | ||
|
||
if(srcDepth < dstDepth) discard; | ||
fragColor = texture(u_src, v_texCoords); | ||
gl_FragDepth = srcDepth; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#define HIGHP | ||
|
||
in vec3 v_position; | ||
|
||
out vec4 fragColor; | ||
|
||
uniform vec3 u_relCamPos; | ||
uniform vec3 u_camPos; | ||
uniform vec3 u_center; | ||
|
||
uniform float u_radius; | ||
uniform float u_horizon; | ||
uniform sampler2D u_ref; | ||
|
||
uniform mat4 u_proj; | ||
uniform mat4 u_invProj; | ||
uniform float u_far; | ||
|
||
bool intersectSphere(vec3 origin, vec3 dir, float radius, out vec2 result){ | ||
float b = dot(origin, dir); | ||
float c = dot(origin, origin) - radius * radius; | ||
|
||
float d = b * b - c; | ||
if(d < 0.0) return false; | ||
|
||
d = sqrt(d); | ||
float near = -b - d; | ||
float far = -b + d; | ||
|
||
result = vec2(near, far); | ||
return true; | ||
} | ||
|
||
vec4 far(vec3 origin, vec3 ray){ | ||
float far = (u_far - origin.z) / ray.z; | ||
vec3 intersect = origin + far * ray; | ||
vec4 clip = u_proj * vec4(intersect, 1.0); | ||
|
||
return clip; | ||
} | ||
|
||
vec2 coords(vec4 far){ | ||
return (far.xyz / far.w).xy * 0.5 + vec2(0.5); | ||
} | ||
|
||
vec2 coords(vec3 origin, vec3 ray){ | ||
return coords(far(origin, ray)); | ||
} | ||
|
||
void main(){ | ||
vec3 ray = normalize(v_position - u_camPos); | ||
vec3 normal = normalize(v_position - u_center); | ||
|
||
vec2 bound; | ||
if(!intersectSphere(u_relCamPos, ray, u_radius, bound)) discard; | ||
|
||
float intensity = smoothstep(0.0, 1.0, pow((bound.y - bound.x) / (u_radius * 2.0), 3.2)); | ||
float dist = length(u_relCamPos + ((bound.x + bound.y) / 2.0) * ray) / u_radius; | ||
|
||
vec4 center = far(u_camPos, normalize(u_center - u_camPos)); | ||
vec4 current = far(u_camPos, ray); | ||
vec2 centerCoord = coords(center); | ||
vec2 currentCoord = coords(current); | ||
vec2 dir = currentCoord - centerCoord; | ||
|
||
vec3 newRay; | ||
{ | ||
vec4 clip = current; | ||
clip.xy -= (dir / dist) * intensity * 3.0 * clip.w; | ||
|
||
vec4 world = u_invProj * clip; | ||
newRay = normalize(world.xyz / world.w - u_camPos); | ||
} | ||
|
||
vec3 origin = u_camPos + bound.x * ray; | ||
vec4 shift = texture(u_ref, coords(origin, newRay)); | ||
|
||
float inner = 1.0 - smoothstep(0.0, 1.0, pow(1.0 - max(-dist + u_horizon, 0.0) / u_horizon, 16.0)); | ||
fragColor = mix( | ||
shift, | ||
vec4(vec3(0.0), 1.0), | ||
inner | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#define HIGHP | ||
|
||
in vec3 a_position; | ||
|
||
out vec3 v_position; | ||
|
||
uniform mat4 u_proj; | ||
uniform mat4 u_trans; | ||
uniform float u_radius; | ||
|
||
void main(){ | ||
vec4 pos = u_trans * vec4(a_position, 1.0); | ||
|
||
v_position = pos.xyz; | ||
gl_Position = u_proj * pos; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
varying vec3 v_color; | ||
in vec3 v_color; | ||
|
||
out vec4 fragColor; | ||
|
||
void main(){ | ||
gl_FragColor = vec4(v_color, 1.0); | ||
fragColor = vec4(v_color, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
uniform sampler2D u_sampler0; | ||
in vec4 v_color; | ||
in vec2 v_texCoord; | ||
|
||
out vec4 fragColor; | ||
|
||
varying vec4 v_color; | ||
varying vec2 v_texCoord; | ||
uniform sampler2D u_sampler0; | ||
|
||
void main(){ | ||
vec4 emit = texture2D(u_sampler0, v_texCoord); | ||
gl_FragColor = vec4(emit.rgb * emit.a + v_color.rgb, v_color.a); | ||
vec4 emit = texture(u_sampler0, v_texCoord); | ||
fragColor = vec4(emit.rgb * emit.a + v_color.rgb, v_color.a); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
varying vec3 v_color; | ||
varying float v_height; | ||
varying float v_darkness; | ||
in vec3 v_color; | ||
in float v_height; | ||
in float v_darkness; | ||
|
||
out vec4 fragColor; | ||
|
||
void main(){ | ||
float dark = min(v_height / ((1.0 - v_darkness) * 32.0), 1.0); | ||
dark = smoothstep(0.0, 1.0, dark); | ||
|
||
gl_FragColor = vec4(v_color * (v_darkness + dark * (1.0 - v_darkness)), 1.0); | ||
fragColor = vec4(v_color * (v_darkness + dark * (1.0 - v_darkness)), 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.