UV-Free
Triplanar Shaders

Version 2.0.3. By Andrew C. Wang (@andyman404)

Use this pack of terrain shaders and mesh shaders to eliminate terrain texture stretching, and easily texture objects beautifully without the need for skinning/UV-maps. Works great for rugged terrain and procedurally generated geometry.

These shaders are built using Unity 5's Physically-Based Standard Shader technology, taking full advantage of Unity 5's lighting model, Real-Time Global Illumination, Reflections.

Download PC Demo »

Download Mac OS X Demo »

Unity Asset Store Page »

If you're looking for the previous old v1.0 (Unity 4.x) documentation: v1.0 docs here.

Features:

Getting Started

  1. Import the asset. You should see a "UVFreeShaders" folder in your assets folder. Note: Due to the number of shader variants (hundreds) that must be compiled/imported, it could take a few minutes to initially import the asset into your project. Only the ones that are used in your scenes will be included into the game build.
  2. Open up the Sample Scene at "UVFreeShaders/Sample/Sample Scene/Sample Scene". Wait for the Realtime and Baked lighting to finish processing, and explore the simple sample scene. It contains meshes using all the different shaders, and a sample terrain using the UV-Free Standard Metallic Terrain shader.
  3. Play around with the sample materials in "UVFreeShaders/Sample/Materials" to get a feel for how the shaders are used in the materials. Feel free to delete the UVFreeShaders/Sample folder after taking a look at the samples. It is not needed for the shaders to work, and is for example purposes only. You should make your own materials using the shaders. Feel free to delete the samples folder after you are done with it.
  4. (Optional) Read the documentation below for more info on how to use the shaders. Most users who already know how to use the Unity 5 Built-In Physically Based Standard Shader can skip this step.

Shaders Included:

Triplanar Physically-Based Standard Metallic Shader (Single Texture):

Triplanar Physically-Based Standard Metallic Shader (Separate Main, Top, and Bottom Textures):

Triplanar Physically-Based Standard Specular Shader (Single Texture):

Triplanar Physically-Based Standard Specular Shader (Separate Main, Top, Bottom Textures):

Triplanar Physically-Based Standard Metallic Terrain Shader:

Triplanar Physically-Based Standard Specular Terrain Shader:

Triplanar Legacy Specular Shaders (1-Texture and 3-Texture):

Triplanar Legacy Diffuse Shaders (1-Texture and 3-Texture):

Triplanar Legacy Specular Terrain Shader:

Triplanar Legacy Diffuse Terrain Shader:

Additional Features:

Notes:

Platforms Supported:

This shader pack was developed for the Desktop platforms above. No other platforms are not supported. It does not work with WebGL.

Glossary of Shader Properties

Triplanar Space: This selects the relative space the triplanar projections. When "World" is selected, the projections will be based on the global coordinates, and textures will not stay in the same place as a mesh if the mesh is moved. This is best used for static objects (objects that do not move), or making multiple separate overlapping meshes appear to be one single mesh. When "Self" is selected, the textures will remain relative to the mesh's position, rotation, and scaling. Moving the mesh around will not affect the position of the textures on the mesh. This is best used for moving objects such as boulders, or falling debris.

Texture Power: The magnitude of blending for the different projections (top, bottom, left, right, front, back). A low texture power (1.0 - 5.0) will have more overlap and smoother blending, while a high texture power (10.0+) will have a sharper texture transition.

Top Strength: This controls the strength of the top texture on surfaces facing up (+Y). A value of 0.0 would hide the top texture, showing only the main texture. A stronger value (1.0+) would increase the portion of the surfaces that is using the top texture. Keep in mind that the top texture is a single projection of the texture from top down, so it may stretch if you increase the top strength too much.

Bottom Strength: This controls the strength of the bottom texture on surfaces facing down (-Y). A value of 0.0 would hide the bottom texture, showing only the main texture. A stronger value (1.0+) would increase the portion of the surfaces that is using the bottom texture. Keep in mind that the bottom texture is a single projection of the texture from bottom up, so it may stretch if you increase the bottom strength too much.

