Quiz
- Are components of a group object in Three.js considered its
children? If so, are grandchildren of a group object also considered
part of the group?
Great question! I think, as with human families, it matters what question you are asking.
For CG, the question is whether a transformation of the group (TRS: Translation, Rotation, Scaling) applies to the children, grandchildren, and all descendants. And for that, the answer is a resounding yes. Think of the snake or the mobile.
I'm 99% sure that toggling the
visibile
attribute of the group would toggle the entire tree of descendants.There may be operations that aren't extensive like these, but none come to mind at the moment. E.g. each descendant has its own material; ther's no such thing as the material of the group.
- I would love some clarification on what calculations you went through to make sure that the next shape's origin is exactly the previous shapes's base (for example for the snake, or with the legs connecting at the hip).
In the case of the snake, the calculation was almost trivial. For the hip of the teddy bear, I wanted them to stick inside a bit, and that required a bit of trial and error, but not much in the way of calculation.
- I was wondering, in real life when building complex models, how do we decide when to use iteration (loops) versus recursion for constructing a scene graph?
Another great question. Today in class, I'm going to encourage you to build a model "bottom-up", which is very much a recursive mindset.
I was going to say that you should choose whichever way is more intuitive for you, but I think that encourages you to stick with what is familiar (iteration) and avoid what is less comfortable (recursion). Recursion is a powerful idea, and it's worth becoming more comfortable with.
So, if you are modeling an N-story building, you could use iteration, or you could say an N-story building is a single story on top of an N-1 story building.
- What is the difference between adding a mesh to a group before vs. after transforming it?
None at all. You are just modifying a data structure. Rendering happens later.
- None so far :) / No questions so far. / thank you for the reading!