You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.7 KiB
Plaintext
71 lines
2.7 KiB
Plaintext
// Modified version of Unity built-in shader.
|
|
|
|
Shader "Nature/Terrain/Digger/Cuttable-Triplanar" {
|
|
Properties {
|
|
// used in fallback on old cards & base map
|
|
[HideInInspector] _MainTex ("BaseMap (RGB)", 2D) = "white" {}
|
|
[HideInInspector] _Color ("Main Color", Color) = (1,1,1,1)
|
|
|
|
// controls transparency to cut holes
|
|
_TerrainHolesTexture ("Transparency Map (RGBA)", 2D) = "white" {}
|
|
|
|
[HideInInspector] _TerrainWidthInv ("_TerrainWidthInv", float) = 1.0
|
|
[HideInInspector] _TerrainHeightInv ("_TerrainHeightInv", float) = 1.0
|
|
}
|
|
|
|
SubShader {
|
|
Tags {
|
|
"Queue" = "Geometry-100"
|
|
"RenderType" = "Opaque"
|
|
"TerrainCompatible" = "True"
|
|
}
|
|
|
|
CGPROGRAM
|
|
#pragma surface surf Standard vertex:SplatmapVert finalcolor:SplatmapFinalColor finalgbuffer:SplatmapFinalGBuffer addshadow fullforwardshadows
|
|
#pragma instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap forwardadd
|
|
#pragma multi_compile_fog // needed because finalcolor oppresses fog code generation.
|
|
#pragma target 3.0
|
|
// needs more than 8 texcoords
|
|
#pragma exclude_renderers gles
|
|
#include "UnityPBSLighting.cginc"
|
|
|
|
#define _NORMALMAP
|
|
#define TERRAIN_STANDARD_SHADER
|
|
#define TERRAIN_INSTANCED_PERPIXEL_NORMAL
|
|
#define TERRAIN_SURFACE_OUTPUT SurfaceOutputStandard
|
|
#include "TerrainSplatmapCuttableTriplanar.cginc"
|
|
|
|
half _Metallic0;
|
|
half _Metallic1;
|
|
half _Metallic2;
|
|
half _Metallic3;
|
|
|
|
half _Smoothness0;
|
|
half _Smoothness1;
|
|
half _Smoothness2;
|
|
half _Smoothness3;
|
|
|
|
void surf (Input IN, inout SurfaceOutputStandard o) {
|
|
half4 splat_control;
|
|
half weight;
|
|
fixed4 mixedDiffuse;
|
|
half4 defaultSmoothness = half4(_Smoothness0, _Smoothness1, _Smoothness2, _Smoothness3);
|
|
SplatmapMix(IN, defaultSmoothness, splat_control, weight, mixedDiffuse, o.Normal);
|
|
o.Albedo = mixedDiffuse.rgb;
|
|
o.Alpha = weight;
|
|
o.Smoothness = mixedDiffuse.a;
|
|
o.Metallic = dot(splat_control, half4(_Metallic0, _Metallic1, _Metallic2, _Metallic3));
|
|
}
|
|
ENDCG
|
|
|
|
UsePass "Hidden/Nature/Terrain/Utilities/PICKING"
|
|
UsePass "Hidden/Nature/Terrain/Utilities/SELECTION"
|
|
}
|
|
|
|
Dependency "AddPassShader" = "Hidden/TerrainEngine/Splatmap/Digger/Cuttable-Triplanar-AddPass"
|
|
Dependency "BaseMapShader" = "Hidden/TerrainEngine/Splatmap/Digger/Cuttable-Triplanar-Base"
|
|
Dependency "BaseMapGenShader" = "Hidden/TerrainEngine/Splatmap/Digger/Cuttable-Triplanar-BaseGen"
|
|
|
|
Fallback "Nature/Terrain/Diffuse"
|
|
}
|