Unity3D PerRendererData

http://nordicedu.com/tkokblog/wordpress/?tag=perrendererdata

MaterialPropertyBlock and SpriteRenderer

Once again the “Unity-way” supraised me. I made this simple Dissolve shader for sprites. There were many difficulties on a way but the most ambiguous one was releated to SpriteRenderer and MaterialPropertyBlock.

When you do your own shader for sprites and want to use the MaterialPropertyBlock to send some [PerRendererData] you have to use Renderer.GetMaterialPropertyBlock first becouse Unity uses MaterialPropertyBlocks internaly for Sprite rendering and you don’t want to mess it up.

 

Posted in Uncategorized Tagged ,

原文地址:https://www.cnblogs.com/lilei9110/p/4515333.html