Download

Self-Illuminating Surface

Hey there. Brand new to blueprint, after having UE4 for months and only messing around with level design.

I have big ambitions for my current personal project, and I decided to start with blueprint, then advance to C++ later if I need to. However, the first thing I want to try in blueprint is proving to be very difficult. I have never done coding/visual scripting in a 3D engine before, unless you count GameMaker as a ‘3D’ engine, and the small goals that I have set myself don’t seem too advanced, yet I’m having difficulty with them.

My first goal is to have a self-illuminating surface. I have created a very large hexagonal arena level where the floor is made up of tessellating 2-metre-wide hexagonal prisms to act as tiles for the floor. I’m going for a cyber-esque atmosphere, so I’ve given the tiles a dark material but I want them to light up when any ‘player’ or ‘3rd-person character’ stands on them.

I’ve looked at blending materials, texture effects (it took me 3 hours last night to realise that the material editor was not the same as the event graph, and so far I cannot see how they are able to directly interact), and emissive materials (which went straight over my head at the time). None of the answers I’ve found have come close to solving my particular problem.

Specifically, the effect is supposed to have several steps. The player steps on a floor tile. The tile gradually lights up over 5 seconds, as if the entire tile were one giant LED panel. This light is intended to cause shadows and have all other effects that a real light should. When the panel reaches half of maximum luminescence, the adjacent panels begin to light up in a similar way, but only reaching half of the luminescence of the ‘primary’ tile and also taking 5 seconds, as if the primary tile were ‘bleeding’ light into the others around it.

When the player steps onto another tile, the effect plays in reverse, with the exception being that if the new primary tile was adjacent to the last primary tile, then the tile takes less time to reach max-lum since it’s already ‘half-full’.

I would later on add other layers to the effect, such as different colours of light for different players or teams, and some sort of blending light effect where two players are touching a tile, but I could progress to that once I actually have multiplayer, networking and separate teams.

Please explain any blueprint examples/solutions in great detail as I’m still trying to figure things out.

You need to adds lights, while previous version of unreal had emmisive materials that could be source of light, this one does not have due to totally different rendering method. Epic is working hard of getting best things from both rendering worlds but its quite difficult. So i would not count on that unreal 4 ever gets emmisive materials that emit lights, well at least not until we have real global realtime illumination.

Also that emmisive material that made light was always static. ie. you could not change color or intensity of light in game, it was just baked in lightmaps.

So you need to use point lights to simulate that effect. And if i am not mistaken they need to be dynamic, and that is quite challenging because you should not have more than 4 lights in lighting same object, or everything will slow to crawl even on GTX 980ti.

My idea how i would try to make it (i did only static version of your idea, so i did not look at overlaping lights, because all was calculated in editor anyway and baked into lightmaps):

  • make blueprint for single hexagonal tile.
  • add invisible collision over it. this can be capsule, sphere, or you can make hexagonal tube of same dimensions as tile.
  • add event overlap to that collision actor
  • change light on begin overlap, and end overlap
  • add some neutral static light that imitates idle lighting of tile. Make this one either white or same color as dynamic light. Color from this light can come from floor tile material color.
  • and add dynamic light that is changed from overlap events.If you do not need some smooth changes for light i suggest here turning that light visibility on and off (i thin that is cheapest way to do it).

Edit i just read your effect idea:

This will be hard to do, all because of gpu bad performance with multiple dynamic overlaping lights. For limiting that overlaping you may look into light settings there are ligt chanels, but Epic is just implementing them again (they were in engine since ut3, but didnt make yet into ue4 fully). When lightchanels work you could do 3 or so and assigne them to tiles to minimize overlaping of same chanel lights.

Now some links (and search engine keywords, add “unreal” to them) that you should look into:
“dynamic instanced materials”: Instanced Materials | Unreal Engine Documentation
“material parameter collection”: Material Parameter Collections | Unreal Engine Documentation
“material functions”: Material Functions | Unreal Engine Documentation

for blueprints:
“interpto” The Subtle Magic of InterpTo() - Unreal Engine

And there are 2 nodes exactly for what you want with smooth values animation, but sadly i cannot remember names or keywords.

