Set up light
In this section, I will introduce you how to set up lights.
So, I expect you to already be able to set up the basic manga-style scene.
If not, you can check out the
Set up scene section.
const mangaDirectionalLight = new MangaDirectionalLight(-2, 2, 2, -2, 1, 5)
const mangaShaderManager = new ThreeManga.MangaShaderManager({
renderer: renderer,
scene: scene,
camera: camera,
lightList: [],
resolution: new THREE.Vector2(window.innerWidth, window.innerHeight),
})
You will notice there’s a field named “lightList”. You can add light to “lightList” like this.
const mangaDirectionalLight = new MangaDirectionalLight(-2, 2, 2, -2, 1, 5)
mangaDirectionalLight.position.z = 2
mangaDirectionalLight.position.x = 2
mangaDirectionalLight.position.y = 2
const mangaShaderManager = new ThreeManga.MangaShaderManager({
renderer: renderer,
scene: scene,
camera: camera,
lightList: [mangaDirectionalLight],
resolution: new THREE.Vector2(window.innerWidth, window.innerHeight),
})
// ...
mangaDirectionalLight.lookAt(mesh.position)
// ...
const lightHelper = new THREE.CameraHelper(mangaDirectionalLight)
scene.add(lightHelper)
// ...
You can modify rendering behavior by tweak material properties. Learn more about it in the
MangaMaterial section.