This is a shader for SpeedTree version 7.x for Unity. The shader has advanced settings compared to the standard Unity shader for SpeedTree.
The shader fully functions in Forward Rendering and Deferred Rendering (including Subsurface Emission). Shaders have great scalability. The shader allows you to increase performance, but to the detriment of appearance, or to get a better image, but to the detriment of performance.
Using this shader, you can adjust the wind (speed, amplitude, swaying branches, etc.). The wind settings in the shader, allow you to fix incorrectly configured wind settings in SpeedTree, as well as synchronize and adjust the wind for all vegetation separately. You can adjust the wind parameters for each vegetation individually.
Features:
- Full wind setting.
- Advanced settings for visualization of vegetation.
- Support for all functions in Forward Rendering and Deferred Rendering.
- Good performance.
Only Built-in Render Pipeline.
For Unity version of at least 2019.1.8 (64-bit)
Current version 3.2
Information
Attention! The speed of shader compilation when importing into a project depends on the power of your CPU in your PC. Initial compilation can take a lot of time, so wait for compilation, the shader is large and complex.
On the processor level i3-8100, i5-6600, AMD Ryzen 5 1400, compilation time will take more than 3.5 minutes.
I recommend importing this asset into a new project. Study the operation of the asset and copy the components you need to your project.
There is an example in this asset to understand the operation and settings.
The trees (Broadleaf, Palm) used in the examples are taken from the -
Free SpeedTrees Package.
Shaders Settings (/ STC7)
Geometry Type & Culling
•
Geometry Type - type of geometry. Branch - tree trunk, material bark of a tree, opaque. Branch Detail - tree trunk, material bark of a tree, opaque, two albedo. Frond - leaf palm or fern, material alpha cutoff. Leaf - one leaf, branch with leaves, material alpha cutoff. Mesh - essentially no different from "Branch" (Legacy, Wind: Better, Best, Palm), not recommended for trees.
•
Backface Culling - culling is an optimization that does not render polygons facing away from the viewer. All polygons have a front and a back side. Back - Don’t render polygons that are facing away from the viewer i.e. back-facing polygons are culled. Front - Don’t render polygons that are facing towards the viewer. Used for turning objects inside-out. Off - Disables culling - all faces are drawn. Used for special effects.
Texture and Color Settings
•
Albedo Map - enable albedo, disabled by default.
•
Main Texture - main texture, depending on the type of geometry, with or without transparency. For "Branch", "Branch Detail" and "Mesh", a non-transparent texture. For "Frond" and "Leaf" texture with alpha transparency.
•
Detail Texture - an additional texture for details, only for the "Branch Detail" geometry type.
•
Main Color - main color, HDR. Final color hue depends on "Hue Color" and "Color and Light Tuning".
•
Hue Variation - enable hue variation, the hue depends on the set hue color, and the intensity of the hue depends on the position of the object in world space. In this way you can get many shades for the forest with one material.
•
Hue Color - color of the hue, HDR. Alpha channel also affects the intensity of the hue.
•
Alpha Cutoff - determine the cutoff point for the which areas will be shown. For "Frond" and "Leaf".
•
Shadow Cutoff - determine the cutoff point for shadow. For design or to increase performance. For "Frond" and "Leaf".
•
Specular Map - enable specular, disabled by default.
•
Specular Map Texture - specular texture, green channel. Black areas will be zero specular reflection, while white areas will be full specular reflection.
•
Specular Intensity - intensity of the specular texture, according to the principle of contrast. HDR.
•
Shininess - shininess, is a multiplier for "Specular Map Texture". If "Specular Map Texture" is none, then "Shininess" * 1. HDR.
•
Gloss - degree of gloss, HDR.
•
Specular Color - specular color, HDR.
•
Occlusion Map - enable occlusion, disabled by default.
•
Occlusion Map Texture - occlusion texture, red channel.
•
Strength Occlusion - intensity of the occlusion texture, HDR.
•
Emission Map (Subsurface) - enable emission, disabled by default. For the effect of fake subsurface emission.
•
Emission Map Texture (Subsurface) - occlusion emission.
•
Emission Color - emission color, HDR.
•
Normal Map - enable bump map, disabled by default.
•
Normal Map Texture - bump map texture.
•
Strength Normal - intensity of the bump map texture.
Color and Light Tuning
•
Enable Tuning - enable color and light tuning, disabled by default.
•
Light - vertex light, HDR.
•
Brightness - final color brightness, HDR.
•
Saturation - final color saturation, HDR.
•
Contrast - final color contrast, HDR.
Wind Settings
•
Wind Quality. None - disabled Wind. Fastest - highest performance, only basic parameters. Fast - high performance, basic parameters and leaf ripple. Better - quality and performance, basic parameters, leaf and branch ripple, branch twitch. Best - high quality, basic parameters, leaf and branch ripple, leaf tumble, branch twitch. Palm - high quality, basic parameters and palm settings.
•
Wind Speed - general wind speed.
•
Wind Amplitude - general amplitude of wind.
•
Wind Degree Slope - general amount of slope due to wind power.
•
Wind Constant Tilt - constant slope due to wind power.
•
Leaf Ripple - effect of leaf ripples using offset.
•
Leaf Ripple Speed - speed of leaf ripples.
•
Leaf Tumble - tumbling effect of the leaves, relative to the attachment point.
•
Leaf Tumble Speed - leaf tumbling speed.
•
Branch Ripple - effect of branch ripples using offset.
•
Branch Ripple Speed - speed of branch ripples.
•
Branch Twitch - twitch branches.
•
Branch Ripple - effect of branch ripples using offset.
•
Branch Ripple Speed - speed of branch ripples.
•
Branch Twitch - twitch branches.
•
Elasticity - elasticity of branches and leaves.
•
Turbulences - degree of turbulence effect.
•
Branch Force Wind - wind force acting on branches (along the X axis).
•
Branch Heaviness - wind force acting on branches from top to bottom (along the Y axis).
Shaders Settings (/ STC7 billboard)
Shader "Billboard", almost no different from the "General" shader. The differences are in the absence of a choice of geometry in the "Billboard" shader and support only of the "Fastest" wind.
Deferred, Forward and Vertex Lit rendering path
The STC7 shader supports all major rendering paths. But due to the difference in rendering in the rendering paths of Deferred, Forward and Vertex Lit, the shader (material) settings for different rendering paths will be different.
Render Queue
If you use the Forward rendering path, in some cases, when there is an object with transparent material on the background of the tree, a small halo may occur, in such cases, change the Render Queue to a value higher than 2500.
It also makes sense to set the Render Queue to a value above 2500, to change the lighting, see examples.
Screenshots
License
This project is licensed under
MIT License