Files
Cortex_Engine/src/Engine.Graphics.Vulkan/Shaders/triangle.vert
T
emil28092005 22748ed9ba 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
2026-06-18 19:18:01 +03:00

26 lines
592 B
GLSL

#version 450
layout(location = 0) in vec3 inPosition;
layout(location = 1) in vec3 inColor;
layout(location = 2) in vec3 inNormal;
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;
};
layout(push_constant) uniform PC {
mat4 model;
} pc;
void main() {
vec4 worldPos = pc.model * vec4(inPosition, 1.0);
gl_Position = vp * worldPos;
fragWorldPos = worldPos.xyz;
fragNormal = mat3(pc.model) * inNormal;
fragAlbedo = inColor;
}