Singularity Shaders and a lot of Shader Stuff (#2517)

* Beginnings of singulo shader

* LOTS of changes!!

* Minor changes

* Singulo stuff

* Aesthetic changes to singulo

* Combining singulo change

* ShaderAura uses IEntities now, not IPlayerSession

* Fixes?

* Fixes draw order for atmos

* using fix

* Address reviews

* nuget.config whaaa

* nuget haha

* nuget why are you so dum

* happy now

* Preparing for omegachange

* Merge from seventh level of hell

* woork

* Ignorecomponents add

* mmf

* RobustToolbox?

* Fixes

* Fixes Robust?

* adds sprite

* Nullables

* Crit overlay stuff

* Commits Robust
This commit is contained in:
GraniteSidewalk
2021-03-09 04:33:41 -06:00
committed by GitHub
parent edb9bff91c
commit 549d84174c
37 changed files with 562 additions and 133 deletions

View File

@@ -4,7 +4,7 @@
name: bee plushie
parent: BaseItem
id: PlushieBee
description: A cute toy that resembles an even cuter coder.
description: A cute toy that resembles an even cuter programmer.
components:
- type: Toys
- type: LoopingSound
@@ -49,7 +49,7 @@
name: nar'sie plushie
parent: BaseItem
id: PlushieNar
description: A small stuffed doll of the elder goddess Nar'Sie. Who thought this was a good children's toy?
description: A small stuffed doll of the elder goddess Nar'Sie.
components:
- type: Toys
- type: LoopingSound
@@ -64,7 +64,7 @@
name: carp plushie
parent: BaseItem
id: PlushieCarp
description: An adorable stuffed toy that resembles a space carp.
description: An adorable stuffed toy that resembles the monstrous space carp.
components:
- type: Toys
- type: LoopingSound
@@ -97,7 +97,7 @@
name: snake plushie
parent: BaseItem
id: PlushieSnake
description: An adorable stuffed toy that resembles a snake. Not to be mistaken for the real thing.
description: An adorable stuffed toy that resembles a snake.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -129,7 +129,7 @@
name: help me carving
parent: BaseItem
id: CarvingHelpMe
description: Help me...
description: Help me!
components:
- type: Sprite
sprite: Objects/Misc/carvings.rsi
@@ -191,7 +191,7 @@
name: very good carving
parent: BaseItem
id: CarvingVeryGood
description: Very Good!
description: Very good!
components:
- type: Sprite
sprite: Objects/Misc/carvings.rsi
@@ -211,7 +211,7 @@
name: sorry carving
parent: BaseItem
id: CarvingImSorry
description: I'm sorry...
description: I'm sorry.
components:
- type: Sprite
sprite: Objects/Misc/carvings.rsi
@@ -233,7 +233,7 @@
name: AI toy
parent: BaseItem
id: ToyAi
description: A little toy model AI core.
description: A scaled-down toy AI core.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -243,7 +243,7 @@
name: nuke toy
parent: BaseItem
id: ToyNuke
description: A plastic model of a Nuclear Fission Explosive. What child plays with this?
description: A plastic model of a Nuclear Fission Explosive. No uranium included... probably.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -276,7 +276,7 @@
name: h.o.n.k. toy
parent: BaseItem
id: ToyHonk
description: Mini-Mecha action figure! Collect them all! 6/12.
description: Mini-Mecha action figure! 'Mecha No. 6/12' is written on the back.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -286,7 +286,7 @@
name: ian toy
parent: BaseItem
id: ToyIan
description: Ian action figure.
description: Unable to eat, but just as fluffy as the real guy!
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -302,7 +302,7 @@
name: marauder toy
parent: BaseItem
id: ToyMarauder
description: Mini-Mecha action figure! Collect them all! 7/12.
description: Mini-Mecha action figure! 'Mecha No. 7/12' is written on the back.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -312,7 +312,7 @@
name: mauler toy
parent: BaseItem
id: ToyMauler
description: Mini-Mecha action figure! Collect them all! 9/12.
description: Mini-Mecha action figure! 'Mecha No. 9/12' is written on the back.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -322,7 +322,7 @@
name: gygax toy
parent: BaseItem
id: ToyGygax
description: Mini-Mecha action figure! Collect them all! 4/12.
description: Mini-Mecha action figure! 'Mecha No. 4/12' is written on the back.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -332,7 +332,7 @@
name: odysseus toy
parent: BaseItem
id: ToyOdysseus
description: Mini-Mecha action figure! Collect them all! 10/12.
description: Mini-Mecha action figure! 'Mecha No. 10/12' is written on the back.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -352,7 +352,7 @@
name: deathripley toy
parent: BaseItem
id: ToyDeathRipley
description: Mini-Mecha action figure! Collect them all! 3/12.
description: Mini-Mecha action figure! 'Mecha No. 3/12' is written on the back.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -362,7 +362,7 @@
name: phazon toy
parent: BaseItem
id: ToyPhazon
description: Mini-Mecha action figure! Collect them all! 11/12.
description: Mini-Mecha action figure! 'Mecha No. 11/12' is written on the back.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -372,7 +372,7 @@
name: fire ripley
parent: BaseItem
id: ToyFireRipley
description: Mini-Mecha action figure! Collect them all! 2/12.
description: Mini-Mecha action figure! 'Mecha No. 2/12' is written on the back.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -382,7 +382,7 @@
name: reticence toy
parent: BaseItem
id: ToyReticence
description: Mini-Mecha action figure! Collect them all! 12/12.
description: Mini-Mecha action figure! 'Mecha No. 12/12' is written on the back.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -392,7 +392,7 @@
name: ripley toy
parent: BaseItem
id: ToyRipley
description: Mini-Mecha action figure! Collect them all! 1/12.
description: Mini-Mecha action figure! 'Mecha No. 1/12' is written on the back.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -403,7 +403,7 @@
name: seraph toy
parent: BaseItem
id: ToySeraph
description: Mini-Mecha action figure! Collect them all! 8/12.
description: Mini-Mecha action figure! 'Mecha No. 8/12' is written on the back.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -414,7 +414,7 @@
name: durand toy
parent: BaseItem
id: ToyDurand
description: Mini-Mecha action figure! Collect them all! 5/12.
description: Mini-Mecha action figure! 'Mecha No. 5/12' is written on the back.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -427,7 +427,7 @@
name: skeleton toy
parent: BaseItem
id: ToySkeleton
description: Spooked yah!
description: Spooked ya!
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -567,7 +567,7 @@
name: football
parent: BaseItem
id: Football
description: Go Sports Go!
description: Otherwise known as a handegg.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -583,7 +583,7 @@
name: syndie balloon
parent: BaseItem
id: BalloonSyn
description: Loud and proud.
description: Handed out to the bravest souls who survived the "atomic twister" ride at Syndieland.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -598,7 +598,7 @@
name: corgi balloon
parent: BaseItem
id: BalloonCorgi
description: Cute.
description: Just like owning a real dog - but a lot floatier.
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
@@ -608,3 +608,22 @@
size: 24
sprite: Objects/Fun/toys.rsi
HeldPrefix: corgib
- type: entity
name: singuloth-brand toy
parent: BaseItem
id: SingularityToy
description: Mass-produced by a sadistic corporate conglomerate!
components:
- type: Sprite
sprite: Objects/Fun/toys.rsi
state: singularitytoy
- type: Icon
sprite: Objects/Fun/toys.rsi
state: singularitytoy
- type: ToySingularity
- type: Item
size: 12
sprite: Objects/Fun/toys.rsi
HeldPrefix: singularitytoy

View File

@@ -7,8 +7,23 @@
id: GradientCircleMask
kind: source
path: "/Textures/Shaders/gradient_circle_mask.swsl"
- type: shader
id: ColoredScreenBorder
kind: source
path: "/Textures/Shaders/colored_screen_border.swsl"
- type: shader
id: FlashedEffect
kind: source
path: "/Textures/Shaders/flashed_effect.swsl"
- type: shader
id: Singularity
kind: source
path: "/Textures/Shaders/singularity.swsl"
- type: shader
id: Texture
kind: source
path: "/Textures/Shaders/texture.swsl"

View File

@@ -261,6 +261,22 @@
0.1
]
]
},
{
"name": "singularitytoy",
"directions": 1,
"delays": [
[
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1,
0.1
]
]
}
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,21 @@
//Creates a border on the edges of the screen of the specified color and of the specified size (no uniforms yet cause I'm lazy)
const highp vec4 borderColor = vec4(230.0, 0.0, 0.0, 1.0);
const highp float borderSize = 30; //Pixel size of border
void fragment() {
highp vec2 pixelSize = vec2(1.0/SCREEN_PIXEL_SIZE.x, 1.0/SCREEN_PIXEL_SIZE.y);
highp float smallestLength = FRAGCOORD.x;
if(smallestLength > FRAGCOORD.y){
smallestLength = FRAGCOORD.y;
}
if(smallestLength > pixelSize.x-FRAGCOORD.x){
smallestLength = pixelSize.x-FRAGCOORD.x;
}
if(smallestLength > pixelSize.y-FRAGCOORD.y){
smallestLength = pixelSize.y-FRAGCOORD.y;
}
if(smallestLength <= borderSize){
COLOR = vec4(borderColor.r, borderColor.g, borderColor.b, abs((1.0-(smallestLength/borderSize))*(abs(sin(TIME))*0.8+0.2)));
}
}

