Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User/brandon palmer/auto migrate shaders #199

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

palmerdesigns
Copy link
Collaborator

Overview

When Converting Lit Shader to Graphics Tools, it will Retain Changes

Changes

  • Assigned Universal Render Pipeline/Lit to Old Shader
  • Assigned Normal Map - Lit Shader
  • Assigned Emission Map - Lit Shader
  • Assigned Smoothness - Lit Shader
  • Assigned Tiling & Offset - Lit Shader
  • Assigned Metallic - Lit Shader

Copy link
Member

@Cameron-Micka Cameron-Micka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already a huge improvement, well done! Added a few comments inline. One other request is could you add support for these properties?
image

The surface type is a bit complex, but that logic occurs here:

@@ -491,13 +492,28 @@ public override void AssignNewShaderToMaterial(Material material, Shader oldShad
rimLighting = GetFloatProperty(material, "_UseRimLighting");
textureScaleOffset = GetVectorProperty(material, "_TextureScaleOffset");
}
else if (oldShader.name.Contains("Universal Render Pipeline/Lit"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add support for these URP shaders?
image

They likely use similar property names so it might be as easy as checking:
oldShader.name.Contains("Universal Render Pipeline/Lit") || oldShader.name.Contains("Universal Render Pipeline/Simple Lit") || etc...

then adding any missing properties.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a suggestion, I wonder if you could collapse all this into one conditionally so the body was the same. For example:

if (oldShader.name.Contains("Universal Render Pipeline/Lit") || oldShader.name.Contains("Universal Render Pipeline/Simple Lit") || etc... )
{
    normalMap = material.IsKeywordEnabled("_NORMALMAP") ? 1.0f : 0.0f;
    emission = material.IsKeywordEnabled("_EMISSION") ? 1.0f : 0.0f;
    reflections = GetFloatProperty(material, "_EnvironmentReflections");
    specularHighlights = GetFloatProperty(material, "_SpecularHighlights");
    smoothness = GetFloatProperty(material, "_Smoothness");
    textureScaleOffset = GetVectorProperty(material, "_TextureScaleOffset");
    metallic = GetFloatProperty(material, "_Metallic");
    alphaClip = GetFloatProperty(material, "_AlphaClip");
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also handle the opaque vs transparent render mode?
image

palmerdesigns and others added 5 commits November 17, 2023 16:12
…ardShaderGUI.cs


Removed extra line

Co-authored-by: Cameron <thmicka@microsoft.com>
…ardShaderGUI.cs


Removed Extra Line

Co-authored-by: Cameron <thmicka@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants