Page 1 of 1

LOD Fade not working properly

PostPosted: Tue Jul 17, 2018 4:25 am
by TheGabmeister
I'm having trouble with the LOD fade effect demonstrated in the node documentation:
http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/LOD_Fade

I tried to replicate the effect in Unity 2018.1.7 by simply following the nodes used in the documentation and making an LOD group:
Image

However, what I got, was an LOD swap without the fade effect.
Image

I double checked checked all the nodes, made sure that Fade Mode is set to "Cross Fade," and played around with all the node settings. I suspect that I might be doing something wrong with the Static Switch node since all the other nodes seem to be working properly

Image

Currently looking for someone who can help.

EDIT: Images above not showing up for some reason, but they can be opened in a new tab.

Re: LOD Fade not working properly

PostPosted: Tue Jul 17, 2018 9:47 am
by Amplify_Borba
Hello, thank you for getting in touch!

You'll likely have to add the following parameters to your Output node:

Image

Do note that there are two spaces in "multi_compile __ LOD_FADE_CROSSFADE"!

Please let me know if this helps, thanks!

Re: LOD Fade not working properly

PostPosted: Tue Jul 17, 2018 10:43 am
by TheGabmeister
Thanks! The fade effect is now working as expected. I was wondering if there's a way to adjust how fast the fade effect goes.

Also, there seems to be a warning in the console every time I save and update the shader:

"Shader warning in 'New AmplifyShader 1': Automatically setting target of LOD_FADE_CROSSFADE to 3.0 at line 21"

I tried opening the shader in Visual Studio to take a look at lines 19-21, but I can't understand what's happening.

Code: Select all
      #pragma target 3.0
      #pragma multi_compile __ LOD_FADE_CROSSFADE
      #pragma surface surf Standard keepalpha addshadow fullforwardshadows dithercrossfade vertex:vertexDataFunc

Re: LOD Fade not working properly

PostPosted: Tue Jul 17, 2018 11:23 am
by Amplify_Borba
Glad to help!

This seems to be caused by the LOD Group Cross Fade parameter, could you try setting it off and see if the shader still behaves as expected?

Either way, I'll be sure to pass this to the developer for further investigation, thank you for reporting it!

Re: LOD Fade not working properly

PostPosted: Tue Jul 17, 2018 12:07 pm
by TheGabmeister
I turned off the parameter you mentioned, and it fixed the issue! Thanks again.

At the moment, I'm trying to find a way to make the fade effect slower.

Re: LOD Fade not working properly

PostPosted: Wed Jul 18, 2018 2:15 pm
by Amplify_Borba
No problem!

You can set it up via scripting, for example:

Code: Select all
public class SetFadeDuration : MonoBehaviour {

    public float fadeDuration;

    void Start ()
    {
        LODGroup.crossFadeAnimationDuration = fadeDuration;
        Debug.Log("crossFadeAnimationDuration " + LODGroup.crossFadeAnimationDuration );         
   }
}

Re: LOD Fade not working properly

PostPosted: Wed Aug 22, 2018 4:05 pm
by Amplify_Borba
Hello! Regarding the Shader warning, there seems to be no way around it, unfortunately, so it won't be possible for us to prevent it from appearing in the console.

We can confirm, however, that its harmless!

Please don't hesitate to get back in touch if you come across any further issues, thanks!