Energy field around meshes

Hey guys, I’m working on a game where I want to envelop meshes that use different materials with an energy field (aka another material). Is there a simple way to do that? Like stacking materials on each other? I don’t really need blending or anything since it’s a translucent material on a simple one. Any ideas? :s

No, there’s not a simple way to blend materials on top of each other if they aren’t specially set up for that.
The best option is probably to draw the mesh/es as normal, and then re-draw them again, with a different translucent material applied, and make that material push the normals of each vertex out by a centimeter or so.
Note that you will get “cracks” in the shield along hard edges, unless you stitch said hard edges with degenerate triangles. For most organic meshes, this doesn’t matter, as every edge is smooth.

Alright :confused: thank you


simply add a ‘make material attributes’ node to your material and hook all of your nodes up to that instead of the final material output and blend between two materials that way:

for your energy layer, add a ‘Vertex Position WS’ node, multiply that by the distance you want, plug it in to the ‘b’ input of a lerp with ‘a’ being the VertexsPositionWS non-multiplied, and for the alpha use whatever alpha you used for the two materials. that then goes in to ‘world position offset’.

That’s one of the solutions I meant by “if they aren’t specially set up for that.”
The problem with that is that, every material I might want to put a “glow” on top of, has to be edited to support being “glowed.”

In the best of worlds, there would be a kind of material input that is a “material sampler” that takes another material expression as parameter (like how a texture sampler works) and outputs material attributes from that material.
In such a world, I could make my “add glow” material take the original material as a parameter, and thus don’t need to change/edit the base material.

In that case I’d be building all your base materials within material functions with the make material attributes node. it means you have to ‘specifically set them up for that’, but in a way that doesnt need to be tweaked if you dont want to modify them afterwards. that way when you want to add glow to something you just make a new material and add the base material function in and adjust the glow as needed.
thats the only way i can see it being done in a way that you would find acceptable.

I think we actually agree, and are just trying to solve different problems!

I think the conclusion is that, if you have some pre-existing content (already built, bought from marketplace, etc,) then in the current Unreal Engine, we need to make some change to the material to add material effects inside the existing material. You’ve suggested a few options which will all work fine.

If changing the materials is not a problem for your workflow, then that will absolutely work! If you expect to have to update and re-import the assets later, and they then come in with their old materials, then the workflow becomes cumbersome and there’s a risk of errors in forgetting to change the re-imported materials again.

I think Epic could fix this in some future version of the Unreal Engine by supporting the concept of “chained” materials, but for now, they don’t. We should file a feature request :wink:

Meanwhile, an option that would work, is to use a blueprint that duplicates the mesh, and re-renders it, with a slight offset “out” along the normal, using a translucent material that overlays on the base. This method will work on “any” material, and will not need re-work each time you re-import the meshes, but it does have other problems (such as cracking of the effect along unsmooth edges.)