import type { TSLFloatNode, TSLFunction, TSLTextureInput, TSLVec3Node, TSLVec4Node } from '../types/tsl.js'; /** Float node or numeric literal accepted by biplanar mapping controls. */ export type BiplanarFloatInput = TSLFloatNode | number; /** Arguments accepted by {@link biplanarTexture}. */ export type BiplanarTextureArguments = [ textureX: TSLTextureInput, textureY?: TSLTextureInput | null, textureZ?: TSLTextureInput | null, scale?: BiplanarFloatInput, position?: TSLVec3Node, normal?: TSLVec3Node, hardness?: BiplanarFloatInput ]; /** * Efficient biplanar texture mapping for world-space triplanar-style effects. * Samples only the two most dominant axis projections and blends them, * reducing texture fetches compared to full triplanar mapping. * * **Algorithm** * - Determines the two dominant axes based on surface normal * - Projects position onto corresponding planes (XY, YZ, ZX) * - Samples textures with proper derivatives for mipmapping * - Blends samples using weighted power curve for smooth transitions * * **Benefits** * - 33% fewer texture samples than triplanar (2 vs 3) * - Avoids visible seams on axis-aligned surfaces * - Supports per-axis texture variation * - Automatic mipmap derivatives via `grad()` * * ```js * import { biplanarTexture } from 'three-blocks'; * import { texture, float } from 'three/tsl'; * * const diffuseTex = texture(diffuseMap); * const normalTex = texture(normalMap); * * // Same texture on all axes with 2x tiling * material.colorNode = biplanarTexture(diffuseTex, null, null, float(2)); * * // Different textures per axis * material.colorNode = biplanarTexture( * texture(texX), // YZ plane * texture(texY), // ZX plane * texture(texZ), // XY plane * float(1), // scale * positionLocal, // position * normalLocal, // normal * float(8) // blend hardness * ); * ``` * * @function biplanarTexture * @short Biplanar world-space mapping that blends the two dominant axes for triplanar-like results with fewer samples. * @category TSL * @tsl * @tags WebGPU, WebGL * @param {Node} textureXNode Texture sampled on YZ plane (X-axis projection). * @param {Node} [textureYNode=textureXNode] Texture sampled on ZX plane (Y-axis projection). * @param {Node} [textureZNode=textureXNode] Texture sampled on XY plane (Z-axis projection). * @param {Node.} [scaleNode=1] UV coordinate scale multiplier. * @param {Node.} [positionNode=positionLocal] Fragment position for UV projection. * @param {Node.} [normalNode=normalLocal] Surface normal for axis weight calculation. * @param {Node.} [hardnessNode=8] Blend sharpness (higher = sharper transitions). * @returns {Node.} Blended texture color (RGBA). */ export declare const biplanarTexture: TSLFunction;