HDR, Bloom and SSR
This commit is contained in:
parent
577836a03f
commit
04befce27d
44 changed files with 1377 additions and 269 deletions
|
|
@ -27,6 +27,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 = 1, binding = 0) uniform sampler2D textSampler[MAX_TEXTURES];
|
||||
layout(set = 2, binding = 0) readonly buffer MaterialUniform {
|
||||
|
|
@ -35,7 +39,21 @@ layout(set = 2, binding = 0) readonly buffer MaterialUniform {
|
|||
|
||||
void main()
|
||||
{
|
||||
|
||||
Material material = matUniform.materials[inMaterialIdx];
|
||||
|
||||
float Refractiveness = material.refractiveness;
|
||||
float Reflectiveness = material.reflectiveness;
|
||||
float Translucency = material.translucencyFactor;
|
||||
float Opacity = material.OpacityFactor;
|
||||
if(material.hasTranslucencyMap > 0){
|
||||
vec4 translucencyMap = texture(textSampler[material.translucencyMapIdx], inTextCoords);
|
||||
Translucency = (translucencyMap.x + translucencyMap.y + translucencyMap.z)/3.0;
|
||||
}
|
||||
if(material.hasOpacityMap > 0){
|
||||
vec4 opacityMap = texture(textSampler[material.OpacityMapIdx], inTextCoords);
|
||||
Opacity = (opacityMap.x + opacityMap.y + opacityMap.z)/3.0;
|
||||
}
|
||||
int textureIndex = int(material.textureIdx);
|
||||
if (textureIndex >= MAX_TEXTURES){
|
||||
outFragColor = vec2(0.0,0.0);
|
||||
|
|
@ -47,7 +65,7 @@ void main()
|
|||
} else {
|
||||
albedo = material.diffuseColor;
|
||||
}
|
||||
if (albedo.a < 0.5) {
|
||||
if (albedo.a < 0.5 || Translucency > 0.5 || Opacity < 0.5) {
|
||||
discard;
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +73,6 @@ void main()
|
|||
float moment1 = depth;
|
||||
float moment2 = depth * depth;
|
||||
|
||||
// Adjust moments to avoid light bleeding
|
||||
float dx = dFdx(depth);
|
||||
float dy = dFdy(depth);
|
||||
moment2 += 0.25 * (dx * dx + dy * dy);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue