User Tools

Site Tools


tutorial:reflection_material

Reflection and Masking

In this section we will learn how to make a Reflection Material and how to use masking to prevent areas on the sprite from being reflective.


Creating the Material

In .Demo Scene/Assets/Textures/Sprites/ you can find tex_icon_reflec, move it to the Scene, select the Sprite and press on the Widget “Add Unlit Material”.

 This is the Main sprite we apply the reflection to.

That's interesting, unlike before with the Curvature Material, the Sprite didn't turn dark!?

Right! This time we have chosen an Unlit Material, just like Unity's default Sprite Material it uses an Unlit Shader which does not care about lightning and always returns it's color values unaltered.

In the Material Inspector we enable Reflection, then drop the tex_reflec_galaxy from .Assets/Textures/Sprites/ in the Reflection Texture slot and set Reflection strength to 1.

 We can now see the Reflection in Action but the Main Sprite is covered by it.

Masking

As you notice the Sprite is covered by the Reflection, but we want to exclude the Letter “R” from the reflection. This is now the situation where Masking comes in place! With a grayscale Texture you can control precisely which parts of the Sprite will be reflective.


White(255,255,255) shows the full reflection and dark(0,0,0) none, gray(127,127,127) shows the reflection halfway. If you are familiar with Photoshops Masking techniques, then this might be already familiar to you.

In .Demo Scene/Assets/Textures/Masks & Misc/ you can find mask_icon_reflec, drop it onto the Mask Texture slot.

Great, the letter “R” is visible again! And this is how masking works, simple but powerful!

Adding Features

Why stop here? Let's make the Sprite look like a button by using Curvature. Since Unlit Shaders do not support Curvature, we need to switch to a Multi or Single Lit Shader! Go to the Extras Panel and switch the Shader to Single Lit.

Enable Curvature and drop from .Assets/Textures/Normals/ the norm_icon_reflec Normal Map into the Curvature Texture slot. Ramp Gloss to 0.7 and and set Tint to yellow.
This now a more interesting result:

The End! Really?

Awesome, you have now learned all the basics to rock on with NextGenSprites!
There is still more to learn about Emission, Transmission, Dissolve and there are also the FX Shaders.

But in the end - learn by doing! Anyway, please check out regularly this Wiki because I will continue expanding it and also add more in depth Video Tutorials! In the future you will learn how to create Normal Maps, Flow Maps and Dissolve Patterns. I will also discuss advanced topics like Shared Materials, Sprite Sheets, Material Property Blocks, Runtime Material Animation with DoTween and more!

tutorial/reflection_material.txt · Last modified: 2015/12/10 21:04 by admin

Page Tools