LuxURPCustomSkinShaderGUI.cs 1.0 KB

12345678910111213141516171819202122232425262728
  1. using UnityEngine;
  2. using UnityEditor;
  3. public class LuxURPCustomSkinShaderGUI : ShaderGUI
  4. {
  5. public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
  6. {
  7. base.OnGUI(materialEditor, properties);
  8. Material material = materialEditor.target as Material;
  9. if (material.HasProperty("_SkinLUT")) {
  10. if ( material.GetTexture("_SkinLUT") == null) {
  11. material.SetTexture("_SkinLUT", Resources.Load("DiffuseScatteringOnRing") as Texture2D );
  12. }
  13. }
  14. // Get rid of the normal map issue
  15. if ( material.HasProperty("_BumpMap") ) {
  16. if (material.HasProperty("_ApplyNormal") ) {
  17. if ( material.GetFloat("_ApplyNormal") == 0.0f && material.GetTexture("_BumpMap") == null ) {
  18. //material.SetTexture("_BumpMap", Texture2D.normalTexture); // Is not linear?!
  19. material.SetTexture("_BumpMap", Resources.Load("LuxURPdefaultBump") as Texture2D );
  20. }
  21. }
  22. }
  23. }
  24. }