Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 manny003 · Aug 28, 2017 at 08:07 PM · shaderpost-process-effect

Render Texture Screen Effect: Custom Shader Not Tiling

I am by no means a Shader programer by any stretch. I'm just fumbling through. I've managed to implement a camera dissolve effect which will gradually make what a camera see appear using a noise pattern and superimpose it over a static background -- rendered by another camera.

I've got it working almost exactly as I imagined it in mythology head. Except that the shader I'm using, that I found in the internet and, is not tiling the noise image when I'm blitting the Render Texture. No matter what values I use for X and Y Noise image tiling -- it has no effect.

I've tried several changes to the shader with suggestions I've found but nothing works. Can I get a hand from the Unity Answer Community?

Below is the current working shader code:

 Shader "Custom/Unlit/DissolveEffectShader"
 {
     Properties
     {
         _MainTex ("Texture", 2D) = "white" {}
         _NoiseTex ("Texture", 2D) = "white" {}
         _EdgeColour1 ("Edge colour 1", Color) = (1.0, 1.0, 1.0, 1.0)
         _EdgeColour2 ("Edge colour 2", Color) = (1.0, 1.0, 1.0, 1.0)
         _Level ("Dissolution level", Range (0.0, 1.0)) = 0.1
         _Edges ("Edge width", Range (0.0, 1.0)) = 0.1
     }
     SubShader
     {
         Tags { "Queue"="Transparent" "RenderType"="Transparent" }
         LOD 100
 
         Pass
         {
             Blend SrcAlpha OneMinusSrcAlpha
             Cull Off
             Lighting Off
             ZWrite Off
             ZTest Always
             Fog { Mode Off }
 
             CGPROGRAM
             #pragma vertex vert
             #pragma fragment frag
 
             #include "UnityCG.cginc"
 
             struct appdata
             {
                 float4 vertex : POSITION;
                 float2 uv : TEXCOORD0;
             };
 
             struct v2f
             {
                 float2 uv : TEXCOORD0;
                 float4 vertex : SV_POSITION;
             };
 
             sampler2D _MainTex;
             sampler2D _NoiseTex;
             float4 _EdgeColour1;
             float4 _EdgeColour2;
             float _Level;
             float _Edges;
             float4 _MainTex_ST;
 
             v2f vert (appdata v)
             {
                 v2f o;
                 o.vertex = UnityObjectToClipPos(v.vertex);
                 o.uv = TRANSFORM_TEX(v.uv, _MainTex);
 
                 return o;
             }
             
             fixed4 frag (v2f i) : SV_Target
             {
                 // sample the texture
                 float cutout = tex2D(_NoiseTex, i.uv).r;
                 fixed4 col = tex2D(_MainTex, i.uv);
 
                 if (cutout < _Level)
                     discard;
 
                 if(cutout < col.a && cutout < _Level + _Edges)
                     col =lerp(_EdgeColour1, _EdgeColour2, (cutout-_Level)/_Edges );
 
                 return col;
             }
             ENDCG
         }
     }
 }
Comment
Add comment · Show 2
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 AdamThacker · Aug 29, 2017 at 03:22 PM 0
Share

Think I might have the same issue as you...

We've just upgraded from 5.5.1p1 to 2017.1.0f3 and found that a number of our blit materials are no longer working as expected. Having spent the day investigating it, the issue appears to be that the Tiling value (scale in script) on the material is ignored and (1, 1) is always used.

avatar image Glurth · Aug 29, 2017 at 04:34 PM 0
Share

In the sample shader program on https://docs.unity3d.com/$$anonymous$$anual/ShaderTut2.html the member of the appdata parameter value passed into TRANSFOR$$anonymous$$_TEX is v.texcoord, but I see you pass in v.uv

I am NOT clear what the difference between these two is (based on their NA$$anonymous$$ES they sure sound like the same thing), still perhaps changing it will help.

Edit: oh never$$anonymous$$d, they are using appdata_base as the input type: missed that- sorry.

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

109 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

Related Questions

Shader works in Editor/Windows but not on Android 1 Answer

Shader to ignore post processing effects 0 Answers

Why doesn't this shader work when using it with as a custom effect on the post processing stack 1 Answer

Different between tex2D and SAMPLE_TEXTURE2D (Post Processing effect) 0 Answers

How to Get Nice Thick Toon-Like Outlines On Non-Smooth Geometry? 1 Answer


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