feat: PBR shading — Cook-Torrance BRDF with ACES tonemapping
- Vertex shader: passes world position, world normal, albedo to fragment - Fragment shader: full PBR implementation - D term: Trowbridge-Reitz GGX distribution - G term: Smith geometry with Schlick-GGX - F term: Schlick Fresnel approximation - kD/kS split based on metallic - Directional light (0.5, 0.8, 0.3) with warm color - Ambient term (0.15, 0.18, 0.22) for fill light - ACES filmic tonemapping - Gamma 2.2 correction - Fixed roughness=0.5, metallic=0.1 (per-object materials = future) - No C# code changes — pure shader upgrade
This commit is contained in:
@@ -4,8 +4,9 @@ layout(location = 0) in vec3 inPosition;
|
||||
layout(location = 1) in vec3 inColor;
|
||||
layout(location = 2) in vec3 inNormal;
|
||||
|
||||
layout(location = 0) out vec3 fragColor;
|
||||
layout(location = 0) out vec3 fragWorldPos;
|
||||
layout(location = 1) out vec3 fragNormal;
|
||||
layout(location = 2) out vec3 fragAlbedo;
|
||||
|
||||
layout(set = 0, binding = 0) uniform CameraUBO {
|
||||
mat4 vp;
|
||||
@@ -16,7 +17,9 @@ layout(push_constant) uniform PC {
|
||||
} pc;
|
||||
|
||||
void main() {
|
||||
gl_Position = vp * pc.model * vec4(inPosition, 1.0);
|
||||
fragColor = inColor;
|
||||
vec4 worldPos = pc.model * vec4(inPosition, 1.0);
|
||||
gl_Position = vp * worldPos;
|
||||
fragWorldPos = worldPos.xyz;
|
||||
fragNormal = mat3(pc.model) * inNormal;
|
||||
fragAlbedo = inColor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user