Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "shaders/chunks/envmap_fragment"

Index

Variables

Variables

Const envmap_fragment

envmap_fragment: "#ifdef USE_ENVMAPvec3 cameraToFrag;if (isOrthographic) {cameraToFrag = normalize(vec3(-viewMatrix[0][2], -viewMatrix[1][2], -viewMatrix[2][2]));} else {cameraToFrag = normalize(worldPosition - cameraPosition);}vec3 worldNormal = inverseTransformDirection(normal, viewMatrix);#ifdef ENVMAP_MODE_REFLECTIONvec3 reflectVec = reflect(cameraToFrag, worldNormal);#elsevec3 reflectVec = refract(cameraToFrag, worldNormal, refractionRatio);#endifvec4 envColor = textureCube(envMap, vec3(flipEnvMap * reflectVec.x, reflectVec.yz));envColor = envMapTexelToLinear(envColor);#ifdef ENVMAP_BLENDING_MULTIPLYoutgoingLight = mix(outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity);#elif defined(ENVMAP_BLENDING_MIX)outgoingLight = mix(outgoingLight, envColor.xyz, specularStrength * reflectivity);#elif defined(ENVMAP_BLENDING_ADD)outgoingLight += envColor.xyz * specularStrength * reflectivity;#endif#endif" = `#ifdef USE_ENVMAPvec3 cameraToFrag;if (isOrthographic) {cameraToFrag = normalize(vec3(-viewMatrix[0][2], -viewMatrix[1][2], -viewMatrix[2][2]));} else {cameraToFrag = normalize(worldPosition - cameraPosition);}vec3 worldNormal = inverseTransformDirection(normal, viewMatrix);#ifdef ENVMAP_MODE_REFLECTIONvec3 reflectVec = reflect(cameraToFrag, worldNormal);#elsevec3 reflectVec = refract(cameraToFrag, worldNormal, refractionRatio);#endifvec4 envColor = textureCube(envMap, vec3(flipEnvMap * reflectVec.x, reflectVec.yz));envColor = envMapTexelToLinear(envColor);#ifdef ENVMAP_BLENDING_MULTIPLYoutgoingLight = mix(outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity);#elif defined(ENVMAP_BLENDING_MIX)outgoingLight = mix(outgoingLight, envColor.xyz, specularStrength * reflectivity);#elif defined(ENVMAP_BLENDING_ADD)outgoingLight += envColor.xyz * specularStrength * reflectivity;#endif#endif`

Generated using TypeDoc