Skip to content

Commit

Permalink
Update version to 150
Browse files Browse the repository at this point in the history
  • Loading branch information
onnowhere committed Sep 1, 2022
1 parent 7477339 commit ad2a0c7
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#version 110
#version 150

attribute vec4 Position;
in vec4 Position;

uniform mat4 ProjMat;
uniform vec2 InSize;

varying vec2 texCoord;
varying vec2 oneTexel;
out vec2 texCoord;
out vec2 oneTexel;

void main(){
void main() {
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
gl_Position = vec4(outPos.xy, 0.2, 1.0);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#version 110
#version 150

uniform sampler2D DiffuseSampler;
uniform sampler2D DiffuseDepthSampler;

uniform vec2 ScreenSize;
uniform float _FOV;

varying vec2 texCoord;
in vec2 texCoord;
out vec4 fragColor;

float near = 0.1;
float far = 1000.0;
Expand All @@ -18,11 +19,11 @@ float LinearizeDepth(float depth)
}

void main() {
float depth = LinearizeDepth(texture2D(DiffuseDepthSampler, texCoord).r);
float depth = LinearizeDepth(texture(DiffuseDepthSampler, texCoord).r);
float distance = length(vec3(1., (2.*texCoord - 1.) * vec2(ScreenSize.x/ScreenSize.y,1.) * tan(radians(_FOV / 2.))) * depth);
if (mod(distance, 1.0) <= 0.05) {
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
fragColor = vec4(0.0,0.0,0.0,1.0);
} else {
gl_FragColor = vec4(texture2D(DiffuseSampler, texCoord).rgb, 1.0);
fragColor = vec4(texture(DiffuseSampler, texCoord).rgb, 1.0);
}
}
2 changes: 1 addition & 1 deletion Depth Shader Test (Distance)/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 7,
"pack_format": 9,
"description": "§bBy Onnowhere"
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#version 110
#version 150

attribute vec4 Position;
in vec4 Position;

uniform mat4 ProjMat;
uniform vec2 InSize;

varying vec2 texCoord;
varying vec2 oneTexel;
out vec2 texCoord;
out vec2 oneTexel;

void main(){
void main() {
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
gl_Position = vec4(outPos.xy, 0.2, 1.0);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#version 110
#version 150

uniform sampler2D BlurSampler;
uniform sampler2D DiffuseSampler;
Expand All @@ -9,8 +9,9 @@ uniform sampler2D TranslucentDepthSampler;
uniform vec2 FocusRange;
uniform vec2 DepthScale;

varying vec2 texCoord;
varying vec2 oneTexel;
in vec2 texCoord;
in vec2 oneTexel;
out vec4 fragColor;

float near = 0.1;
float far = 100.0;
Expand All @@ -22,10 +23,10 @@ float LinearizeDepth(float depth)
}

void main() {
float depth = LinearizeDepth(texture2D(TranslucentDepthSampler, texCoord).r) / far; // divide by far for demonstration
float depth = LinearizeDepth(texture(TranslucentDepthSampler, texCoord).r) / far; // divide by far for demonstration
depth = clamp(depth, 0.0, 1.0);
vec4 col = vec4(texture2D(DiffuseSampler, texCoord).rgb, 1.0);
vec4 col_blur = vec4(texture2D(BlurSampler, texCoord).rgb, 1.0);
vec4 col = vec4(texture(DiffuseSampler, texCoord).rgb, 1.0);
vec4 col_blur = vec4(texture(BlurSampler, texCoord).rgb, 1.0);
vec2 focus_range = FocusRange;
if (depth > focus_range.y) {
depth *= DepthScale.x;
Expand All @@ -40,5 +41,5 @@ void main() {
depth = clamp(depth, 0.0, 1.0);
col = col*(depth) + col_blur*(1.0-depth);
}
gl_FragColor = col;
fragColor = col;
}
2 changes: 1 addition & 1 deletion Depth Shader Test (DoF)/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 7,
"pack_format": 9,
"description": "§bBy Onnowhere"
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#version 110
#version 150

attribute vec4 Position;
in vec4 Position;

uniform mat4 ProjMat;
uniform vec2 InSize;

varying vec2 texCoord;
varying vec2 oneTexel;
out vec2 texCoord;
out vec2 oneTexel;

void main(){
void main() {
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
gl_Position = vec4(outPos.xy, 0.2, 1.0);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#version 110
#version 150

uniform sampler2D DiffuseSampler;
uniform sampler2D DiffuseDepthSampler;

varying vec2 texCoord;
varying vec2 oneTexel;
in vec2 texCoord;
in vec2 oneTexel;
out vec4 fragColor;

void main() {
float col = 1.0-(1.0-texture2D(DiffuseDepthSampler, texCoord).r)*500.0;
gl_FragColor = vec4(vec3(col), 1.0);
float col = 1.0-(1.0-texture(DiffuseDepthSampler, texCoord).r)*500.0;
fragColor = vec4(vec3(col), 1.0);
}
2 changes: 1 addition & 1 deletion Depth Shader Test (Fog)/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 7,
"pack_format": 9,
"description": "§bBy Onnowhere"
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#version 110
#version 150

attribute vec4 Position;
in vec4 Position;

uniform mat4 ProjMat;
uniform vec2 InSize;

varying vec2 texCoord;
varying vec2 oneTexel;
out vec2 texCoord;
out vec2 oneTexel;

void main(){
void main() {
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
gl_Position = vec4(outPos.xy, 0.2, 1.0);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#version 110
#version 150

uniform sampler2D DiffuseSampler;
uniform sampler2D DiffuseDepthSampler;

varying vec2 texCoord;
in vec2 texCoord;
out vec4 fragColor;

float near = 0.1;
float far = 1000.0;
Expand All @@ -15,10 +16,10 @@ float LinearizeDepth(float depth)
}

void main() {
float depth = LinearizeDepth(texture2D(DiffuseDepthSampler, texCoord).r);
float depth = LinearizeDepth(texture(DiffuseDepthSampler, texCoord).r);
if (mod(depth, 1.0) <= 0.02) {
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
fragColor = vec4(0.0,0.0,0.0,1.0);
} else {
gl_FragColor = vec4(texture2D(DiffuseSampler, texCoord).rgb, 1.0);
fragColor = vec4(texture(DiffuseSampler, texCoord).rgb, 1.0);
}
}
2 changes: 1 addition & 1 deletion Depth Shader Test (Stripes)/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 7,
"pack_format": 9,
"description": "§bBy Onnowhere"
}
}

0 comments on commit ad2a0c7

Please sign in to comment.