-
Notifications
You must be signed in to change notification settings - Fork 439
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
Fix MToon 1.0 functions. #1101
Fix MToon 1.0 functions. #1101
Changes from all commits
8c66173
f71e1fb
23a50ae
93d4507
3cb5d97
eb532c4
1549db1
8e0322a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace VRMShaders.VRM10.MToon10.Editor | ||
{ | ||
public enum MToon10EditorEditMode | ||
{ | ||
Basic = 0, | ||
Advanced = 1, | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Shader "Hidden/VRM10/vrmc_materials_mtoon" | ||
Shader "VRM10/MToon10" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename |
||
{ | ||
Properties | ||
{ | ||
|
@@ -16,10 +16,10 @@ Shader "Hidden/VRM10/vrmc_materials_mtoon" | |
_ShadeTex ("mtoon.shadeMultiplyTexture", 2D) = "white" {} | ||
[Normal] _BumpMap ("normalTexture", 2D) = "bump" {} // Unity specified name | ||
_BumpScale ("normalTexture.scale", Float) = 1.0 // Unity specified name | ||
_ShadingShiftFactor ("mtoon.shadingShiftFactor", Range(-1, 1)) = 0 | ||
_ShadingShiftFactor ("mtoon.shadingShiftFactor", Range(-1, 1)) = -0.05 | ||
_ShadingShiftTex ("mtoon.shadingShiftTexture", 2D) = "black" {} // channel R | ||
_ShadingShiftTexScale ("mtoon.shadingShiftTexture.scale", Float) = 1 | ||
_ShadingToonyFactor ("mtoon.shadingToonyFactor", Range(0, 1)) = 0.9 | ||
_ShadingToonyFactor ("mtoon.shadingToonyFactor", Range(0, 1)) = 0.95 | ||
|
||
// GI | ||
_GiEqualization ("mtoon.giEqualizationFactor", Range(0, 1)) = 0.9 | ||
|
@@ -58,6 +58,9 @@ Shader "Hidden/VRM10/vrmc_materials_mtoon" | |
|
||
// etc | ||
_M_DebugMode ("_DebugMode", Float) = 0.0 | ||
|
||
// for Editor | ||
_M_EditMode ("_EditMode", Float) = 0.0 | ||
} | ||
|
||
// Shader Model 3.0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,15 +24,16 @@ Varyings MToonVertex(const Attributes v) // v is UnityCG macro specified name. | |
const VertexPositionInfo position = MToon_GetOutlineVertex(v.vertex.xyz, normalize(v.normalOS), output.uv); | ||
output.pos = position.positionCS; | ||
output.positionWS = position.positionWS; | ||
output.normalWS = UnityObjectToWorldNormal(-v.normalOS); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix outline normal |
||
} | ||
else | ||
{ | ||
const VertexPositionInfo position = MToon_GetVertex(v.vertex.xyz); | ||
output.pos = position.positionCS; | ||
output.positionWS = position.positionWS; | ||
output.normalWS = UnityObjectToWorldNormal(v.normalOS); | ||
} | ||
|
||
output.normalWS = UnityObjectToWorldNormal(v.normalOS); | ||
output.viewDirWS = MToon_GetWorldSpaceNormalizedViewDir(output.positionWS); | ||
|
||
#if defined(_NORMALMAP) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,8 @@ public static float MigrateToShadingShift(float shadingToony0X, float shadingShi | |
{ | ||
var (rangeMin, rangeMax) = GetShadingRange0X(shadingToony0X, shadingShift0X); | ||
|
||
// new shadingShift is the center of range. | ||
return Mathf.Clamp((rangeMax - rangeMin) * 0.5f, -1, +1); | ||
// new shadingShift is the center of range inverted. | ||
return Mathf.Clamp((rangeMax + rangeMin) * 0.5f * -1f, -1, +1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix migration |
||
} | ||
|
||
/// <summary> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Inspector mode