2
\$\begingroup\$

I want to add LED strips to objects at runtime. The led strip is a very simple rectangular mesh that is generated at runtime. A shader then just draws LEDs down the length of the strip.

Here is an example, where the meshes has not been triangulated yet. Strip and object

My first thought was to raycast each vertex (of the LED strip mesh) towards the target mesh. But as expected this will not work to wrap around the front of the object.

Partial wrap

Another problem with this way is that if the LED vertices are further apart, a section of the LED strip will clip through the object.

Clipping

I am starting to think the only way to do this is to use the Object's vertex data to build a mesh that conforms to it exactly. This is pretty easy in blender using the knife tool. Unfortunately I have no idea how to approach this with code.

Blender version with strip extruded

What I am trying to achieve here:

Players have a flying wing drone, they can place decals at runtime to customize their plane. This works okay so far, but when it turns into night, I would like LEDS on the plane, so its easier to see. At the moment these LED strips are meshes, so the player cannot customize it at all. enter image description here enter image description here

I would like to start with a blank wing. Then be able to add a LED strip (user can set the length on the go) and then lay it down on the surface of the wing like you can place a decal. This is fairly simple until the path of the strip goes around a bend.

enter image description here

Since decals are projected and cannot make 90 degree turns, my idea was to generate the strip as a mesh at runtime. Then to "walk" the vertices over the model using raycasts. Basically shrink-wrap the strip to the model's mesh. Quickly learned its not a simple process at all.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ This might be easier to do in a pure shader effect or deferred decal, rather than real geometry. Can you tell us more about how this works in the context of your game scene? We could solve it differently if the LED strip needs to wrap around everything vs just one thing, whether it needs to wrap around a full circle or just the fronts of an object, etc. \$\endgroup\$
    – DMGregory
    Oct 3, 2023 at 15:41

0

You must log in to answer this question.

Browse other questions tagged .