Wouldn’t it be better to maybe make a texture sheet with various “sprites” of the tile lighting up, then on collision have the material animate to appear it has lit? For the light maybe spawn it and destroy it after running a time line that progressively brightens and dims the light on begin and end overlap. Just a thought.

Well maybe if bloom is enough for effect, then unlit material with bigger than 1 values could do the trick. But i think OP want to tackle maximum effort scenario first.

Thanks for the quick response, but most of that went over my head to a large degree. I tried reading up on some of those things, but I think I really need a fully-fleshed-out, ‘blueprint for dummies’ explanation, preferably with images. Since it appears, based on what you said, that my idea is actually not yet feasible with current GPU capabilities, I will have to make do with less. I can deal with not having the peripheral panels being lit for now, which I think would make it easier. If I were to simply have the old primary switch off instantly, then the new primary tile light up over 5 seconds, how would I do that? (Please use diagrams and images). It’s not the effect I was wanting to have, but as the adage goes, less is more.

EDIT:

&d=1409604977
I just found this image [linked]. This kind of effect in a panel is kind of what I was looking for. You said self-illumination can’t be done, yet this looks a lot like self-illumination [confused shrug]. How was this done? This would work for me, as long as I have a detailed set of instructions for using blueprint for my fading in/out effect.

That looks like it was likely done with an emissive texture and a point light. Without reading all the threads.

My point being, would this be able to be dynamic in the way that I want? Could I set each new primary tile to have an emissive texture and point light? If so, how?

EDIT: After delving far deeper into emissive materials, I feel that they will be able to serve my purpose quite well. I’ve create an emissive material using the instructions here: Using the Emissive Material Input | Unreal Engine Documentation
I have the strength at 25 which looks quite good in the material editor, and quite good in engine, but I need to know how I can progressively blend the original material and the emissive material together using blueprint nodes, to give the appearance of a light powering on. Does anyone know how to do such a thing?

This is the blueprint code I have to change the material based on a collision with the player, yet it doesn’t work.
6eb85824514e33a2e5a3ecfd5816806e8d91a852.jpeg

Will be in HD after it processes a bit longer.

MOAR Tiles!

Replication Works Out Of the box with how the tutorial sets it.

This is excellent. Perfect for what I need, with the exception of you forgetting to add a max cap to the amount of brightness, which is why some stay lit for so long, and that I plan to have the peripheral pads light to a minimal amount as well. Again, great tut, but very quiet in the mic.

Some stay lit longer because of the time line. It runs to max in 3 seconds so if your on them quick they only get so bright. If you stay on them they get way brighter and take the same amount of time to light up as they do to dim. If you made the time line 1 second the effect would be less noticeable.

If you notice when your on one for say 2 seconds run off and back on the start to dim then when you go back on they start to brighten again from the value they had when you stepped on. It’s a neat easy cheap way to do it. The time line could be used in play from beginning reverse from end to make them always take same amount of time but it would look glitchy. You could also run it where on overlap it just sets the light and emissive to full but on end overlap time line animates it to 0. You can also alter the time line so instead of a smooth ramp it has a shutter like of florescent lights turning off and on. Lots can be done with that neat little node.

As for adjacent tiles I did what I thought you said would be acceptable for minimum requirements. I had to think this up as I never did it before either and didn’t want to spend a ton of time figuring it out since I won’t use it in my game.

The main point was to teach how the simplest method would be while showing multiple aspects of ue4 blueprint ing. I’m not sure how to detect and light adjacent tiles without spending time messing with it but maybe you could make 8 invisible components that when the tile is overlapped are spawned around it to trigger overlaps on the other tiles… then check if character or these triggers and set values accordingly… just a guess though

This setup would give you same dim time but instant max light:

[SPOILER]
95c5ac043cf7d5eac62fcf7b9a654e1da7775cf8.png
9a6a47c1564c47655e25048482a0336f843790e4.png

Giving a Trail Effect:

And at the wifes request… LOL:

[/SPOILER]

All kinds of ways to alter it… Could even have them instant on and instant off… or with a boolean allow the animation to go its full course before dimming. the possibilities are endless.