Skyboxes
This commit is contained in:
parent
eb01ec4877
commit
f135d99d74
60 changed files with 924 additions and 90 deletions
BIN
resources/EngineResources/SkyBoxTextures/SkyTop.png
Normal file
BIN
resources/EngineResources/SkyBoxTextures/SkyTop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
resources/EngineResources/SkyBoxTextures/skySide.png
Normal file
BIN
resources/EngineResources/SkyBoxTextures/skySide.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
|
|
@ -0,0 +1,2 @@
|
|||
Sky texture:
|
||||
kaori669 on deviant art
|
||||
BIN
resources/EngineResources/Texture/NoTexture.png
Normal file
BIN
resources/EngineResources/Texture/NoTexture.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 217 KiB |
|
|
@ -149,4 +149,9 @@ void main() {
|
|||
vec3 color = ambient + Lo;
|
||||
|
||||
outFragColor = vec4(color, 1.0f);
|
||||
if (length(normal) < 0.001) {
|
||||
outFragColor = vec4(albedo,1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
layout(constant_id = 0) const int USE_AA = 0;
|
||||
|
||||
const float GAMMA_CONST = 0.8545;
|
||||
const float GAMMA_CONST = 0.6545;
|
||||
const float SPAN_MAX = 8.0;
|
||||
const float REDUCE_MIN = 1.0/128.0;
|
||||
const float REDUCE_MUL = 1.0/32.0;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
layout(constant_id = 0) const int USE_AA = 0;
|
||||
|
||||
const float GAMMA_CONST = 0.8545;
|
||||
const float GAMMA_CONST = 0.4545;
|
||||
const float SPAN_MAX = 8.0;
|
||||
const float REDUCE_MIN = 1.0/128.0;
|
||||
const float REDUCE_MUL = 1.0/32.0;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 512;
|
||||
const int MAX_TEXTURES = 128;
|
||||
|
||||
layout(location = 0) in vec4 inPos;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 512;
|
||||
const int MAX_TEXTURES = 128;
|
||||
|
||||
layout(location = 0) in vec4 inPos;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 512;
|
||||
const int MAX_TEXTURES = 128;
|
||||
|
||||
layout(location = 0) in vec4 inPos;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 512;
|
||||
const int MAX_TEXTURES = 128;
|
||||
|
||||
layout(location = 0) in vec4 inPos;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
|
|
@ -13,6 +13,13 @@ layout(location = 0) out vec4 outPos;
|
|||
layout(location = 2) out vec4 outNormal;
|
||||
layout(location = 3) out vec4 outPBR;
|
||||
|
||||
const float bayerMatrix[16] = float[](
|
||||
0.0 / 16.0, 8.0 / 16.0, 2.0 / 16.0, 10.0 / 16.0,
|
||||
12.0 / 16.0, 4.0 / 16.0, 14.0 / 16.0, 6.0 / 16.0,
|
||||
3.0 / 16.0, 11.0 / 16.0, 1.0 / 16.0, 9.0 / 16.0,
|
||||
15.0 / 16.0, 7.0 / 16.0, 13.0 / 16.0, 5.0 / 16.0
|
||||
);
|
||||
|
||||
struct Material {
|
||||
vec4 diffuseColor;
|
||||
uint hasTexture;
|
||||
|
|
@ -55,13 +62,17 @@ void main()
|
|||
} else {
|
||||
outAlbedo = material.diffuseColor;
|
||||
}
|
||||
|
||||
|
||||
/*int Intensity = 4;
|
||||
int x = int(gl_FragCoord.x) % Intensity;
|
||||
int y = int(gl_FragCoord.y) % Intensity;
|
||||
float threshold = bayerMatrix[y * Intensity + x];
|
||||
if(outAlbedo.a < threshold || outAlbedo.a < 0.05f) discard;*/
|
||||
if(outAlbedo.a < 0.75) discard;
|
||||
|
||||
|
||||
mat3 TBN = mat3(inTangent, inBitangent, inNormal);
|
||||
vec3 newNormal = calcNormal(material, inNormal, inTextCoords, TBN);
|
||||
outNormal = vec4(newNormal, 1.0f);
|
||||
outNormal = vec4(newNormal, outAlbedo.a);
|
||||
|
||||
float ao = 0.5f;
|
||||
float roughnessFactor = 0.0f;
|
||||
|
|
@ -75,6 +86,6 @@ void main()
|
|||
metallicFactor = material.metallicFactor;
|
||||
}
|
||||
|
||||
outPBR = vec4(ao, roughnessFactor, metallicFactor, 1.0f);
|
||||
outPBR = vec4(ao, roughnessFactor, metallicFactor, outAlbedo.a);
|
||||
|
||||
}
|
||||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 512;
|
||||
const int MAX_TEXTURES = 128;
|
||||
|
||||
layout(location = 0) in vec4 inPos;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
|
|
@ -37,7 +37,7 @@ void main()
|
|||
Material material = matUniform.materials[push_constants.materialIdx];
|
||||
if(material.hasTexture == 1){
|
||||
vec4 texColor = texture(textSampler[material.textureIdx],inTextCoords);
|
||||
if(texColor.a < 0.05 || texColor.a >= 0.9){discard;}
|
||||
if(texColor.a >= 0.9){discard;}
|
||||
outAlbedo = texColor;
|
||||
} else{
|
||||
outAlbedo = material.diffuseColor;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,6 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 512;
|
||||
const int MAX_TEXTURES = 128;
|
||||
|
||||
layout(location = 0) in vec4 inPos;
|
||||
layout(location = 1) in vec3 inNormal;
|
||||
|
|
@ -13,6 +13,14 @@ layout(location = 0) out vec4 outPos;
|
|||
layout(location = 2) out vec4 outNormal;
|
||||
layout(location = 3) out vec4 outPBR;
|
||||
|
||||
const float bayerMatrix[16] = float[](
|
||||
0.0 / 16.0, 8.0 / 16.0, 2.0 / 16.0, 10.0 / 16.0,
|
||||
12.0 / 16.0, 4.0 / 16.0, 14.0 / 16.0, 6.0 / 16.0,
|
||||
3.0 / 16.0, 11.0 / 16.0, 1.0 / 16.0, 9.0 / 16.0,
|
||||
15.0 / 16.0, 7.0 / 16.0, 13.0 / 16.0, 5.0 / 16.0
|
||||
);
|
||||
|
||||
|
||||
struct Material {
|
||||
vec4 diffuseColor;
|
||||
uint hasTexture;
|
||||
|
|
@ -57,7 +65,7 @@ void main()
|
|||
}
|
||||
|
||||
|
||||
if(outAlbedo.a < 0.05 || outAlbedo.a >= 0.75) discard;
|
||||
if(outAlbedo.a >= 0.75 || outAlbedo.a < 0.05f) discard;
|
||||
|
||||
mat3 TBN = mat3(inTangent, inBitangent, inNormal);
|
||||
vec3 newNormal = calcNormal(material, inNormal, inTextCoords, TBN);
|
||||
|
|
|
|||
Binary file not shown.
5
resources/EngineResources/shaders/shadow_frag.glsl
Normal file
5
resources/EngineResources/shaders/shadow_frag.glsl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#version 450
|
||||
|
||||
void main() {
|
||||
|
||||
}
|
||||
5
resources/EngineResources/shaders/shadow_geometry.glsl
Normal file
5
resources/EngineResources/shaders/shadow_geometry.glsl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#version 450
|
||||
|
||||
void main() {
|
||||
|
||||
}
|
||||
5
resources/EngineResources/shaders/shadow_vertex.glsl
Normal file
5
resources/EngineResources/shaders/shadow_vertex.glsl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#version 450
|
||||
|
||||
void main() {
|
||||
|
||||
}
|
||||
11
resources/EngineResources/shaders/skybox_fragment.glsl
Normal file
11
resources/EngineResources/shaders/skybox_fragment.glsl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#version 450
|
||||
|
||||
layout(location = 0) in vec3 outTexCoords;
|
||||
|
||||
layout(location = 1) out vec4 outColor;
|
||||
|
||||
layout(set = 2, binding = 0) uniform samplerCube skyboxSampler;
|
||||
|
||||
void main() {
|
||||
outColor = vec4(texture(skyboxSampler, outTexCoords).rgb, 1.0);
|
||||
}
|
||||
18
resources/EngineResources/shaders/skybox_vertex.glsl
Normal file
18
resources/EngineResources/shaders/skybox_vertex.glsl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#version 450
|
||||
layout(location = 0) in vec3 inPosition;
|
||||
layout(location = 0) out vec3 outTexCoords;
|
||||
|
||||
layout(set = 0, binding = 0) uniform ProjectionBuffer {
|
||||
mat4 proj;
|
||||
} uboProj;
|
||||
|
||||
layout(set = 1, binding = 0) uniform ViewBuffer {
|
||||
mat4 view;
|
||||
} uboView;
|
||||
|
||||
void main() {
|
||||
outTexCoords = inPosition;
|
||||
mat4 skyView = mat4(mat3(uboView.view));
|
||||
vec4 pos = uboProj.proj * skyView * vec4(inPosition, 1.0);
|
||||
gl_Position = vec4(pos.xy, 0.0, pos.w);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue