playcanvas
Version:
PlayCanvas WebGL game engine
230 lines (184 loc) • 6.28 kB
JavaScript
// includes and functionality of the front end shader, generates the input to the lit shader.
var stdFrontEndPS = /* glsl */ `
// all passes handle opacity
// dithering
// parallax
// diffuse
// normal
// refraction
// iridescence
// specularity & glossiness
// sheen
// metalness
// specularity factor
// specular color
void getSpecularity() {
dSpecularity = vec3(1);
}
// gloss
// ao
// emission
// clearcoat
// anisotropy
// lightmap
void evaluateFrontend() {
// all passes handle opacity
getOpacity();
alphaTest(dAlpha);
opacityDither(dAlpha, 0.0);
litArgs_opacity = dAlpha;
// parallax
getParallax();
// diffuse
getAlbedo();
litArgs_albedo = dAlbedo;
// normal
getNormal();
litArgs_worldNormal = dNormalW;
// refraction
getRefraction();
litArgs_transmission = dTransmission;
getThickness();
litArgs_thickness = dThickness;
litArgs_dispersion = material_dispersion;
// iridescence
getIridescence();
getIridescenceThickness();
litArgs_iridescence_intensity = dIridescence;
litArgs_iridescence_thickness = dIridescenceThickness;
// specularity & glossiness
// sheen
getSheen();
litArgs_sheen_specularity = sSpecularity;
getSheenGlossiness();
litArgs_sheen_gloss = sGlossiness;
// metalness
getMetalness();
litArgs_metalness = dMetalness;
getIor();
litArgs_ior = dIor;
// specularity factor
getSpecularityFactor();
litArgs_specularityFactor = dSpecularityFactor;
// gloss
getGlossiness();
getSpecularity();
litArgs_specularity = dSpecularity;
litArgs_gloss = dGlossiness;
// ao
getAO();
litArgs_ao = dAo;
// emission
getEmission();
litArgs_emission = dEmission;
// clearcoat
getClearCoat();
getClearCoatGlossiness();
getClearCoatNormal();
litArgs_clearcoat_specularity = ccSpecularity;
litArgs_clearcoat_gloss = ccGlossiness;
litArgs_clearcoat_worldNormal = ccNormalW;
// anisotropy
getAnisotropy();
// lightmap
getLightMap();
litArgs_lightmap = dLightmap;
litArgs_lightmapDir = dLightmapDir;
}
`;
export { stdFrontEndPS as default };