Skip to content

Instantly share code, notes, and snippets.

View lukeschaefer's full-sized avatar

Luke Schaefer lukeschaefer

View GitHub Profile

MeshLaserMaterial:

export function MeshLaserMaterial() {
    // One horizontal orange-red beam:
    const beams = [{
      pointA: new THREE.Vector3(-4, 0, 0),
      pointB: new THREE.Vector3(4, 0, 0),
      color: new THREE.Color(0xff8844)
    }];
@lukeschaefer
lukeschaefer / MeshBakedMaterial.md
Last active June 13, 2024 13:21
How to mix Baked Textures and Physically Based Rendering in ThreeJS

How to mix Baked Textures and Physically Based Rendering in ThreeJS

When baking a texture in Blender (or other 3D editing software) and using it in ThreeJS as a MeshBasicMaterial - it will not interact with any lighting in your scene. If you try to use a material that will (EG MeshStandardMaterial) you'll find that your baked textures don't look right - because they're being lit both during the baking and the real-time-rendering.

Using this material will allow you to have specular reflections (EG glossy or shiny textures) while still maintaining baked lighting. Here's an example of what I'm talking about:

Bake Technique Comparison