Visible path of an object

I’m newbie with THREE and want to implement this case in 3D. There must be OrbitControls plugin. Should I use layers or something else? Any ideas?

These simple examples from the collection might give you some ideas for the solution.



see also Construction of frames with contour/profile

Great! Thank you! I’ll try.

So, I’ve explored your examples and decided to add some notes. The main point of my 2D example is to have several canvases. The bottom canvas contain the all the paths. And it is a bitmap. There is no huge array of points that must be connected and rendered each time on requestAnimationFrame(). App will work some hours, and number of points will be more than 1 000 000.

Simple algorithm:

  1. Each second get the next coordinates from the server for all the visible objects on the scene.
  2. Render each object and its path.
  3. Add the last paths to the bottom canvas.
  4. Clear other canvases.
  5. Repeat.

That’s why I asked about layers or other solution. On the other hand I understand that I can’t use a bitmap for the Orbit controls. Any ideas?

Line material is your answer here between the last and next coordinate (vector3’s from server ) , the new “positions” of the buffer geometry associated with the drawn line could then be added to your (“bottom layer“)or “master“ buffer geometry containing all points prior to this and rendered to yeild 1 draw call, letting you dispose of the “dynamic” “overlay” geometry, maybe?

Ps. If your vector3 positions are pre computed ( not being drawn from dynamic data ) you can draw the entire geometry positions and use draw range potentially

Hi! Thanks. I’ll be back shortly with my 3D example.

1 Like

Lots of work…
But now i have free time and there is my example: Edit fiddle - JSFiddle - Code Playground

Please need help:

  • ‘points’ is an array of array. Is it good? Maybe there’s another approach?
  • a path is rendered a bit faster then a sphere. Why? How to fix it?

When you say “points is an array of arrays” do you mean to say an array of vector3’s? The function set from points will take an array of vector3’s

No, I mean: points[index of a sphere][array of vector3 paths of the current sphere].
Example: 3 spheres, after getting 2 points:
points = [
[ (Vector3(x, y, z), Vector3(x, y, z), ],
[ (Vector3(x, y, z), Vector3(x, y, z), ],
[ (Vector3(x, y, z), Vector3(x, y, z), ],