Another one of those weirdo Proof Of Concepts, but hey, someone has to do them. I think I just like breaking boundaries from a pure digital world into the real one. Controlling light always feels very rewarding and I might add that, if a game or entertainment would make use of my environment, e.g. control my room’s lighting based on the game- /visual’s atmosphere, I’d probably dig it.
Syncing an LED strip’s brightness to a UE4 Point Light intensity. This is the first article of a series covering this idea, using only a Timeline to animate it.
- Some WS28XX LEDs. I’m using a basic 1m strip.
- An Arduino. Good thing to start with is a cheap Uno
- Actually, only tested on a PC yet
Software / 3rd Party:
- Unreal Engine 4.17
- Socket.io client plugin for UE4
- Visual Micro or Arduino IDE
- NodeJS or anything you feel comfortable in
I’ll keep that short since we’re giving all this a more detailed look in an upcoming article. It won’t surprise you to hear that we’re using Socket.IO and @getnamo‘s plugin to send out the lighting information from UE4. Within a nodeJS application this data gets processed and forwarded to an Arduino. A sketch to refresh 60 LEDs (my 1m strip) with a color based on the data we get from UE4 and it should work. I guess.
About this PoC:
When coding outside of 9-to-5, I tend to take every shortcut I can find. Primarily to minimise the time to get it going plus, if it ever should be scalable, distributable, overall manageable, I’ll be trashing everything and give it a clean shot from scratch. Saying so, all these UE4 Proof of Concepts don’t claim to be the best practice or well written at all. It’s often just the shortest route, so I can eventually say: Yes, that works. I’ve seen that already.
I hate Serial Communication and since I am not the only one, clever people invent clever software to simply provide a socket I can connect to. Communicating with a Socket is cool, it’s like at least post 1998. So, what we’re doing is simply bypassing everything and send data from A (UE4) to B (SerProxy). To do so, I have to create the Socket.IO server and connect to SerProxy within the same application, thus having an additional client. This client also has all the logic, like parsing and interpolating the values from UE4, and so on. But in the end, it just forwards them.
The Blueprint itself is all basic. On KeyPress we’re starting a Timeline which continually change the light intensity as well as sending information to the Socket.IO. A quick sketch looked like this:
The event is fired in the Actor itself, containing both the Cube and the Point Light.
Where to go from here?
We’re going to have a look at all of the code and the Arduino in a followup article. As of now, I am working on changing the LED’s color as well as only lighting parts of the strip. The difficulty in this is sending a ByteArray to be parsed by the Sketch, which is always a little messy. I am pretty sure to get it working soon, though.