Particle system improvements + Emissive materials

Added option for Global particle positions
Added material property for particles
Added Emissive rendering
This commit is contained in:
Antoine Pilote
2023-09-23 20:31:50 -04:00
parent 50bc020f6e
commit 2cb0ca4f29
17 changed files with 242 additions and 26 deletions

View File

@@ -65,6 +65,7 @@ layout(location = 0) out vec4 gAlbedo;
layout(location = 1) out vec4 gNormal;
layout(location = 2) out vec4 gMaterial;
layout(location = 3) out int gEntityID;
layout(location = 4) out float gEmissive;
in vec3 FragPos;
in vec2 UV;
@@ -92,6 +93,7 @@ layout(std140, binding = 32) uniform u_MaterialUniform
int u_HasNormal; // 56 byte
int u_HasDisplacement; // 60 byte
int u_Unlit;
float u_Emissive;
};
void main()
@@ -102,10 +104,10 @@ void main()
normal = texture(m_Normal, UV).rgb;
normal = normal * 2.0 - 1.0;
normal = TBN * normalize(normal);
gNormal = vec4(normal / 2.0 + 0.5, 1.0);
gNormal = vec4(normal / 2.0 + 0.5, 1.0f);
// Albedo
gAlbedo = vec4(m_AlbedoColor, 1.0);
gAlbedo = vec4(m_AlbedoColor, 1.0f);
if (u_HasAlbedo == 1)
{
vec4 albedoSample = texture(m_Albedo, UV);
@@ -131,10 +133,11 @@ void main()
if (u_HasRoughness == 1)
finalRoughness = texture(m_Roughness, UV).r;
gMaterial = vec4(0, 0, 0, 1);
gMaterial = vec4(0, 0, 0, u_Unlit);
gMaterial.r = finalMetalness;
gMaterial.g = finalAO;
gMaterial.b = finalRoughness;
gEntityID = int(u_EntityID);
gEmissive = u_Emissive;
}