Vertex Color Strength: This controls how much effect vertex colors on the mesh have on the diffuse color. A value of 0.0 will disable the vertex colors, while a value of 1.0 will tint the diffuse color by the interpolated vertex color for that pixel. Vertex colors on meshes can be used to add variety while reducing the number of separate materials used. See example of how to procedurally change vertex colors.

Albedo: The Albedo parameter controls the base color of the surface. Specifying a single colour for the Albedo value is sometimes useful, but it is far more common to assign a texture map for the Albedo parameter. This should represent the colours of the surface of the object. It's important to note that the Albedo texture should not contain any lighting, since the lighting will be added to it based on the context in which the object is seen.

Albedo (RGB) Smoothness (A): In the terrain inspector, supply the Albedo in the RGB channel, and the smoothness in the alpha channel of the map. If the material does not have an alpha channel, then the terrain inspector will provide a slider for smoothness.

Diffuse (RGB) or Diffuse (RGB) Gloss (A): The RGB channels are used for the diffuse texture. The alpha channel is used for the specular highlights. The higher the gloss, the shinier that part of the texture is.

Metallic/Smoothness: The Metallic/Smoothness can be specified as a map or as separate parameters. As a map, the RGB channels represent the metallic reflection, and the A channel represents the smoothness. When there is no map, separate sliders appear for metallic and smoothness. For more information see Unity's documentation on Standard Shader Material parameters.

Specular/Smoothness: The Specular/Smoothness can be specified as a map or as separate parameters. As a map, the RGB channels represent the specular reflection, and the A channel represents the smoothness. When there is no map, separate parameters appear for specular color and smoothness. For more information see Unity's documentation on Standard Shader Material parameters.

Normal Map: The normal map or bump map texture used for faking the lighting of bumps and dents. Make sure this texture is set configured as Texture Type "Normal map" when examining this texture in the inspector. For more information see Unity's documentation on Standard Shader Material parameters.

Normal multiplier or Bump Scale: A setting which controls the bumpiness of the normalmap. The higher this is, the more exaggerated the bumps will be. At 0.0, the bumps from the normal map will be flattened out. A negative multiplier will turn the bumps inside out.

Height Map: Heightmaps are usually used in conjunction with normal maps and are often used to give extra definitino to surfaces where the texture maps are responsible for rendering large bumps and protusions. The heightmap should be a greyscale image, with white areas representing the high areas of your texture and black representing low areas. For more information see Unity's documentation on Standard Shader Material parameters.

Occlusion Map: The occlusion map is used to provide information about which areas of the model should receive high or low indirect lighting. Indirect lighting comes from ambient lighting and reflections, and so steep concave parts of your model such as a crack or fold would not realistically receive much indirect light.An occlusion map is a greyscale image, with white indicating areas that should receive full indirect lighting, and black indicating no indirect lighting. For more information see Unity's documentation on Standard Shader Material parameters.

Emission: Controls color and intensity of light emitted from the surface. When an emissive material is used in your scene, it appears to be a visible source of light itself (self-illuminated). Either a map can be provided, or it can be defined by a single color and an emission level. Set the emission level to a value higher than the default zero for the emission color and strength to appear. For more information see Unity's documentation on Standard Shader Material parameters.

Detail Maps: Detail maps allow you to overlay a second set of textures on top of the main textures. You can apply a second Albedo color map, and a second Normal map. The detail mask texture allows you to mask off certain areas of your model to have the detail texture applied. this means you can show the detail texture in certain areas, and hide it in others. For more information see Unity's documentation on Standard Shader Material parameters.

Specular Color (RGB) Strength (A): The color and strength of the specular/gloss highlights.

Shininess: The shininess of the material. Lower values will have specular highlights that are more spread out, while higher values will have specular highlights that are more focused in a smaller area.

Rim Color (RGB) Strength (A): Rim lighting gives the effect of the object being backlit or picking up bounce light. Rim color is the color of that bounce light.

Rim Power: The sharpness of the rim lighting. Lower values will cause the material's rim lighting to be spread out, while higher values will cause the rim lighting to be more concentrated.

Rim Multiplier: This is an alternative to the Rim Color's strength. When this is zero, no specular highlights will be displayed. As this increases above 1.0, the rim lighting will be exaggerated more and more.

