Making a Cosmic Material in UE4
Hello everyone! This is my first article on LinkedIn, and really excited to share it with you all. In this article, I will go through how I made this material in UE4.
So, let's get started. I got the inspiration to make this material from Valorant's new agent Astra's cosmic abilities. I fell in love with its abilities and how cool it looks in-game. So, I thought of making a similar material and adding my own creative touch. Before moving on to the process of making the material let's have a look at how the final material looks like.
Making the Material
- The material graph looks something like this. Let's break it down into smaller chunks and understand it.
Space/Waves.
- For this part, I started off by adding two Texture sample nodes and applied a caustics texture that I found on the internet, which would give me the look I was going for.
- To give the material some movement and animation, I added Rotator multiplied with the Panner node, and to scale the UVs I multiplied it with the scalar parameter at a default value of 0.5 to the UVs input of the first texture(Cosmos_Texture1).
- I did the same for the second texture(Cosmos_Texture2) as well, except this time I only added Panner to the UVs. Repeated the same step as above for the tiling of this texture as well.
- After I got the base for the wave, I connected VectorToRadialValue(Radial Coordinated output) to Rotator and Panner to give it a spiral look and make it more interesting.
Basically, VectorToRadialValue distorts the UVs of the textures radially in the o to 1 space. I have attached an example below to have a look at.
- To give it a sense of depth and dimensions I attached the Screen Position node to both the textures. This will display textures based on the screen space position of the pixels.
Making the Stars
- For stars, I simply added three stars textures for variation in the material. And then I set the tilings for each individual texture, i.e., Stars_Tiling1, 2 and 3. I added Screen Position to the stars as well.
- Now the main part for the stars was to make them glow/twinkle. So, for that, I used Sine to make the stars do that. For Sine to work, we need to connect the Time to Sine. Which is exactly what I did. I have attached an example of how Sine works, below.
- Then after this was done I blended all three stars textures together using Linear Interpolate(Lerp). This way I can get stars of different tiling(scale) for some variation.
The Sine expression outputs the value of a Sine wave over the input range of [0, 1] and the output range of [-1, 1], both repeating.
-Unreal documentation
This video shows how Sine works.
Blending Waves and Stars
- After I was done with setting up the textures for both waves and stars, I blended both of them using Lerp and connected them to the emissive input of the material.
- Now the next step is to add colors for the void/space. This is a pretty simple step. First I added two vector parameters and blended Lerped them and added Perlin noise texture to the alpha input to give some randomness to the color.
- For the caustics I simply multiplied Vector parameter with the texture itself( this went into the emissive input of the material.
Material in Action
This is the final output and showcasing the parameters of the material. You can tweak various parameters in the material instance and make it look as per your liking.
So, yeah! This was pretty much how I made this material. I had a lot of fun making this cool magical material. I hope you enjoyed reading this and gained some information out of this article. Feel free to drop me a DM if you want to ask anything. I would be more than happy to reply :)
Thank you for reading!
Our mission is to inspire 1 million people to learn Unreal Engine and build their dream career and/or business ??
3 年Great breakdown Vismay!
Building AI Agents for Enterprises
3 年This is interesting. Thanks for sharing
Interested in programming, cyber security and robotics
3 年Ou, that's nice! Can we use the content for our projects if properly referenced? Cheers
Freelance 3D Artist
3 年Insightful