User Tools

Site Tools


shaders:feature:reflection

Reflection

The (Screen Projected) Reflection feature is a very powerful tool and can be used in many kind of ways that are not obvious at first glance. This Feature works by overlaying another Sprite/Texture and scrolling it with the GameObjects world position. Reflections can be also masked out and get perturbed by the active Curvature Normal Map.


Camera should have a distance of at least 5 units to the Sprite.

Reflection Texture

You can use Sprites, Textures and Render Textures for reflections, cubemaps are not supported. One important consideration you need to take care of, is to make sure that the Textures Wrap Mode is set to Repeat. On a Sprite you do this by switching Texture Type to Advanced, there you will find the Wrap Mode option.

Reflection Strength

Set the strength on the reflections visibility. A value like 0.5f blends in the reflection halfway.

Blur

Blurs the Reflection. It essentially sets the Mip Map level on the texture.

Scrolling

You can scroll the reflection by the sprite's position in world space.

This behaviour is intentional but you can turn it off by just setting X and Y to 0.

Mask

You can provide a grayscale texture to mask out the reflection.

Left: Mask - Right: Mask applied.

Tinkering with Curvature


Since Reflections gets perturbed by the Curvature we can archive a bunch of interesting effects. Consider the following examples:

Lens

Using a circular normal map will result in a Lens effect. Setting depth in the curvature settings to a negative value will invert the reflection and put it upside-down!

Alloy

We can also make some kind of metal. Let's try this:

This looks certainly interesting but it's too noisy :-? We can fix this by setting the Blur on the Reflection to something like 5~7:

Perfect! =)

Alternatively to using Blur, you could also use an precomputed blurred/diffused sprite. NextGenSprites already includes 40 diffused textures in its Extra Assets package!

shaders/feature/reflection.txt · Last modified: 2015/10/12 22:41 by admin

Page Tools