\( \newcommand{\vecIII}[3]{\left[\begin{array}{c} #1\\\\#2\\\\#3 \end{array}\right]} \newcommand{\vecIV}[4]{\left[\begin{array}{c} #1\\\\#2\\\\#3\\\\#4 \end{array}\right]} \newcommand{\Choose}[2]{ { { #1 }\choose{ #2 } } } \newcommand{\vecII}[2]{\left[\begin{array}{c} #1\\\\#2 \end{array}\right]} \newcommand{\vecIII}[3]{\left[\begin{array}{c} #1\\\\#2\\\\#3 \end{array}\right]} \newcommand{\vecIV}[4]{\left[\begin{array}{c} #1\\\\#2\\\\#3\\\\#4 \end{array}\right]} \newcommand{\matIIxII}[4]{\left[ \begin{array}{cc} #1 & #2 \\\\ #3 & #4 \end{array}\right]} \newcommand{\matIIIxIII}[9]{\left[ \begin{array}{ccc} #1 & #2 & #3 \\\\ #4 & #5 & #6 \\\\ #7 & #8 & #9 \end{array}\right]} \)

Quiz

  1. does the fake shadow only work on b/w planes?

    Yes, I believe so, because it's just a texture, and would need to be mapped onto a surface. If the surface is similar to a plane (maybe a slightly curvy ground, then it would probably work fine. But texture-mapping onto a sphere (the ball below it?) might be difficult to get to look right.

    In the example, it's a grayish circle below the sphere, texture-mapped onto the "ground"

  2. if we specify that a mesh casts a shadow when or not when we create it, if we then put it in a group will it no longer cast a shadow? Or will that group specifically not cast a shadow, but the individual mesh will. Could then this be an alternative to the childrenShadows() function

    Ah, I've misled you. Sorry. A mesh casts a shadow, but if you have a tree that is a Group of two meshes and set the castShadow property on that Group, that property is ignored. You'd like it to apply to all the meshes that are descendants, but that's not the case. (It would be an easy feature to add, though.)

    So, you just traverse the Group and mark all the meshes that are within it.

    The meshes are still in a Group, and marking the meshes works fine.

  3. I'm wondering why only Mesh objects can cast shadows and not the entire group or an object made using Object3d? It seems like it's not possible to make a figure using group and then giving it a shadow which is relative to each part of the figure? can you talk about that a little bit?

    I think this is a variant of the previous question.

  4. are there ways to personalize the shadows, colors for example? or blurriness and such, or are these all calculated and decided based on the specified light

    Great question. Here's what I learned from ChatGPT:

    Yes, you can absolutely personalize shadows in Three.js! While the default shadow behavior depends heavily on the type of light you're using, you still have a bunch of ways to customize how shadows appear. Here's a breakdown of what you can tweak:

    • Shadow Blurriness (Softness)
      Blurriness is mostly controlled via the shadow map resolution and the shadow radius.
      
      light.shadow.mapSize.width = 1024;
      light.shadow.mapSize.height = 1024;
      light.shadow.radius = 4; // Works with PCFSoftShadowMap
      
      
      

      Use renderer.shadowMap.type = THREE.PCFSoftShadowMap for softer shadows.

    • Shadow Color
      You can't directly change the shadow color, but you can fake it by using a transparent plane (like a projector) or a custom shadow material. Here's a cool trick using a ShadowMaterial:
      
      const shadowMat = new THREE.ShadowMaterial({ opacity: 0.5 });
      shadowMat.color.set('#ff0000'); // red-tinted shadow
      
      

      This only works with meshes that receive shadows, so you’d apply it to a plane or ground mesh.

    • 3. Light Type Affects Shadows
      • DirectionalLight – great for sunlight; can cast detailed shadows
      • SpotLight – nice for spotlight cones; supports shadow blurring and focus
      • PointLight – omnidirectional, but expensive; more limited control
  5. Thank you for the reading!

    You're welcome!