Skip to content

Commit

Permalink
Bump versions
Browse files Browse the repository at this point in the history
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
GlennFolker committed Oct 20, 2024
1 parent 01fad6e commit b9509b8
Show file tree
Hide file tree
Showing 41 changed files with 659 additions and 90 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Instead, you have two options:
- On Android, see the game's built-in mod import functionality below.

You can also use Mindustry's built-in "Import mod" button in the mods menu dialog, restart the game, and play.

- ### Bleeding-Edge

Make sure you have a GitHub account. Head over to the [actions](https://github.com/GlennFolker/Confictura/actions) page, click the most recent successful workflow runs *(marked by green checkmark)*, scroll down to "Artifacts" section, and download the one titled `Confictura (zipped)`. As the name suggests, **you must unzip it first to extract the actual `.jar`**, then you can import it. If you open an issue report that is exactly this, I too will simply ignore you and refer you to this file. <br>
Expand Down
16 changes: 16 additions & 0 deletions assets/shaders/confictura/black-hole-stencil.frag
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;
}
84 changes: 84 additions & 0 deletions assets/shaders/confictura/black-hole.frag
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
);
}
16 changes: 16 additions & 0 deletions assets/shaders/confictura/black-hole.vert
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;
}
6 changes: 4 additions & 2 deletions assets/shaders/confictura/celestial.frag
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);
}
10 changes: 5 additions & 5 deletions assets/shaders/confictura/celestial.vert
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
attribute vec3 a_position;
attribute vec3 a_normal;
attribute vec4 a_color;
in vec3 a_position;
in vec3 a_normal;
in vec4 a_color;

out vec3 v_color;

uniform mat4 u_proj;
uniform mat4 u_trans;
Expand All @@ -10,8 +12,6 @@ uniform vec3 u_light;
uniform vec3 u_ambientColor;
uniform vec3 u_camPos;

varying vec3 v_color;

void main(){
vec4 pos = u_trans * vec4(a_position, 1.0);
vec3 normal = normalize(u_normal * a_normal);
Expand Down
8 changes: 5 additions & 3 deletions assets/shaders/confictura/depth-atmosphere.frag
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const float flare = 0.0025;
const float intensity = 14.3;
const float gm = -0.85;

varying vec3 v_position;
in vec3 v_position;

out vec4 fragColor;

uniform vec3 u_camPos;
uniform vec3 u_relCamPos;
Expand Down Expand Up @@ -106,7 +108,7 @@ void main(){
vec3 normal = normalize(v_position - u_center);

vec2 bound = intersect(eye, ray, u_outerRadius);
bound.y = min(bound.y, unpack(texture2D(u_topology, gl_FragCoord.xy / u_viewport)));
bound.y = min(bound.y, unpack(texture(u_topology, gl_FragCoord.xy / u_viewport)));

gl_FragColor = vec4(inScatter(eye, ray, bound, u_light), 1.0);
fragColor = vec4(inScatter(eye, ray, bound, u_light), 1.0);
}
4 changes: 2 additions & 2 deletions assets/shaders/confictura/depth-atmosphere.vert
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#define HIGHP

attribute vec3 a_position;
in vec3 a_position;

varying vec3 v_position;
out vec3 v_position;

uniform mat4 u_proj;
uniform mat4 u_trans;
Expand Down
6 changes: 4 additions & 2 deletions assets/shaders/confictura/depth.frag
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#define HIGHP

varying float v_depth;
in float v_depth;

out vec4 fragColor;

uniform vec2 u_camRange;

Expand All @@ -14,5 +16,5 @@ vec4 pack(float value){
}

void main(){
gl_FragColor = pack(v_depth);
fragColor = pack(v_depth);
}
4 changes: 2 additions & 2 deletions assets/shaders/confictura/depth.vert
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#define HIGHP

attribute vec3 a_position;
in vec3 a_position;

varying float v_depth;
out float v_depth;

uniform mat4 u_proj;
uniform mat4 u_trans;
Expand Down
12 changes: 7 additions & 5 deletions assets/shaders/confictura/emissive-batch.frag
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);
}
14 changes: 7 additions & 7 deletions assets/shaders/confictura/emissive-batch.vert
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
attribute vec3 a_position;
attribute vec3 a_normal;
attribute vec4 a_color;
attribute vec2 a_texCoord0;
in vec3 a_position;
in vec3 a_normal;
in vec4 a_color;
in vec2 a_texCoord0;

out vec4 v_color;
out vec2 v_texCoord;

uniform mat4 u_proj;
uniform mat4 u_trans;
Expand All @@ -10,9 +13,6 @@ uniform mat3 u_normal;
uniform vec3 u_light;
uniform vec3 u_ambientColor;

varying vec4 v_color;
varying vec2 v_texCoord;

