Skip to content

Commit

Permalink
changed frezon & water vapour a little. added ammonia shader.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruddygreat committed Feb 10, 2025
1 parent 8fa0959 commit bbacc83
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 10 deletions.
13 changes: 8 additions & 5 deletions Resources/Prototypes/Atmospherics/gases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
molarMass: 18
#gasOverlaySprite: /Textures/Effects/atmospherics.rsi # imp edit - commented out
#gasOverlayState: water_vapor_atmos # imp edit - commented out
color: bffffd # imp note maybe change this away from a light blue? yeah, make it closer to white
color: ddfffd # imp note maybe change this away from a light blue? yeah, make it closer to white. was bffffd.
reagent: Water
pricePerMole: 0
shader: BasicGasShader # imp edit - use the gas shader
Expand All @@ -79,13 +79,16 @@
specificHeat: 20
heatCapacityRatio: 1.4
molarMass: 44
gasOverlaySprite: /Textures/Effects/atmospherics.rsi
gasOverlayState: miasma_atmos
#gasOverlaySprite: /Textures/Effects/atmospherics.rsi # imp edit - commented out
#gasOverlayState: miasma_atmos # imp edit - commented out
gasMolesVisible: 2
gasVisbilityFactor: 3.5
color: 56941E #imp note - make this ourple.
color: 662A88 #imp note - make this ourple. was 56941E.
reagent: Ammonia
pricePerMole: 0.15
shader: AmmoniaGasShader # imp edit - use the gas shader
noiseTexture: /Textures/_Impstation/Noise/perlin_noise.rsi # imp edit - set the noise tex
noiseLayers: 3 # imp edit - specify how many noise layers there are

- type: gas
id: 7
Expand All @@ -106,7 +109,7 @@
#gasOverlaySprite: /Textures/Effects/atmospherics.rsi # imp edit - commented out
#gasOverlayState: frezon_atmos # imp edit - commented out
gasMolesVisible: 0.6
color: 2BB6AF #imp edit - made it brighter show it shows up better in-world. old value was 3a758c.
color: 2BCED4 #2BB6AF #imp edit - made it brighter show it shows up better in-world. old value was 3a758c.
reagent: Frezon
pricePerMole: 3
shader: FrezonGasShader # imp edit - use the gas shader
Expand Down
5 changes: 5 additions & 0 deletions Resources/Prototypes/_Impstation/Shaders/shaders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@
id: FrezonGasShader
kind: source
path: "/Textures/_Impstation/Shaders/frezon_gas_shader.swsl"

- type: shader
id: AmmoniaGasShader
kind: source
path: "/Textures/_Impstation/Shaders/ammonia_gas_shader.swsl"
47 changes: 47 additions & 0 deletions Resources/Textures/_Impstation/Shaders/ammonia_gas_shader.swsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
uniform highp vec4 colour;

uniform sampler2D noise_0;
uniform sampler2D noise_1;
uniform sampler2D noise_2;

const highp float tileSize = 32.0;

void fragment() {

highp float multiple = (1.0 / tileSize);
highp vec2 rem = vec2(mod(UV.x, multiple), mod(UV.y, multiple));
highp vec2 rounded = UV - rem; //downsample to a 32 * 32 grid for stylistic consistency

COLOR = 0.3 * texture(noise_0, loopVec(rounded + TIME * 0.1));
COLOR += 0.3 * texture(noise_0, loopVec(vec2(rounded.x - TIME * 0.1, rounded.y + 0.2 + TIME * 0.1)));
COLOR += 0.3 * texture(noise_2, loopVec(rounded + vec2(0.2, 0.7)));
COLOR += 0.1 * texture(noise_1, loopVec(vec2(rounded.x + sin(rounded.y + TIME * 0.1), rounded.y + cos(rounded.x + TIME * 0.1))));
COLOR *= colour;
}

//hate that I have to do this because we can't just
highp vec2 loopVec(highp vec2 toLoop) {
return abs(mod(toLoop, 1));;
}

//copied out from an error.glsl file so that I can actually edit these
//g because gas :)
highp vec2 gRandom(highp vec2 uv){
uv = vec2( dot(uv, vec2(127.1,311.7) ),
dot(uv, vec2(269.5,183.3) ) );
return -1.0 + 2.0 * fract(sin(uv) * 43758.5453123);
}

highp float gNoise(highp vec2 uv) {

highp vec2 uv_index = floor(uv);
highp vec2 uv_fract = fract(uv);

highp vec2 blur = uv_fract * uv_fract * (3.0 - 2.0 * uv_fract);

return mix( mix( dot( gRandom(uv_index + vec2(0.0,0.0) ), uv_fract - vec2(0.0,0.0) ),
dot( gRandom(uv_index + vec2(1.0,0.0) ), uv_fract - vec2(1.0,0.0) ), blur.x),
mix( dot( gRandom(uv_index + vec2(0.0,1.0) ), uv_fract - vec2(0.0,1.0) ),
dot( gRandom(uv_index + vec2(1.0,1.0) ), uv_fract - vec2(1.0,1.0) ), blur.x), blur.y) * 0.5 + 0.5;
}

9 changes: 5 additions & 4 deletions Resources/Textures/_Impstation/Shaders/frezon_gas_shader.swsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ void fragment() {
highp vec2 rem = vec2(mod(UV.x, multiple), mod(UV.y, multiple));
highp vec2 rounded = UV - rem; //downsample to a 32 * 32 grid for stylistic consistency

COLOR = 0.4 * texture(noise_0, loopVec(vec2(rounded.x + sin(rounded.y * 4.0 + TIME * 0.1), rounded.y + sin(rounded.x * 4.0 + TIME * 0.1))));
COLOR += 0.2 * texture(noise_0, loopVec(vec2(rounded.x + sin(rounded.y * 4.0 + TIME * 0.1), rounded.y)));
COLOR += 0.2 * texture(noise_0, loopVec(vec2(rounded.x, rounded.y + sin(rounded.x * 4.0 + TIME * 0.1)))); //tiny offset so it's not identical to other gases
COLOR += 0.2 * texture(noise_2, loopVec(vec2(rounded.x, rounded.y + TIME * 0.2)));
//note to self if I want to change things back - was .4, .2, .2, .2
COLOR = 0.25 * texture(noise_0, loopVec(vec2(rounded.x + sin(rounded.y * 4.0 + TIME * 0.1), rounded.y + sin(rounded.x * 4.0 + TIME * 0.1))));
COLOR += 0.25 * texture(noise_0, loopVec(vec2(rounded.x + sin(rounded.y * 4.0 + TIME * 0.1), rounded.y)));
COLOR += 0.25 * texture(noise_0, loopVec(vec2(rounded.x, rounded.y + sin(rounded.x * 4.0 + TIME * 0.1))));
COLOR += 0.25 * texture(noise_2, loopVec(vec2(rounded.x, rounded.y + TIME * 0.2)));
COLOR *= colour;
highp vec3 asHSV = rgb2hsv(COLOR.rgb);
COLOR.rgb = hsv2rgb(asHSV + vec3(0.0, 0.0, asHSV.z * asHSV.z));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const highp float tileSize = 32.0;

void fragment() {

//todo : experiment with alpha quantisation like how I done did it with the uvs
//todo : experiment with alpha quantisation like how I done did it with the uvs?
//todo : get a better colour for water vapour
//todo : figure out how to make the brighter spots significantly brighter while leaving darker spots untouched

Expand Down

0 comments on commit bbacc83

Please sign in to comment.