UNPKG

playcanvas

Version:

PlayCanvas WebGL game engine

27 lines (22 loc) 510 B
var composeSsaoPS = ` #ifdef SSAO #define SSAO_TEXTURE #endif #if DEBUG_COMPOSE == ssao #define SSAO_TEXTURE #endif #ifdef SSAO_TEXTURE var ssaoTexture: texture_2d<f32>; var ssaoTextureSampler: sampler; var<private> dSsao: f32; fn applySsao(color: vec3f, uv: vec2f) -> vec3f { dSsao = textureSampleLevel(ssaoTexture, ssaoTextureSampler, uv, 0.0).r; #ifdef SSAO return color * dSsao; #else return color; #endif } #endif `; export { composeSsaoPS as default };