pmndrs / three-stdlib

📚 Stand-alone library of threejs examples designed to run without transpilation in node & browser
https://npmjs.com/three-stdlib
MIT License
733 stars 119 forks source link

CSM Shader broken #386

Open Ctrlmonster opened 3 weeks ago

Ctrlmonster commented 3 weeks ago

Problem description:

Creating the CSM fails with the following error: Can not resolve #include <lights_pars_begin> The original library broke with three 157, see issue and PR, but isn't receiving updates anymore from what it looks like. Would be nice to have a working version in here, not sure if these fixes apply in the same way (original library errors in a different way).

Relevant code:

const csm = new CSM({
            maxFar: camera.far,
            cascades: 4,
            shadowMapSize: 1024,
            lightDirection: new Vector3(0, -1, 0).normalize(),
            camera: camera,
            parent: scene
});

const material = new THREE.MeshStandardMaterial(); // works with Phong and Standard materials
csm.setupMaterial(material); // must be called to pass all CSM-related uniforms to the shader