(sigh) I would like to have your ability to explain things
-
Having a mesh, build a Box3 object from it.
-
Having that box and using
Raycaster
, in the triple loop (x, y, z), cast rays, where ray’s origin is the current position inside the box in accordance to values of the loop (x, y, z), and ray’s direction is a random normalized vector.
2.1. Check the result of raycast against the mesh. The same way, described here: Sand Nefertiti (three-mesh-bvh) (first hit + dot-product of raycaster’s ray and mesh’s normal). If we’re inside of the mesh, push 1 intodata
array, otherwise push 0. -
Having filled
data
array, createDataTexture3D
object. -
Having that 3D texture, do/create cool/awesome stuff I used this texture with 3d grid of lines, discarding the parts, that is not in the model. I modified the example, added one more uniform to cancel the discarding. When you set
noDiscard
totrue
, you’ll see full cubic grid of magenta. Set it to false, and lines will remain only inside of the dragon.