Began work on post processing
This commit is contained in:
@@ -13,7 +13,7 @@ layout(location = 0) out vec4 outColour;
|
||||
void main() {
|
||||
vec2 uv = mod(uv, vec2(1))*(1f/(vec2(3,2)*256f));
|
||||
vec4 colour = texture(blockModelAtlas, uv + baseUV);
|
||||
if (discardAlpha == 1 && colour.a == 0.0f) {
|
||||
if (discardAlpha == 1 && colour.a <= 0.001f) {
|
||||
discard;
|
||||
}
|
||||
outColour = colour * colourTinting;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#version 330 core
|
||||
|
||||
uniform sampler2D text;
|
||||
out vec4 colour;
|
||||
in vec2 UV;
|
||||
|
||||
void main() {
|
||||
colour = texture(text, UV.xy);
|
||||
if (colour.a == 0.0) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#version 330 core
|
||||
|
||||
out vec2 UV;
|
||||
void main() {
|
||||
gl_Position = vec4(vec2(gl_VertexID&1, (gl_VertexID>>1)&1) * 4 - 1, 0.99999999999f, 1);
|
||||
UV = gl_Position.xy*0.5+0.5;
|
||||
}
|
||||
6
src/main/resources/assets/zenith/shaders/post/noop.frag
Normal file
6
src/main/resources/assets/zenith/shaders/post/noop.frag
Normal file
@@ -0,0 +1,6 @@
|
||||
#version 330 core
|
||||
out vec4 colour;
|
||||
in vec2 UV;
|
||||
void main() {
|
||||
colour = vec4(1,0,1,1);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#version 460 core
|
||||
layout(location = 0) in flat vec4 colour;
|
||||
layout(location = 0) out vec4 outColour;
|
||||
void main() {
|
||||
//TODO: randomly discard the fragment with respect to the alpha value
|
||||
|
||||
outColour = colour;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#version 460 core
|
||||
|
||||
layout(location = 0) out flat vec4 colour;
|
||||
layout(binding = 0, std140) uniform SceneUniform {
|
||||
mat4 MVP;
|
||||
ivec3 baseSectionPos;
|
||||
int _pad1;
|
||||
};
|
||||
|
||||
void main() {
|
||||
int cornerIdx = gl_VertexID&3;
|
||||
|
||||
|
||||
|
||||
gl_Position = MVP * vec4(vec3(cornerIdx&1,((cornerIdx>>1)&1),0),1);
|
||||
|
||||
colour = vec4(float((uint(gl_VertexID)>>2)&7)/7,float((uint(gl_VertexID)>>5)&7)/7,float((uint(gl_VertexID)>>8)&7)/7,1);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
//Contains the definision of a ray and step functions
|
||||
struct Ray {
|
||||
ivec3 pos;
|
||||
vec3 innerPos;
|
||||
|
||||
vec3 dir;
|
||||
vec3 invDir;
|
||||
};
|
||||
|
||||
Ray ray;
|
||||
void setup(vec3 origin, vec3 direction) {
|
||||
ray.pos = ivec3(origin);
|
||||
ray.innerPos = origin - ray.pos;
|
||||
direction *= inversesqrt(direction);
|
||||
ray.dir = direction;
|
||||
ray.invDir = 1/direction;
|
||||
}
|
||||
|
||||
void step(ivec3 aabb) {
|
||||
//TODO:check for innerPos>=1 and step into that voxel
|
||||
vec3 t2f = (aabb - ray.innerPos) * ray.invDir;
|
||||
float mint2f = min(t2f.x, min(t2f.y, t2f.z));
|
||||
bvec3 msk = lessThanEqual(t2f.xyz, vec3(mint2f));
|
||||
vec3 newIP = mint2f * ray.dir + ray.innerPos;
|
||||
ivec3 offset = min(aabb-1, ivec3(newIP));
|
||||
ray.pos += offset + ivec3(msk);
|
||||
ray.innerPos = mix(vec3(0), newIP - offset, not(msk));
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
struct Voxel {
|
||||
|
||||
};
|
||||
|
||||
//TODO: add tlas and blas voxel fetching (rings and all)
|
||||
void getVoxel() {
|
||||
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
//Glue code between ray stepper and voxel storage
|
||||
// its the primary ray tracer
|
||||
Reference in New Issue
Block a user