-
Some neat TS tricks in this article https://www.cstrnt.dev/blog/three-typescript-tricks
-
I dont use
ReadOnly
enough to enforce i’m not mutating things, -
Record
is a utility type to make typing objects easier. -
In fact there are loads of utility types to use! - https://www.typescriptlang.org/docs/handbook/utility-types.html
-
Some more shadow fun in Three.js, there a bunch of shadow map algorithms that can be used:
-
THREE.BasicShadowMap Very performant but lousy quality
-
THREE.PCFShadowMap Less performant but smoother edges
-
THREE.PCFSoftShadowMap Less performant but even softer edges
-
THREE.VSMShadowMap Less performant, more constraints, can have unexpected results
-
Rule of thumb, try to avoid using dynamic shadows as it uses a lot of CPU. A good alternative is to use ‘baked shadows’.
-
A cool technique with baked shadows is add the a shadow texture to a mesh and place the mesh directly underneath a 3D object. You can adjust the opacity of the mesh to create different lighting levels.