Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 drak8888 · Nov 24, 2013 at 08:14 PM · shaderexecutabledx11

Shader not working in executable and DX11

The title says it all. I use a GrabPass for my shader and it works just fine in the editor, but the second I change for DX11 or I make an executable, the GrabPass dissapears with my gloss and my normals and everything, leaving a grayish texture instead of my shader.

Screen in editor : http://imageshack.us/a/img850/2373/9xtq.jpg

Screen with DX11/Executable : http://imageshack.us/a/img132/5568/pcoz.jpg

(The white spots are another material I put on the plane, which is not affected)

And here is my shader :

 Shader "Water/CustomWaterShader" {
     Properties {
         _Color ("Main Color", Color) = (1,1,1,1)
         _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 0)
         _Shininess ("Shininess", Range (0.01, 1)) = 0.078125
         _BumpMap ("Normalmap", 2D) = "bump" {}
         _BumpMap2 ("Normalmap", 2D) = "bump" {}
         _Distortion ("Distortion", Range (75, 5)) = 40
     }
          
     SubShader {
         Tags {"Queue"="Overlay" "IgnoreProjector"="True" "RenderType"="Transparent"}
         LOD 400
         GrabPass{"_ScreenTex"}
         Cull Off
          
         CGPROGRAM
         #pragma surface surf BlinnPhong alpha
          
         sampler2D _BumpMap;
         sampler2D _ScreenTex;
         sampler2D _BumpMap2;
         fixed4 _Color;
         half _Shininess;
         half _Distortion;
          
         struct Input {
             float2 uv_BumpMap;
             float2 uv_BumpMap2;
             float4 screenPos;
         };
              
         void surf (Input IN, inout SurfaceOutput o) {
             float2 customUV;
             customUV = float2((IN.screenPos.xy/IN.screenPos.w).xyxy);
                         
             #if SHADER_API_D3D9
 
             if (customUV.y > 0)
 
                     customUV.y = 1.0f - customUV.y;
 
             #endif
              
             customUV = customUV + customUV * (UnpackNormal(tex2D(_BumpMap , IN.uv_BumpMap)/2 + tex2D(_BumpMap2 , IN.uv_BumpMap2)/2)/_Distortion);
             fixed4 bg = tex2D(_ScreenTex,customUV);
             o.Albedo = bg.rgb * _Color.rgb;
             o.Alpha = 1;
             o.Gloss = 2;
             o.Specular = _Shininess;
             o.Normal = UnpackNormal(tex2D(_BumpMap , IN.uv_BumpMap)/2 + tex2D(_BumpMap2 , IN.uv_BumpMap2)/2);
         }
         ENDCG
     }
          
     FallBack "Transparent/VertexLit"
 }

Other things that might help :

  • have Unity Free

  • get these warnings on my shader :

 Shader warning in 'Water/CustomWaterShader': Program 'vert_surf', incorrect number of arguments to numeric-type constructor (compiling for d3d11) at line 68
 Shader warning in 'Water/CustomWaterShader': Program 'vert_surf', incorrect number of arguments to numeric-type constructor (compiling for d3d11_9x) at line 68
 

Comment
Add comment · Show 1
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 drak8888 · Nov 24, 2013 at 08:19 PM 0
Share

Oh and also, my shader seems to become vertex lit, which is pretty wierd.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by tanoshimi · Nov 24, 2013 at 08:53 PM

  1. "...my shader seems to become vertex lit, which is pretty wierd..."

That's because you've specified to use VertexLit as the fallback shader on Line 56:

 FallBack "Transparent/VertexLit"

I strongly recommend that you only put fallbacks in production shaders - when you're developing you want to know when shaders are failing, not for them to silently degrade to a different shader ;) The fact that it is having to use the fallback means that something is failing in your shader code, which brings us onto...

  1. "I have Unity Free"

And there's your problem. GrabPass is a Pro-only feature (as are renderTextures, which offer related functionality).

Comment
Add comment · Show 2 · Share
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 drak8888 · Nov 25, 2013 at 12:41 AM 0
Share

Huh. Well its not even written anywhere in the wiki that its Pro-Only, and why would it work in the editor and not in the executable?

avatar image drudiverse · Sep 13, 2014 at 12:10 PM 0
Share

indieed it isnt written in the reference that it's pro only. I am getting a similar error just now for no obvious reason. it sais it's in surf function. but the line i am changing to get the error is in a different function.

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

17 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

Related Questions

Unity 5 tesselation problem 1 Answer

Dx11 displacement information 0 Answers

Graphics.DrawProcedural from OnRenderObject 1 Answer

how to use Geometry shader in unity 4 ? 1 Answer

DX11 shader model 5 unavailable 0 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