CSS 2D / 3D Rendering

Hey Gang,

How would I go about achieving something like this:


Assume I already have the background running against a standard webgl renderer, with a 2D and 3D renderer layered on top.

I want to be able to render the stuff in white as an overlay - I want to draw lines which start fixed on the left aligned to some boxes (maybe also drawn with the css renderer?) and then the other side of the point bound to 3d positions of objects? Hope that makes sense, let me know!

1 Like

Three.js is your friend, that helps you to achieve the desired result in many ways, having enough stuff to get coords on the screen (see three.js docs)

Video:

Demo: https://codepen.io/prisoner849/full/empWXzw

Heads are InstancedMesh.

Lines are divs. All the math for them I took from here: html - Better way to draw lines? - Stack Overflow

PS It’s not the ultimale solution, it’s just an example.

8 Likes

I am in awe that you recreated both the scene and the requested idea, in such a short space of time! Absolute legend!

Any chance you have a fiddle / sandbox I could study? I appreciate you gave me all the pieces, but just incase!

OSR

Link added to my previous post :handshake:

1 Like

My guy, thank you :slight_smile:

1 Like