Texture Scale %: For terrains, this is a quick way to scale all the textures for that terrain across the board simultaneously. Set this to smaller (<100.0) to shrink the textures, and larger (>100.0) to magnify the textures.

Shader Keywords

These shaders make use of shader keywords to consolidate code and automatically compile a large number of internal shader variants based on the different possible combinations of features used. Only the variants of the shaders (from among hundreds of possible variants) will be included in the game build.

The custom material editors, automatically used with these shaders, takes care of enabling/disabling these shader keywords. Additionally, you can also programmatically enable or disable the shader keywords, but make sure there is a material included in the game build that already has that shader keyword combination.

_UVFREE_LOCAL: Whether the triplanar projections should be based on Local Space (enabled) or World Space (disabled).

_UVFREE_BOTTOM: Whether or not to include a separate bottom set of textures, in addition to the top set of textures and main set of textures. The main and top set of textures will be included regardless of whether this is enabled/disabled.

_UVFREE_VERTEX_COLOR: Whether or not to apply vertex colors to the diffuse coloring of the material.

_UVFREE_RIM: Whether or not to include rim lighting for materials using the legacy shaders.

_UVFREE_BUMPED: Whether or not to include normal/bump mapping.

_SPECGLOSSMAP: Whether or not the Specular/Gloss map is used. If this is disabled, then the numeric _Glossiness (Smoothness) and _SpecColor (Specular color) will be used instead (and _TopGlossiness, _BottomGlossiness material properties if present). If it is on, then the _UsingSpecGlossMap material property, and the _TopUsingSpecGlossMap and _BottomUsingSpecGlossMap properties (if present), should be set to 0.0 (off) or 1.0 (on) to indicate whether they are using the numeric properties or the Specular/Gloss map respectively.

_METALLICGLOSSMAP: Whether or not the Metallic/Gloss map is used. If this is disabled, then the numeric _Glossiness (Smoothness) and _Metallic (Metalness) will be used instead (and the _Top and _Bottom prefixed versions if present). If it is on, then the _UsingMetallicGlossMap material property, and the _TopUsingMetallicGlossMap and _BottomUsingMetallicGlossMap properties (if present), should be set to 0.0 (off) or 1.0 (on) to indicate whether they are using the numeric properties or the Metallic/Gloss map respectively.

_PARALLAXMAP: Whether or not the Height map(s) should be used.

_DETAIL: Whether or not the Detail map(s) should be used.

_OCCLUSION: Whether or not the Ambient Occlusion map(s) should be used.

_EMISSION: Whether or not the Emission map(s) should be used.

Release Notes & Changes

2.0.3: Quick fix for heighmap issues in Unity 5.6.0.

2.0.2: Added Non-Dynamic-Batching version of shaders. Fixed issue in terrain shaders where the transition area between two different textures is darker than it should be. Shortened file names for the sample scene and its files.

2.0.1: Fixed issue where point light shadows and spot light shadows were not showing up on the terrain shaders. Added commented out code to mesh shaders for disabling dynamic batching for just that specific shader. Modified terrain shaders internally to more closely mirror the updated terrain shader code from Unity 5.2.1f1.

2.0.0: Upgraded for Unity 5. Added Standard Metallic PBR and Standard Specular PBR versions of the shaders, built using Unity 5's new lighting model. Consolidated legacy shaders into into mega shaders with a similar interface to Unity 5's Standard Shader. Features are enabled or disabled by simply using or not using various texture slots and parameters in the customized material editor.

1.0.2: Fixed issue with strange lighting when DX11 is enabled for some graphics cards. Moved documentation to online HTML file.

1.0.1, 1.0.0: Initial Release. Note: Some graphics cards may be affect by a DX11 issue. As a workaround, disable the DX11 checkbox in the Build Settings > Player Settings until the 1.0.2 update is up on the Asset Store.

Support

Please email me at andyman [at] idumpling.com with the subject "UV-Free Shaders". So that I may help you more efficiently, please specify your issue with as much useful detail and context as possible, such as platform, hardware, OS, rendering path (forward or deferred), color space (gamma or linear), and how you are trying to use the shaders. Annotated screenshots are very useful and will save us all some time.