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 RobBrooks · Apr 29, 2016 at 06:26 AM · renderingshadersmaterials

Shader errors in Windows build ( renders black ) but not in Editor

We're currently using some shaders created with Shader Forge for our project.

Everything appears to work just fine when playing in the editor, but when we make a build, most of the shaders fail and a lot of black is the result.

During building this error is reported for many of the shaders:

Shader error in 'Shader Forge/shaderName': variable 'd' used without having been completely initialized at line 117 (on d3d11)

This alludes to the following line of shader code:

UnityGI gi = UnityGlobalIllumination(d, 1, normalDirection, ugls_en_data );

and in the output_log from the build as it's executed:

WARNING: Shader Unsupported: 'Shader Forge/shaderName' - Pass 'FORWARD' has no fragment shader WARNING: Shader Unsupported: 'Shader Forge/shaderName' - Pass 'FORWARD_DELTA' has no vertex shader WARNING: Shader Unsupported: 'Shader Forge/shaderName' - All passes removed

Here is the shader code which documents the lifetime of that crazy 'd' variable up until its moment of shame:

 /////// GI Data:
                 UnityLight light;
                 #ifdef LIGHTMAP_OFF
                     light.color = lightColor;
                     light.dir = lightDirection;
                     light.ndotl = LambertTerm (normalDirection, light.dir);
                 #else
                     light.color = half3(0.f, 0.f, 0.f);
                     light.ndotl = 0.0f;
                     light.dir = half3(0.f, 0.f, 0.f);
                 #endif
                 UnityGIInput d;
                 d.light = light;
                 d.worldPos = i.posWorld.xyz;
                 d.worldViewDir = viewDirection;
                 d.atten = attenuation;
                 d.boxMax[0] = unity_SpecCube0_BoxMax;
                 d.boxMin[0] = unity_SpecCube0_BoxMin;
                 d.probePosition[0] = unity_SpecCube0_ProbePosition;
                 d.probeHDR[0] = unity_SpecCube0_HDR;
                 d.boxMax[1] = unity_SpecCube1_BoxMax;
                 d.boxMin[1] = unity_SpecCube1_BoxMin;
                 d.probePosition[1] = unity_SpecCube1_ProbePosition;
                 d.probeHDR[1] = unity_SpecCube1_HDR;
                 Unity_GlossyEnvironmentData ugls_en_data;
                 ugls_en_data.roughness = 1.0 - gloss;
                 ugls_en_data.reflUVW = viewReflectDirection;
                 UnityGI gi = UnityGlobalIllumination(d, 1, normalDirection, ugls_en_data );
                 lightDirection = gi.light.dir;
                 lightColor = gi.light.color;


Is anyone able to suggest a place to start digging which will may unearth the root of the issue we're experiencing here?

Windows Version 8.1 Unity Version 5.3.1f1 Personal Shaderforge Version 1.2.6 Video Card Geforce GTX 980 TI

Many thanks as always.

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 RobBrooks · Apr 28, 2016 at 05:10 PM 0
Share

Just to add that enabling GI in the Scene Lighting Panel makes the runtime issues go away and also the runtime errors in the output_log file are no longer present, but the errors in the Console window after building remain.

The slight problem that I have with this is that while this sort of fixes the visual problems at runtime, I don't really want or need GI enabled and I've really not learned anything from the experience in any meaningful way. :(

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by SylvainBellangerOcelotSociety · Jun 10, 2016 at 02:56 PM

Hi Rob, our team is actually facing the exact same issue. Everything seems okay until we try to build the project. The same error and warning pop-up. Sometime some materials seem to crash randomly and compiling the shader once again in shaderforge fix most of the problems (at least in the editor...). Do you guys have any clue or update on how to fix this? Also our project is rendered in deferred and some of our opacity based shaders need to be set to forward. I don't know if it could have a negative impact. Hope you already had some answer to your problems.

Thanks :)

Comment
Add comment · 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
0

Answer by Ginxx009 · Dec 08, 2017 at 09:44 AM

Is this fixed? Cause i'm facing the same error :(

Comment
Add comment · Show 1 · 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 Ginxx009 · Dec 08, 2017 at 03:31 PM -1
Share

Solved it.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Prevent material from rendering behind itself 0 Answers

How to fix Material with custom shader turning Black in Playmode (Light Weight Render Pipeline) 0 Answers

How can I have a transparent ring around a transparent planet? 0 Answers

Every shader and quality is pink. URP 2 Answers

Custom Shader with Canvas Renderer limit draw calls. 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