I understand how to create the energy shield shader (displace vertices along normals, use fresnel and depth for alpha, scrolling textures, etc.). But, in UE4, is there a way to dynamically create a shell around an arbitrary actor? Here are some options I can think of, but I’m not quite sure if they are possible. I’m very new to UE4.
Use blueprint to spawn a second mesh, slave it to the first, and apply the energy shield material to the second mesh. I’m pretty sure I can pull this off, but it may be expensive. Would I have to keep the second mesh loaded at all times, or could I create and destroy it as needed at run time?
Dynamically create a new material that inherits the features of the old one, but also does some kind of second pass to render the shield using the same model. This sounds like the best method, if it will work in UE4.
Some sort of post process effect (I haven’t started digging into post process FX in UE4 yet).
Can any of you UE4 experts recommend the best way to approach this?
PS- I do have one shader question. Is there any way to prevent cracking along hard edges when you do vertex displacement?
i think you already said the best way to do this - have a duplicated skeletal mesh in your character blueprint thats either been scaled up slightly before import or has a displacement in the World Position Offset along the vertex normal, and then just trigger it on when the shield is active.
It wouldnt be too expensive to have a single layer of transparency (less still if you used additive blending) and you can set visibility of the mesh to off before and after the shield effects turns on and off so it wouldnt always be rendering.
not sure about rendering the same triangle twice with different materials - sounds like something that would require custom code and probably wouldnt be much cheaper than just duplication.
There’s a material option called Crack Free Displacement, could try that - not really used displacement all that much tbh. I would have thought most use cases for displacement would be on a smoothed mesh anyway though. Could always add a support loop and paint the hard edge verts black and use vertex colour to scale the displacement so they dont move, depends what sort of effect you’re after.
@Luos_83 - Thanks, that shader tutorial is great! I’ll be sure to take a deep look at that. I’m trying to find a solution that will work on any arbitrary actor, though, so I’m hoping to avoid elaborate per-material set up for this one.
@tharlevfx - I’m trying the second mesh option. So far, it’s working very well! I set up a blueprint for the shell that references another actor and finds that actor’s meshes to duplicate. I will have to figure out if the extra meshes are too expensive. As for the vertex offset cracking problem- I found a feature called crack free tesselation, but I think that only works if I’m using the tesselation feature in the shader, which I don’t think I want to use. I’ll look into it, though. I didn’t see a crack free displacement option.
Luos_83, sorry for the slow response! I’ve been thinking that over, and with some well thought out setup, I may be able to make that work. I’m still looking into how to do it in a scalable way, but I think it’s possible.