View File

@@ -1,25 +1,25 @@
//This shader defines two circles - everything inside the inner circle will be darkened, while everything outside the outer circle
//will be full black. Between the inner and outer circle it LERPs from the inner darkness to full black.
light_mode unshaded;
const highp float percentagedistanceshow = 0.05;
const highp float gradientfalloffwidth = 3.0;
highp vec4 circle(in highp vec2 uv, in highp vec2 pos, highp float rad, in highp vec3 color) {
highp float d = length(pos - uv) - rad;
highp float t = clamp(d, 0.0, 1.0);
return vec4(color, t);
}
const highp float darknessAlphaInner = 0.6;
const highp float innerCircleRadius = 40; //Note: this is in pixels
const highp float outerCircleRadius = 80;
void fragment() {
highp vec2 uv = FRAGCOORD.xy;
highp vec2 res_xy = vec2(1.0/SCREEN_PIXEL_SIZE.x, 1.0/SCREEN_PIXEL_SIZE.y);
highp vec2 center = res_xy*0.5;
highp float radius = percentagedistanceshow * res_xy.y;
highp vec4 grad = vec4(0.8 - length( uv - center )/res_xy.y * gradientfalloffwidth);
highp vec4 layer1 = vec4(vec3(255.0),0.0);
highp vec4 layer2 = circle(uv, center, radius, grad.rgb);
COLOR = mix(layer1, layer2, layer2.a);
highp vec2 pixelSize = vec2(1.0/SCREEN_PIXEL_SIZE.x, 1.0/SCREEN_PIXEL_SIZE.y);
highp vec2 pixelCenter = pixelSize*0.5;
highp float distance = length(FRAGCOORD.xy - pixelCenter);
if(distance > outerCircleRadius){
COLOR = vec4(0.0, 0.0, 0.0, 1.0);
}
else if(distance < innerCircleRadius){
COLOR = vec4(0.0, 0.0, 0.0, darknessAlphaInner);
}
else{
highp float intensity = (distance-innerCircleRadius)/(outerCircleRadius-innerCircleRadius);
COLOR = vec4(0.0, 0.0, 0.0, (1-intensity)*darknessAlphaInner + intensity);
}
}

