LOD Fade not working properly

Node-based Shader Editor

LOD Fade not working properly

Postby TheGabmeister » Tue Jul 17, 2018 4:25 am

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.
TheGabmeister
 
Posts: 3
Joined: Tue Jul 17, 2018 3:49 am

Re: LOD Fade not working properly

Postby Amplify_Borba » Tue Jul 17, 2018 9:47 am

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!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: LOD Fade not working properly

Postby TheGabmeister » Tue Jul 17, 2018 10:43 am

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
TheGabmeister
 
Posts: 3
Joined: Tue Jul 17, 2018 3:49 am

Re: LOD Fade not working properly

Postby Amplify_Borba » Tue Jul 17, 2018 11:23 am

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!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: LOD Fade not working properly

Postby TheGabmeister » Tue Jul 17, 2018 12:07 pm

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.
TheGabmeister
 
Posts: 3
Joined: Tue Jul 17, 2018 3:49 am

Re: LOD Fade not working properly

Postby Amplify_Borba » Wed Jul 18, 2018 2:15 pm

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 );         
   }
}
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: LOD Fade not working properly

Postby Amplify_Borba » Wed Aug 22, 2018 4:05 pm

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!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 0 guests

cron