void main(){
vec4 pos = u_trans * vec4(a_position, 1.0);
vec3 normal = normalize(u_normal * a_normal);
Expand Down
10 changes: 6 additions & 4 deletions assets/shaders/confictura/model-prop.frag
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);
}
16 changes: 8 additions & 8 deletions assets/shaders/confictura/model-prop.vert
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
attribute vec3 a_position;
attribute vec3 a_normal;
attribute vec4 a_color;
attribute float a_darkness;
in vec3 a_position;
in vec3 a_normal;
in vec4 a_color;
in float a_darkness;

out vec3 v_color;
out float v_height;
out float v_darkness;

uniform mat4 u_proj;
uniform vec3 u_camPos;
uniform vec3 u_lightDir;
uniform vec4 u_reflectColor;

varying vec3 v_color;
varying float v_height;
varying float v_darkness;

void main(){
gl_Position = u_proj * vec4(a_position, 1.0);

Expand Down
14 changes: 7 additions & 7 deletions assets/shaders/confictura/portal-forcefield.frag
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ therefore here is the required copyright notice.

#define HIGHP

varying vec3 v_position;
varying float v_progress;
varying vec4 v_color;
in vec3 v_position;
in float v_progress;
in vec4 v_color;

out vec4 fragColor;

uniform mat4 u_proj;
uniform float u_radius;
Expand Down Expand Up @@ -191,7 +193,7 @@ void main(){
vec3 normal = normalize(v_position - u_center);

vec2 intersect = intersect(eye, ray, u_radius - 0.01);
float topo = unpack(texture2D(u_topology, gl_FragCoord.xy / u_viewport));
float topo = unpack(texture(u_topology, gl_FragCoord.xy / u_viewport));

float dst = (intersect.y - intersect.x) / ((u_radius - 0.01) * 2.0);
float noise = octNoise(vec3(eye + ray * intersect.x), 4, 1.8, 1.8, 0.67);
Expand Down Expand Up @@ -223,11 +225,9 @@ void main(){
outline *= medium * light;

vec3 outlineColor = v_color.xyz * pow(max(1.0 - v_color.a - 0.5, 0.0) * 2.0, 4.0) * outline;
gl_FragColor = vec4(baseColor + outlineColor, 1.0);
fragColor = vec4(baseColor + outlineColor, 1.0);

#ifdef HAS_GL_FRAGDEPTH
float far = gl_DepthRange.far, near = gl_DepthRange.near;
vec4 clip = u_proj * vec4(u_camPos + ray * intersect.x, 1.0);
gl_FragDepth = (((far - near) * (clip.z / clip.w)) + near + far) / 2.0;
#endif
}
12 changes: 6 additions & 6 deletions assets/shaders/confictura/portal-forcefield.vert
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#define HIGHP

attribute vec3 a_position;
attribute vec3 a_normal;
attribute vec4 a_color;
in vec3 a_position;
in vec3 a_normal;
in vec4 a_color;

varying vec3 v_position;
varying float v_progress;
varying vec4 v_color;
out vec3 v_position;
out float v_progress;
out vec4 v_color;

uniform mat4 u_proj;
uniform mat4 u_trans;
Expand Down
Binary file added assets/skyboxes/confictura/megalith/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/skyboxes/confictura/megalith/bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/skyboxes/confictura/megalith/front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/skyboxes/confictura/megalith/left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/skyboxes/confictura/megalith/right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/skyboxes/confictura/megalith/top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,10 @@ project(":"){
mustRunAfter(proc)

if(!layout.projectDirectory.dir("assets").dir("sprites").asFile.exists()){
logger.lifecycle("Sprites folder not found; automatically running `:proc:run`.")
inputs.files(proc)
doFirst{
logger.lifecycle("Sprites folder not found; automatically running `:proc:run`.")
}
}

archiveFileName = "${modArtifact}Desktop.jar"
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ modArtifact = Confictura
# EntityAnno version, for integrating syntax-downgrader and entity annotation processor.
# The exact version you need should be looked up on the project's `README.md`
# (see https://github.com/GlennFolker/EntityAnno?tab=readme-ov-file#version-compatibility).
entVersion = v146.0.6
entVersion = v146.0.8
# glTFrenzy version, for loading 3D models.
glTFrenzyVersion = c454246ef2590cba33e58d7ef9b02de3556a4aec
# Set to `true` if the mod is compiled against Mindustry bleeding-edge build.
Expand All @@ -24,9 +24,9 @@ mindustryBE = true
mindustryVersion = v146
# Mindustry *bleeding-edge* version, corresponds to commit hashes of Anuken/MindustryJitpack, e.g. `345ea0d54de0aee6953a664468556f4fea1a7c4f`.
# Leave empty if `mindustryBE = false`.
mindustryBEVersion = ec4d47fc504478e2f9070a662729a1de481129d0
mindustryBEVersion = 4a332e2ec39714b22514f11b76f90a1c20dc0e8a
# Arc version, should either follow `mindustryVersion` for release or whatever hash bleeding-edge Mindustry uses.
arcVersion = e312cc96f5
arcVersion = c1e3b23ddd

##### Android SDK configuration for building Android artifacts.
# Android platform SDK version.
Expand Down
Loading

0 comments on commit b9509b8

Please sign in to comment.