Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/threejs_4_deno/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js>default

A simple transformation of three.js for use within a Deno workflow
Go to Latest
variable default
import { default } from "https://deno.land/x/threejs_4_deno@v121/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js";

type

` #ifdef FLAT_SHADED // Workaround for Adreno/Nexus5 not able able to do dFdx( vViewPosition ) ... vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) ); vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 ); #endif #ifdef USE_TANGENT vec3 tangent = normalize( vTangent ); vec3 bitangent = normalize( vBitangent ); #ifdef DOUBLE_SIDED tangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 ); bitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 ); #endif #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) mat3 vTBN = mat3( tangent, bitangent, normal ); #endif #endif #endif // non perturbed normal for clearcoat among others vec3 geometryNormal = normal; `