Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by douglassophies · Dec 13, 2017 at 07:09 PM · shader

Surface shader vertex function 'SplatmapVert' not found

I am trying to combine two working shaders into one new one but i get the error as seen in title. I am not sure why SplatmapVert is acceptable in the terrain shader i am taking it from but cannot be found when used in the combined shader. Here is the line i want to copy over: #pragma surface surf Lambert vertex:SplatmapVert finalcolor:SplatmapFinalColor finalprepass:SplatmapFinalPrepass finalgbuffer:SplatmapFinalGBuffer noinstancing

Is it as simple as missing some reference somewhere? I am new to shaders so i worry it may be.

See below for (1)the terrain shader, (2)the FOW shader and (3)my attempt at combining them.

The terrain shader (with the pragma line i want):

 Shader "Nature/Terrain/Diffuse" {
     Properties {
         [HideInInspector] _Control ("Control (RGBA)", 2D) = "red" {}
         [HideInInspector] _Splat3 ("Layer 3 (A)", 2D) = "white" {}
         [HideInInspector] _Splat2 ("Layer 2 (B)", 2D) = "white" {}
         [HideInInspector] _Splat1 ("Layer 1 (G)", 2D) = "white" {}
         [HideInInspector] _Splat0 ("Layer 0 (R)", 2D) = "white" {}
         [HideInInspector] _Normal3 ("Normal 3 (A)", 2D) = "bump" {}
         [HideInInspector] _Normal2 ("Normal 2 (B)", 2D) = "bump" {}
         [HideInInspector] _Normal1 ("Normal 1 (G)", 2D) = "bump" {}
         [HideInInspector] _Normal0 ("Normal 0 (R)", 2D) = "bump" {}
         // used in fallback on old cards & base map
         [HideInInspector] _MainTex ("BaseMap (RGB)", 2D) = "white" {}
         [HideInInspector] _Color ("Main Color", Color) = (1,1,1,1)
     }
 
     CGINCLUDE
         #pragma surface surf Lambert vertex:SplatmapVert finalcolor:SplatmapFinalColor finalprepass:SplatmapFinalPrepass finalgbuffer:SplatmapFinalGBuffer noinstancing
         #pragma multi_compile_fog
         #include "TerrainSplatmapCommon.cginc"
 
         void surf(Input IN, inout SurfaceOutput o)
         {
             half4 splat_control;
             half weight;
             fixed4 mixedDiffuse;
             SplatmapMix(IN, splat_control, weight, mixedDiffuse, o.Normal);
             o.Albedo = mixedDiffuse.rgb;
             o.Alpha = weight;
         }
     ENDCG
 
     Category {
         Tags {
             "Queue" = "Geometry-99"
             "RenderType" = "Opaque"
         }
         // TODO: Seems like "#pragma target 3.0 _TERRAIN_NORMAL_MAP" can't fallback correctly on less capable devices?
         // Use two sub-shaders to simulate different features for different targets and still fallback correctly.
         SubShader { // for sm3.0+ targets
             CGPROGRAM
                 #pragma target 3.0
                 #pragma multi_compile __ _TERRAIN_NORMAL_MAP
             ENDCG
         }
         SubShader { // for sm2.0 targets
             CGPROGRAM
             ENDCG
         }
     }
 
     Dependency "AddPassShader" = "Hidden/TerrainEngine/Splatmap/Diffuse-AddPass"
     Dependency "BaseMapShader" = "Diffuse"
     Dependency "Details0"      = "Hidden/TerrainEngine/Details/Vertexlit"
     Dependency "Details1"      = "Hidden/TerrainEngine/Details/WavingDoublePass"
     Dependency "Details2"      = "Hidden/TerrainEngine/Details/BillboardWavingDoublePass"
     Dependency "Tree0"         = "Hidden/TerrainEngine/BillboardTree"
 
     Fallback "Diffuse"
 }



The Fog of War shader i am trying to combine with it:

 Shader "Fog Of War/Terrain" {
     Properties {
         _MainTex ("Base (RGB)", 2D) = "white" {}
     }
     SubShader {
         Tags { "RenderType"="Opaque" }
         LOD 200
         
         CGPROGRAM
         #pragma surface surf Lambert
         #include "FOWIncludes.cginc"
 
         sampler2D _MainTex;
         sampler2D _FOWTex;
         float4 _FOWTex_ST;
 
         struct Input {
             float2 uv_MainTex;
             float3 worldPos;
         };
 
         void surf (Input IN, inout SurfaceOutput o) {
             half4 c = tex2D(_MainTex, IN.uv_MainTex);
             half4 fow = tex2D(_FOWTex, TRANSFORM_TEX(IN.worldPos.xz, _FOWTex));
             half4 t = TransformColourFOWAO(c, fow);
             o.Albedo = t.rgb;
             o.Alpha = t.a;
         }
         ENDCG
     } 
     FallBack "Diffuse"
 }

   

The combined result so far (should be the same effect as the FOW one above):

     Shader "Nature/Terrain/FOW" 
     {
         Properties 
         {
             [HideInInspector] _Control ("Control (RGBA)", 2D) = "red" {}
             [HideInInspector] _Splat3 ("Layer 3 (A)", 2D) = "white" {}
             [HideInInspector] _Splat2 ("Layer 2 (B)", 2D) = "white" {}
             [HideInInspector] _Splat1 ("Layer 1 (G)", 2D) = "white" {}
             [HideInInspector] _Splat0 ("Layer 0 (R)", 2D) = "white" {}
             [HideInInspector] _Normal3 ("Normal 3 (A)", 2D) = "bump" {}
             [HideInInspector] _Normal2 ("Normal 2 (B)", 2D) = "bump" {}
             [HideInInspector] _Normal1 ("Normal 1 (G)", 2D) = "bump" {}
             [HideInInspector] _Normal0 ("Normal 0 (R)", 2D) = "bump" {}
             [HideInInspector] _MainTex ("BaseMap (RGB)", 2D) = "white" {}
             [HideInInspector] _Color ("Main Color", Color) = (1,1,1,1)
         }
         
             //CGINCLUDE
             //#pragma vertex:SplatmapVert finalcolor:SplatmapFinalColor
             //ENDCG
     
             SubShader 
             {
                 Tags 
                 {  
                     "RenderType"="Opaque" 
                 }
                 LOD 200
             
                 CGPROGRAM
                 #pragma multi_compile_fog
                    #pragma surface surf Lambert //vertex:SplatmapVert finalcolor:SplatmapFinalColor finalprepass:SplatmapFinalPrepass finalgbuffer:SplatmapFinalGBuffer noinstancing
                 #include "FOWIncludes.cginc"
     
                 sampler2D _MainTex;
                 sampler2D _FOWTex;
                 float4 _FOWTex_ST;
     
                 struct Input 
                 {
                     float2 uv_MainTex;
                     float3 worldPos;
                 };
     
     
                 void surf (Input IN, inout SurfaceOutput o) 
                 {
                     half4 splat_control;
                     half weight;
                     fixed4 mixedDiffuse;
     
                     //SplatmapMix(IN, splat_control, weight, mixedDiffuse, o.Normal);
     
                     half4 c = tex2D(_MainTex, IN.uv_MainTex);
                     half4 fow = tex2D(_FOWTex, TRANSFORM_TEX(IN.worldPos.xz, _FOWTex));
                     half4 t = TransformColourFOWAO(c, fow);
     
     
                     o.Albedo = t.rgb;
                     o.Alpha = t.a;
                 }
                 ENDCG
     
     
     
             } 
     
         Dependency "AddPassShader" = "Hidden/TerrainEngine/Splatmap/Diffuse-AddPass"
         Dependency "BaseMapShader" = "Diffuse"
         Dependency "Details0"      = "Hidden/TerrainEngine/Details/Vertexlit"
         Dependency "Details1"      = "Hidden/TerrainEngine/Details/WavingDoublePass"
         Dependency "Details2"      = "Hidden/TerrainEngine/Details/BillboardWavingDoublePass"
         Dependency "Tree0"         = "Hidden/TerrainEngine/BillboardTree"
     
         Fallback "Diffuse"
     
     }





Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

114 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to force the compilation of a shader in Unity? 5 Answers

How do I sample a shadowmap in a custom shader? 3 Answers

Apply Shader to overlay GUI 0 Answers

Assigning vertex normal in Surface program to o.Normal brakes lighting? 0 Answers

Skybox blending 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges