foliage-shader

所属分类:模式识别(视觉/语音等)
开发工具:ShaderLab
文件大小:309348KB
下载次数:0
上传日期:2021-04-26 14:42:01
上 传 者sh-1993
说明:  树叶松针的统一曲面着色器(在alpha剪切纹理上)
(Unity surface shader for leaves pine needles (on alpha cutout textures))

文件列表:
Assets (0, 2021-04-26)
Assets\FoliageShader.meta (172, 2021-04-26)
Assets\FoliageShader (0, 2021-04-26)
Assets\FoliageShader\AutoRotate.cs (429, 2021-04-26)
Assets\FoliageShader\AutoRotate.cs.meta (243, 2021-04-26)
Assets\FoliageShader\Skybox.mat (2306, 2021-04-26)
Assets\FoliageShader\Skybox.mat.meta (188, 2021-04-26)
Assets\FoliageShader\SurfaceShaderBasic.shader (2021, 2021-04-26)
Assets\FoliageShader\SurfaceShaderBasic.shader.meta (204, 2021-04-26)
Assets\FoliageShader\SurfaceShaderFoliage.shader (3125, 2021-04-26)
Assets\FoliageShader\SurfaceShaderFoliage.shader.meta (204, 2021-04-26)
Assets\FoliageShader\Test.meta (172, 2021-04-26)
Assets\FoliageShader\Test.unity (37522, 2021-04-26)
Assets\FoliageShader\Test.unity.meta (155, 2021-04-26)
Assets\FoliageShader\Test (0, 2021-04-26)
Assets\FoliageShader\Test\LightingData.asset (14236, 2021-04-26)
Assets\FoliageShader\Test\LightingData.asset.meta (190, 2021-04-26)
Assets\FoliageShader\Test\ReflectionProbe-0.exr (147379, 2021-04-26)
Assets\FoliageShader\Test\ReflectionProbe-0.exr.meta (1955, 2021-04-26)
Assets\FoliageShader\ground.mat (2055, 2021-04-26)
Assets\FoliageShader\ground.mat.meta (188, 2021-04-26)
Assets\Trees.meta (172, 2021-04-26)
Assets\Trees (0, 2021-04-26)
Assets\Trees\3D models.meta (172, 2021-04-26)
Assets\Trees\3D models (0, 2021-04-26)
Assets\Trees\3D models\Midpoly.meta (172, 2021-04-26)
Assets\Trees\3D models\Midpoly (0, 2021-04-26)
Assets\Trees\3D models\Midpoly\Bushes.meta (172, 2021-04-26)
Assets\Trees\3D models\Midpoly\Bushes (0, 2021-04-26)
Assets\Trees\3D models\Midpoly\Bushes\M_bush_small_4.obj (12141978, 2021-04-26)
Assets\Trees\3D models\Midpoly\Bushes\M_bush_small_4.obj.meta (2996, 2021-04-26)
Assets\Trees\3D models\Midpoly\Trees.meta (172, 2021-04-26)
Assets\Trees\3D models\Midpoly\Trees (0, 2021-04-26)
Assets\Trees\3D models\Midpoly\Trees\M_tree_big_1.obj (54801429, 2021-04-26)
Assets\Trees\3D models\Midpoly\Trees\M_tree_big_1.obj.meta (3563, 2021-04-26)
Assets\Trees\3D models\Midpoly\Trees\M_tree_big_2.obj (52982072, 2021-04-26)
Assets\Trees\3D models\Midpoly\Trees\M_tree_big_2.obj.meta (3364, 2021-04-26)
Assets\Trees\3D models\Midpoly\Trees\M_tree_big_3.obj (49326138, 2021-04-26)
... ...

# foliage-shader Unity surface shader for leaves/pine needles (on alpha cutout textures). ![Foliage Shader](https://github.com/teadrinker/foliage-shader/blob/master/FoliageShader.gif) Lush greenery looks the most delicius when it feels like the light passes through the tree crowns a bit like it was a cloud. The method is conceptually very simple: ### -When rendering the shadow map, simulate transparency by rendering things smaller than they are. In Unity terms, use alpha `_Cutoff` in combination with the built-in shadow map to control how much of the light is transmitted through the foliage (an additional alpha offset is added to control the rendered alpha cutoff): ![Light Transmission](https://github.com/teadrinker/foliage-shader/blob/master/LightTransmission.gif) To break up uniformity (specially needed for areas that are completely lit or completely shadowed), I used the classic `dot(sunWorldDir, normal)` and a bunch of tweaking parameters, for example `Lambert90deg` and `Lambert180deg`, which allows for control of the "shine though" lighting gain for 90 degrees and 180 degrees. (However, since we are working with larger sets of leaves/pine needles that are mapped on simpler geometry, I think of this as very rough approximation, I mostly just use the parameters to introduce variation that looks good) These parameters are basically tools to counter issues like: ![Foliage Issues](https://github.com/teadrinker/foliage-shader/blob/master/https://user-images.githubusercontent.com/678065/116100759-883a3080-a6ad-11eb-9db0-67be65e0861d.png) [Code is small](https://github.com/teadrinker/foliage-shader/blob/master/https://github.com/teadrinker/foliage-shader/blob/main/Assets/FoliageShader/SurfaceShaderFoliage.shader), just a few lines, as the Unity framework does most of the work. However, as someone who usually writes fragment shaders, using the surface shader API was ***not*** a super smooth experience... The main drawback to this method is noise, even with large shadow maps and good PCF sampling, you might want to render larger and then filter down. I implemented this as proof of concept, so use at your own risk. It does not do any fancy stuff like subsurface scattering or even normal/bump mapping (but the latter is certainly easy to add if you need it). It also has an issue with shadows further away bleeding through geometry that has high transmission (I think because the CollectShadows stage don't take into account the additional alpha offset) Trees are CC0 and were created by ALTER'49, for the full set, and also with higher polycounts: [PRO Forest Bundle](https://github.com/teadrinker/foliage-shader/blob/master/https://gumroad.com/l/proforestpack)

近期下载者

相关文件


收藏者