• 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 /
This question was closed Jan 04, 2014 at 11:06 PM by NightmarexGR for the following reason:

Problem is outdated

avatar image
0
Question by NightmarexGR · May 10, 2013 at 02:48 PM · terrainshaderstransparencybrush

Transparent Terrain Texture Painting (3.5 Free version)

Ok hallo everyone , first of all i dont know anything about shaders and i am not keen into start learning but i need them for first and last time for my game , i want to paint parts of my terrain or the whole terrain trasparent ( not tottaly invisible but a bit ) and i came into this outdated script , i tried to fix it but with no luck any help ? this is the script : Shader "Nature/Terrain/Diffuse" { Properties { _Control ("Control (RGBA)", 2D) = "red" {} _Splat3 ("Layer 3 (A)", 2D) = "white" {} _Splat2 ("Layer 2 (B)", 2D) = "white" {} _Splat1 ("Layer 1 (G)", 2D) = "white" {} _Splat0 ("Layer 0 (R)", 2D) = "white" {} //Used in fallback on old cards & base map _MainTex ("BaseMap (RGB)", 2D) = "white" {} _Color ("Main Color", Color) = (1,1,1,1) }

     SubShader
     {
         Tags
         {
             "SplatCount" = "4"
             "Queue" = "Geometry-100"
             "RenderType" = "Opaque"
         }
         Blend SrcAlpha OneMinusSrcAlpha
         
         CGPROGRAM
         #pragma surface surf Lambert
         struct Input
         {
             float2 uv_Control : TEXCOORD0;
             float2 uv_Splat0 : TEXCOORD1;
             float2 uv_Splat1 : TEXCOORD2;
             float2 uv_Splat2 : TEXCOORD3;
             float2 uv_Splat3 : TEXCOORD4;
         };
  
         sampler2D _Control;
         sampler2D _Splat0,_Splat1,_Splat2,_Splat3;
  
         void surf (Input IN, inout SurfaceOutput o)
         {
             fixed4 splat_control = tex2D (_Control, IN.uv_Control);
             fixed4 firstSplat = tex2D (_Splat0, IN.uv_Splat0);
             fixed3 col;
             col = splat_control.r * tex2D (_Splat0, IN.uv_Splat0).rgb;
             col += splat_control.g * tex2D (_Splat1, IN.uv_Splat1).rgb;
             col += splat_control.b * tex2D (_Splat2, IN.uv_Splat2).rgb;
             col += splat_control.a * tex2D (_Splat3, IN.uv_Splat3).rgb;
             o.Albedo = col;
             o.Alpha = 1;
             if(tex2D(_Splat0, IN.uv_Splat0).a == 0)
                 o.Alpha = 1 - splat_control.r;
             else if(tex2D(_Splat1, IN.uv_Splat1).a == 0)
                 o.Alpha = 1 - splat_control.g;
             else if(tex2D(_Splat2, IN.uv_Splat2).a == 0)
                 o.Alpha = 1 - splat_control.b;
             else if(tex2D(_Splat3, IN.uv_Splat3).a == 0)
                 o.Alpha = 1 - splat_control.a;
         }
         ENDCG
     }
  
     Dependency "AddPassShader" = "Hidden/TerrainEngine/Splatmap/Lightmap-AddPass"
     Dependency "BaseMapShader" = "Diffuse"
  
     //Fallback to Diffuse
     Fallback "Diffuse"
 }




and the errors are these : Shader warning in 'Nature/Terrain/Diffuse': Not enough temporary registers, needs 9 (compiling for flash) at line 25 Shader warning in 'Nature/Terrain/Diffuse': Not enough temporary registers, needs 10 (compiling for flash) at line 25


can anyone fix them , cause i have no idea

Comment
Add comment · Show 3
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
avatar image NightmarexGR · May 11, 2013 at 09:08 AM 0
Share

bump , i need this , anyone ?

avatar image chillersanim · May 11, 2013 at 10:00 AM 0
Share

Look at this post, there is a similar question, but already answered. It seems that you have a code that doesn't work so well on the GPU.

avatar image NightmarexGR · May 13, 2013 at 12:31 PM 0
Share

I removed these lines and the error dissapeared but now the script doesnt do anything at all :C so if anyone has a working script/shader it would be helpfull !!

0 Replies

  • Sort: 

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

15 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

Related Questions

How to paint transparent texture on terrain? 0 Answers

How to make terrain partially transparent (lower opacity) 1 Answer

Terrain Tree Billboard have bright outline against dark background 6 Answers

Terrain brush not matching with cursor. 1 Answer

Basic Shader questions for transparent textures on mobile devices 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