HDR, Bloom and SSR
This commit is contained in:
parent
577836a03f
commit
04befce27d
44 changed files with 1377 additions and 269 deletions
|
|
@ -7,6 +7,7 @@ layout(location = 1) in vec3 inNormal;
|
|||
layout(location = 2) in vec3 inTangent;
|
||||
layout(location = 3) in vec3 inBitangent;
|
||||
layout(location = 4) in vec2 inTextCoords;
|
||||
layout(location = 5) in mat4 viewMatrix;
|
||||
|
||||
layout(location = 1) out vec4 outAlbedo ;
|
||||
layout(location = 0) out vec4 outPos;
|
||||
|
|
@ -15,6 +16,7 @@ layout(location = 3) out vec4 outPBR;
|
|||
layout(location = 4) out vec4 outEmissive;
|
||||
layout(location = 5) out vec4 outTranslucency;
|
||||
layout(location = 6) out vec4 outOpacity;
|
||||
layout(location = 7) out vec4 outViewPos;
|
||||
|
||||
const float bayerMatrix[16] = float[](
|
||||
0.0 / 16.0, 8.0 / 16.0, 2.0 / 16.0, 10.0 / 16.0,
|
||||
|
|
@ -43,6 +45,10 @@ struct Material {
|
|||
uint hasOpacityMap; //88
|
||||
uint OpacityMapIdx; //92
|
||||
float OpacityFactor; //96
|
||||
float reflectiveness; //100
|
||||
float refractiveness; //104
|
||||
float Padding1; //108
|
||||
float Padding2; //112
|
||||
};
|
||||
|
||||
layout(set = 2, binding = 0) readonly buffer MaterialUniform {
|
||||
|
|
@ -69,6 +75,10 @@ layout(push_constant) uniform pc {
|
|||
void main()
|
||||
{
|
||||
outPos = inPos;
|
||||
|
||||
vec4 viewPos = vec4(viewMatrix * vec4(inPos.xyz, 1.0));
|
||||
outViewPos = viewPos;
|
||||
|
||||
Material material = matUniform.materials[push_constants.materialIdx];
|
||||
int textureIndex = int(material.textureIdx);
|
||||
if (textureIndex >= MAX_TEXTURES){
|
||||
|
|
@ -98,11 +108,11 @@ void main()
|
|||
|
||||
outAlbedo = vec4(outAlbedo.rgb, opacityf);
|
||||
|
||||
if(outAlbedo.a >= 0.75 || outAlbedo.a < 0.05f) discard;
|
||||
if(outAlbedo.a >= 0.9 || outAlbedo.a <= 0.1) discard;
|
||||
|
||||
mat3 TBN = mat3(inTangent, inBitangent, inNormal);
|
||||
vec3 newNormal = calcNormal(material, inNormal, inTextCoords, TBN);
|
||||
outNormal = vec4(newNormal, outAlbedo.a);
|
||||
|
||||
|
||||
float ao = 0.5f;
|
||||
float roughnessFactor = 0.0f;
|
||||
|
|
@ -128,6 +138,9 @@ void main()
|
|||
}
|
||||
outTranslucency = Translucency;
|
||||
|
||||
outPBR = vec4(ao, roughnessFactor, metallicFactor, outAlbedo.a);
|
||||
float Refractiveness = material.refractiveness;
|
||||
float Reflectiveness = material.reflectiveness;
|
||||
|
||||
outNormal = vec4(newNormal, Refractiveness);
|
||||
outPBR = vec4(ao, roughnessFactor, metallicFactor, Reflectiveness);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue