Download

Using Material to light up single face on mesh

Hello!

I have the following Torus I want to equip with a funky material:
https://youtube.com/watch?v=9RB_4orS7mE

I want to have each single face light up like tiles when the ball comes close. I have tried a couple things, but nothing really made it possible to achieve the effect I desired. Anybody got any ideas on where to start?

Hi DrLuke,

I spoke with one of our main BP and material guys today and he didn’t know of a way to light up individual polygons this way. He did say if you were using BPs you could find a way to do some really complicated math that would be way more complex than it’s worth to achieve this. He was unsure if it would work properly or not though.

His suggestion was that if you were comfortable with C++ you could write a function that would check your player position and somehow tie that into your mesh to see what polygon it is on. You would have to keep in mind that even though your mesh would be quads when you create it, the engine is going to triangulate this mesh so you would have to calculate for two polygons during this.

His initial suggestion, if it’s a simple enough mesh, would be to lay out your mesh and any pieces you want to light up be a separate mesh that would switch materials when player makes contact.

I hope this helps you out!

Keep up the great work with your project!

Tim

This wouldn’t work on a flat surface, but for the surface in the above image (Inside a torus), you could get the angle of the mesh face directly below the player camera and then clamp that value by a very extreme number. For example - Anything outside the angle 0.0001 would not be lit. Since each polygon in the torus has a greater angle than 0.0001 (meaning the connecting polygons), only the one directly below you “should” be lit if you are running the mask correctly.

P.S. - The one directly above you may also be lit. Simply create a spherical world position mask to then take care of pesky polygons outside your local area.