Hey guys.
I'm wondering how one would go about switching the dark texture on the character over to the light one mid gameplay (in ue4). In the sense that the light crawls outwards from the center of the body and illuminates the character like its powering up.
Replies
1. You need a second or third uv channel on your character , with planar mapping from the front or back view.
2. You need a mask like this. The curve of the gradient depends on what transition you want, and on how big the character's uv scale is on the uvmap.
3. You need to lerp between the dark and the colored texture based on the mask from step 2 that use the coordinate from step 1.
4. You can control the transition with various methods, like simply painting it to look differently, or within the shader, with "power"/"add"s or whatever.
5. Enjoy!
These are the basics, but you still can't control where are you at the transition, so it can't be driven by code/matinee yet... A bit later I'll make an example shader for the whole thing, but you can start experiment.
1. sample model:
2. second uv channel with the planar mapping from the front view:
3. initial material setup (parts are described in the comments above the expressions):
4. Actually it is done at this point, now look at the different states based on the "transition" parameter. * You need it to be a "scalar parameter" to be able to drive it through code or a matinee)
5. state is at 0.2:
6. state is at 0.4:
7. state is at 0.8:
8. state is at 1.4:
9. state is at 5:
10. Anything that controls the transition better, as mentioned, these are just the basics!
I am pretty new at this .
Just to make it out how obviously new i am, i understood the process as:
make your character, uv map it, apply texture. The texture itself is just a dark base colour, with the 'armour plating' a darker texture on another layer, which gaps to show the base colour. The lighter areas is just another base colour between the dark texture and the 'plating'.
I think i thought that somehow in-game the lighter layer (or another texture map entirely) could just be dynamically loaded in a gradient sort of way that spread outwards, meaning i would have to unwrap the character in a way that resembled the actual direction of the way i wanted the light to go.
That's where i am :thumbdown:.
So for step 1, i know how to make a second uv channel and gets the uv's over. But what exactly do you mean by planar mapping from the front or back view? I just want to understand how it works.
The rest i need to do some research on but i once i understand the mechanics it should just be a matter of time.
Thanks so much for your help so far!
I'm gonna try it out and see how i go Again, thank you so much for the amazing reply.
all you need is the distance between the texture coordinates and a vector2 with whatever values you want for your center(0,5 for both values probably).
//edit: before you could copy node setups from the material editor, paste them to text and copy&paste them later on. apparently that will now crash the editor x.X - or it is just when you copy from polycount. no idea
should have given you
So, adjusting the parameter lets me transition between the first and second textures.
I'm gonna need to learn why the second uv channel is necessary, and more curiously, what part the shader plays specifically in the whole thing.
It seems the lighter texture seems to transitioning evenly across the entire body, instead of spreading from the inside out
My assumption is the position of the shader relative to the second map has something to do with it?
Thank you for making my robot man glow.
Edit: you cant see the glow but it shows when the lights off.
Being an absolute noob, i actually tried to ctrl-v that into the material editor. UE4 crashed haha. It might be a bit beyond but can you explain what that is exactly?
I edited my above post ^^. Don't want to keep stuff in here that crashes the engine.
Just to summarize what i've learnt.
The textureCoord expression should be set to 1 because thats the second uv map channel, which is the planar map, which combined with the mask should appear as if the the second texture is fading in from the center outwards.
Last question i think i've got.
Edit: Figured it out. Jesus that's impressively bright.
I think now i'll try to figure out how to use shaders with it, as i'd like the plating over the top to not be emissive while the lighter parts are.
Show a video from the end result, so we can see how the effect looks on something more complex than a minecraft dude
https://www.youtube.com/watch?v=Q_TfAK8t59g&feature=youtu.be
Now i'd like to try masking off the armour plating of the model so it's not affected by the emissive quality.
I've set up a basic material layer blueprint, but im bamboozled as to how i can fade the glow in under the armour. Something to do with masking and the proper blend i would suppose. Going to download the UE4 example map with all the weird globes, there's one with the exact effect i want and i'm sure i can just reverse engineer it or something.
UE has a built in recorder by the way
Anyway, it works and it looks cool.
Something i don't understand is how the armour mask automatically applies itself to the 1st uv channel where the gradient is connected to the 2nd? Is that because of multiply node?
I'd like to set up another blueprint to be able to switch between colours on the go. Then, god help me, connect a metallic node to the armor while having an emissive one on the lights, and keep lerp between the unlit and lit textures.
I'll keep posting progress if anyone's interested.
Edit: Also thank you again