0

I'm very new at Javascript and coding. I use Three.js to make a scene where there is a glass, in which liquid moves depending upon events (mouseMove, click...). I thought about Constructive Solid Geometry to achieve that, in the way depicted on the following images from a 3D modeling program :

glass scene subtracted liquid

Only the cube would move in position and rotation, to make the liquid look like filling the glass and making "waves". I made some tries using CSG.js with Three.js, but the process seems too costly to be achieved at every frame, and the rendering is not smooth at all.

So my question is, is there any way to make this kind of client-side operation with javascript ? Another API that may help ? Do you think that modeling NURBS with verb.js, subtracting and then making a mesh from the result would be less costly ? Or maybe I'm wrong, it's definitely too costly and I should forget this idea ? Or rather import animations in my scene ?

Any clue would be welcome !

1

1 Answer 1

0

https://stemkoski.github.io/Three.js/CSG.html

Works well. Hth. I've used it for making building. Texture/material support might not be perfect tho

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.