Alchemist0823 / three.quarks

Three.quarks is a general purpose particle system / VFX engine for three.js
https://quarks.art
480 stars 22 forks source link

Batched particles: set layer #49

Closed marwie closed 1 year ago

marwie commented 1 year ago

Hey,

is it possible to easily update and/or configure the Object3D.layers mask to a batched system? I don't want to exclude particles from being hit when raycasting

Maybe here? https://github.com/Alchemist0823/three.quarks/blob/7efd8552ba6c8de511453052c1bc41e88388f8f0/src/VFXBatch.ts#L12

Alchemist0823 commented 1 year ago

Currently, three.quarks doesn't support raycasting yet. We may need to implement raycast method in the batchRenderer to make it work. I briefly checked the layer code in threejs, and it only works on cameras and raycaster. We could will propagate the layer setting from particle system parameter to the batch renderer to support camera flow.

Supporting raycast is a different feature. Ultimately, if we want to support physics. we should probably migrate a significant part of code to WebAssembly or WebGPU.

marwie commented 1 year ago

Sorry I wasnt clear maybe: I want to set the layers on the batched meshes so that the three raycaster ignores them - because currently we get hits for the batched mesh geometry when raycasting the scene

Alchemist0823 commented 1 year ago

Gotcha. yeah, we will support a layer setting to avoid hits soon. but the results are incorrect without a customized version of raycast on VFXBatch. I don't know if 1e9e40b209aa3a78379cb60fdf44086954d02b75 fix your problem

marwie commented 1 year ago

Ah cool - I think it would.