View File

@@ -0,0 +1,32 @@
//Gravitational lensing effect. Edited from https://unionassets.com/blog/the-effect-of-the-gravitational-lens-195 to be Clyde based (based on what)
uniform sampler2D SCREEN_TEXTURE;
uniform highp vec2 positionInput = vec2(0,0);
uniform highp float falloff = 5.0;
uniform highp float intensity = 5.0;
void fragment() {
float distanceToCenter = length(FRAGCOORD.xy-positionInput);
vec2 finalCoords = FRAGCOORD.xy - positionInput;
highp float deformation = (pow(intensity, 2)*500) / pow(distanceToCenter, pow(falloff, 0.5));
if(deformation > 0.8) //Edit this for inward effect
deformation = pow(deformation, 0.3);
if(deformation > 0.001){
finalCoords *= 1-deformation; //Change this to 1+deformation for inward effect
finalCoords += positionInput;
//float darkenCircleSize = 600; //Calculate optional darkening effect (darker the closer we are to the center of the singularity)
//float alph = (distanceToCenter-30)/(darkenCircleSize-30);
//float darkening = 0.9-(alph*0.9);
//Darkening effect optional (Darker the closer you are to the center)
//COLOR = mix(texture(SCREEN_TEXTURE, finalCoords*SCREEN_PIXEL_SIZE), vec4(0.0, 0.0, 0.0, 1.0), darkening);
COLOR = texture(SCREEN_TEXTURE, finalCoords*SCREEN_PIXEL_SIZE);
}
else{
COLOR = texture(SCREEN_TEXTURE, FRAGCOORD.xy*SCREEN_PIXEL_SIZE);
}
}

View File

@@ -0,0 +1,23 @@
//Draws the given texture at the given screen coords. Useful in specific scenarios (i.e. this was made for drawing singularity sprites over the lensing effect but below FOV)
//Currently does not work with AtlasTextures, going to need some work.
uniform sampler2D tex;
uniform highp vec2 positionInput = vec2(0,0);
uniform highp vec2 pixelSize = vec2(32, 32);
uniform highp float alphaCutoff = 0.0;
uniform bool removeTransparency = false;
void fragment() {
float pixelLength = pixelSize.x*2;
float halvedLength = pixelLength/2;
if(FRAGCOORD.x > positionInput.x - halvedLength && FRAGCOORD.x < positionInput.x + halvedLength && FRAGCOORD.y > positionInput.y - halvedLength && FRAGCOORD.y < positionInput.y + halvedLength){
vec2 finalCoords = (FRAGCOORD.xy-positionInput+(pixelLength/2))/pixelLength;
vec4 color = texture(tex, finalCoords);
if(color.a > alphaCutoff){
if(removeTransparency)
color.a = 1.0;
COLOR = color;
}
}
}