Shader chunk to add to the head of a fragment shader to be able to use PBR shading.
var color: vec4f = vec4(1.0);let specularColor: vec3f = vec3(1.0);let specularIntensity: f32 = 1.0;let metallic: f32 = 0.5;let roughness: f32 = 0.5;let ior: f32 = 1.5;let transmission: f32 = 0.0;let dispersion: f32 = 0.0;let thickness: f32 = 0.0;let attenuationDistance: f32 = 1.0e38; // Should be infinity or closelet attenuationColor: vec3f = vec3(1.0);color = getPBR( normal, worldPosition, color, viewDirection, metallic, roughness, specularIntensity, specularColor, ior, transmission, dispersion, thickness, attenuationDistance, attenuationColor,); Copy
var color: vec4f = vec4(1.0);let specularColor: vec3f = vec3(1.0);let specularIntensity: f32 = 1.0;let metallic: f32 = 0.5;let roughness: f32 = 0.5;let ior: f32 = 1.5;let transmission: f32 = 0.0;let dispersion: f32 = 0.0;let thickness: f32 = 0.0;let attenuationDistance: f32 = 1.0e38; // Should be infinity or closelet attenuationColor: vec3f = vec3(1.0);color = getPBR( normal, worldPosition, color, viewDirection, metallic, roughness, specularIntensity, specularColor, ior, transmission, dispersion, thickness, attenuationDistance, attenuationColor,);
parameters used to append the right chunks and calculate the PBR shading.
Shader chunk to add to the head of a fragment shader to be able to use PBR shading.
Example