lundi 4 janvier 2016

Emissive material through blueprint

Hello,

Something fun is to use emissive material. I got a static mesh, with a material containing texture, bumping, and emissive texture.

It is allowing you to make shine some parts of your mesh, without managing lights (as an external object).

My purpose was to make shining the engine when speed up.

First step is to modify your material, to add a parameter (scalar parameter) and multiply it to the emissive texture.






Next, go out of the texture, go back to content browser, right click on your material, to create a material instance.

In previous step, I've created a pawn blueprint, with speed and speedmax variable, and with a static mesh component referencing my mesh.

Open this blueprint, at the begin play event, create a dynamic material for your static mesh.
Fill the source material, with the name of your instantiated material, you created step before.




Every tick, I check the speed, to make glowing engine or not.

I calculate a prcent speed, to make shine depending of the engine's power, I retrieve material from my mesh (here my mesh has only one material, so it is easy, I retrieve materials at index 0)
I cast to material instance dynamic, and I use set scalar parameter value, where I precise the parameter created in first step into my material.




Now in game, if you increase the speed, engine will shime more and more...

Aucun commentaire:

Enregistrer un commentaire