UV-Free Stretch-Free Triplanar Shader Pack
Version 1.0.2
by Andrew C. Wang
Note: The Unity 5 version of the shader pack, based on Unity's PBR Standard Shader technology, is coming very soon. The existing version 1.0.2 is for Unity 4.
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 procedurally generated geometry.
Release Notes & Changes
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.
Features:
- Quickly texture a mesh without having to skin/UV-map it.
- Eliminate stretching for textures on terrains and meshes.
- Supports forward and deferred rendering paths, shadows, HDR, lightmapping, gamma and linear color spaces.
- This pack of 32 shaders includes diffuse, bumped, bumped specular, and bumped specular rimlit versions of each variation of the shaders described below.
Shaders Included:
8 Triplanar Terrain shaders: Use as many textures as you want (4 texures per pass). Use these same way that Unity's built-in terrain shaders are used, but without the annoying stretching.
12 Global triplanar shaders: Shaders which map textures based on world/global position for static objects. Includes variations for single texture objects, two texture (top, side) objects, and 6 texture (top, bottom, left, right, front, back) objects.
12 Local triplanar shaders: Shaders which map textures based on local position moving objects. Includes variations for single texture objects, two texture (top, side) objects, and 6 texture (top, bottom, left, right, front, back) objects.
Additional Features:
- Texture Power field: This bonus field allows you to control the degree of overlap/sharpness when performing triplanar projection. A low Texture Power (1.0-5.0) helps create more believable surfaces from more organic-looking textures such as rock or grass. A high Texture Power (10.0 and up) allows for sharper texture transitions between top, bottom, left, right, front, and back surfaces - good for repeating textures such as bricks, grids, and strong patterns where overlap is not desired.
- Normal Multiplier: Shaders which include a Bump/Normal Map have a Normal multiplier that allows you to control the bumpiness of the normal map to exaggerate it or tone it down. The default is set to 1.0.
- Texture Scale Percentage: For terrain shaders, a Texture Scale percentage property provides a quick way to scale all the textures for that terrain simultaneously.
- Example Scene with sample materials to demonstrate the shaders.
Notes:
- These shaders requires Shader Model 3.0 GPU (most GPUs after 2004).
- The Vertex Lit Rendering Path is not supported for these shaders. In Forward Rendering, specular highlights may be more pronounced in the areas where the projections overlap.
- Note, the sample textures included in the example scene have been marked so that they can be legally provided with this example scene, and are for example purposes only. The original textures are licensed from http://gametextures.com
Tested on:
- Mac OS X
- Windows 7
- Unity Webplayer
To Run The Example Scene:
- Import the UV-Free Stretch-Free Triplanar Shaders pack into your project.
- Open and run the UVFreeShaders/Example/demo scene.
- Use the onscreen buttons to choose from the Local, Global, or Terrain shaders demo, cycle through shaders and sample textures.
- Drag with Left Mouse to rotate model or terrain view. Drag with Right Mouse to rotate the direction of the light (indicated by the two parallel arrows). Move the mouse scroll wheel up/down to zoom. Press space to toggle the GUI.
Glossary of Shader Properties
Tint (RGB) Strength (A): This is a color tint that is applied to the texture.
Base (RGB) or Base (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.
Texture Power: The degree 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 gradual blending, while a high texture power (10.0+) will have a sharper texture transition.
Normalmap: 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.
Normal multiplier: 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.
Top, Bottom, Left, Right, Front, Back, and Side textures and corresponding Normal Maps: For 2-texture shaders, the Top texture is used for the top (surfaces in the +Y direction) of the object, while the Side texture is used for the sides and bottom, with a Top multiplier to modify what is considered the "Top". For 6 Texture shaders, the different textures correspond to the textures projected to the surfaces facing the different directions.
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.
Specular Multiplier: This is an alternative to the Specular Color's strength. When this is zero, no specular highlights will be displayed. Crank this up past 1.0 to use with HDR.
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.
Support
Please contact me at andyman@idumpling.com with the subject "UV-Free Shaders".