Loading...
Loading...
Compare original and translation side by side
import * as THREE from 'three/webgpu';
import { color, time, oscSine } from 'three/tsl';
const renderer = new THREE.WebGPURenderer();
await renderer.init();
const material = new THREE.MeshStandardNodeMaterial();
material.colorNode = color(0xff0000).mul(oscSine(time));import * as THREE from 'three/webgpu';
import { color, time, oscSine } from 'three/tsl';
const renderer = new THREE.WebGPURenderer();
await renderer.init();
const material = new THREE.MeshStandardNodeMaterial();
material.colorNode = color(0xff0000).mul(oscSine(time));docs/core-concepts.mddocs/materials.mddocs/compute-shaders.mddocs/post-processing.mddocs/wgsl-integration.mddocs/device-loss.mddocs/core-concepts.mddocs/materials.mddocs/compute-shaders.mddocs/post-processing.mddocs/wgsl-integration.mddocs/device-loss.mdexamples/basic-setup.jsexamples/custom-material.jsexamples/particle-system.jsexamples/post-processing.jsexamples/earth-shader.jsexamples/basic-setup.jsexamples/custom-material.jsexamples/particle-system.jsexamples/post-processing.jsexamples/earth-shader.jstemplates/webgpu-project.jstemplates/compute-shader.jstemplates/webgpu-project.jstemplates/compute-shader.jsREFERENCE.mdREFERENCE.md// Always use the WebGPU entry point
import * as THREE from 'three/webgpu';
import { /* TSL functions */ } from 'three/tsl';// Always use the WebGPU entry point
import * as THREE from 'three/webgpu';
import { /* TSL functions */ } from 'three/tsl';material.colorNode = texture(map); // instead of material.map
material.roughnessNode = float(0.5); // instead of material.roughness
material.positionNode = displaced; // vertex displacementmaterial.colorNode = texture(map); // instead of material.map
material.roughnessNode = float(0.5); // instead of material.roughness
material.positionNode = displaced; // vertex displacement// Instead of: sin(time * 2.0 + offset) * 0.5 + 0.5
time.mul(2.0).add(offset).sin().mul(0.5).add(0.5)// Instead of: sin(time * 2.0 + offset) * 0.5 + 0.5
time.mul(2.0).add(offset).sin().mul(0.5).add(0.5)Fn()const fresnel = Fn(([power = 2.0]) => {
const nDotV = normalWorld.dot(viewDir).saturate();
return float(1.0).sub(nDotV).pow(power);
});Fn()const fresnel = Fn(([power = 2.0]) => {
const nDotV = normalWorld.dot(viewDir).saturate();
return float(1.0).sub(nDotV).pow(power);
});webgpu_webgpu_