Skip to content

Commit

Permalink
Merge pull request #19 from Masterexa/develop
Browse files Browse the repository at this point in the history
Update : v7.1
  • Loading branch information
Masterexa authored Jan 17, 2020
2 parents e02b852 + c9c6111 commit 864ee1b
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
"m_Image": { "instanceID": 0 },
"m_Tooltip": "Unityの標準的なGIを利用する"
},
"blendOcclusionToAlbedoText":{
"m_Text": "オクルージョンをアルベドに適用",
"m_Image": { "instanceID": 0 },
"m_Tooltip": ""
},
"cullModeText": {
"m_Text": "カリングモード",
"m_Image": { "instanceID": 0 },
Expand All @@ -63,5 +68,4 @@
"primaryMapsText": "Main Maps",
"lineSettingsText": "Outline",
"advancedOptionsText": "Options"

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ class Styles {
public GUIContent lineSizeText = new GUIContent("Size", "Size of outline(Viewport Space)");
public GUIContent lineColorText = new GUIContent("Color", "Color(RGB) and Transparency(Alpha)");

public GUIContent standardGIText = new GUIContent("Use Traditional GI", "");
public GUIContent cullModeText = new GUIContent("Cull Mode", "");
public GUIContent standardGIText = new GUIContent("Use Traditional GI", "");
public GUIContent blendOcclusionToAlbedoText = new GUIContent("Blend Occlusion to Albedo", "");
public GUIContent cullModeText = new GUIContent("Cull Mode", "");

public string tipsText = "Recommend \"No ramp\" and \"No shadow casting\" for character material.";
public string primaryMapsText = "Main Maps";
Expand Down Expand Up @@ -82,6 +83,7 @@ class Styles {

MaterialProperty cullMode;
MaterialProperty useStandardGI;
MaterialProperty blendOcclusionToAlbedo;

bool m_firstTimeApply = true;
MaterialEditor m_materialEditor = null;
Expand Down Expand Up @@ -192,6 +194,7 @@ void DoOptionsArea(Material mtl) {
EditorGUILayout.Space();
GUILayout.Label(s_styles.advancedOptionsText, EditorStyles.boldLabel);
m_materialEditor.ShaderProperty(useStandardGI, s_styles.standardGIText);
m_materialEditor.ShaderProperty(blendOcclusionToAlbedo, s_styles.blendOcclusionToAlbedoText);
}

void BlendModeProp() {
Expand Down Expand Up @@ -273,6 +276,7 @@ void FindProperties(MaterialProperty[] props) {
// Option
cullMode = FindProperty("_Cull", props);
useStandardGI = FindProperty("_UseStandardGI", props);
blendOcclusionToAlbedo = FindProperty("_BlendOcclusionToAlbedo", props);

if( blendMode!=null && alphaCutoff!=null )
{
Expand Down Expand Up @@ -315,6 +319,7 @@ static void SetMaterialKeywords(Material mtl) {
SetKeyword(mtl, "_EMISSION", shouldEmissionBeEnabled);
// GI Mode
SetKeyword(mtl, "NWH_TOON_STANDARDGI", mtl.GetFloat("_UseStandardGI")==1f);
SetKeyword(mtl, "HTS_BLEND_OCCLUSION_TO_ALBEDO", mtl.GetFloat("_BlendOcclusionToAlbedo")==1f);

// Lightmap emissive
var flags = mtl.globalIlluminationFlags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ inline half4 SampleMOXSMap(float2 uv)
o.Smoothness = moxs.a;
o.Albedo = c.rgb;
o.Emission = emit;
o.Occlusion = moxs.g;
o.Alpha = c.a;

#ifdef HTS_BLEND_OCCLUSION_TO_ALBEDO
o.Albedo *= moxs.g;
o.Occlusion = 1.0;
#else
o.Occlusion = moxs.g;
#endif

#ifdef NWH_TOON_CUTOUT
clip(c.a-_Cutoff);
#endif
Expand Down
1 change: 1 addition & 0 deletions Assets/Nowhere/HoshiyukiToon/Shaders/LitFadeOutline.shader
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Shader "HoshiyukiToon/LitFadeOutline"
_EmissionMap ( "Emission", 2D ) = "white"{}
// Lit Options
[ToggleOff] _UseStandardGI("Use Standard GI", Float) = 0
[ToggleOff] _BlendOcclusionToAlbedo("Blend Occlusion to Albedo", Float) = 0
[Enum(UnityEngine.Rendering.CullMode)] _Cull("Cull Mode", Float ) = 2
[HideInInspector] _Blend( "Mode", Float ) = 0

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Assets/Nowhere/HoshiyukiToon/Shaders/LitOutline.shader
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Shader "HoshiyukiToon/LitOutline"
_EmissionMap ( "Emission", 2D ) = "white"{}
// Lit Options
[ToggleOff] _UseStandardGI("Use Standard GI", Float) = 0
[ToggleOff] _BlendOcclusionToAlbedo("Blend Occlusion to Albedo", Float) = 0
[Enum(UnityEngine.Rendering.CullMode)] _Cull("Cull Mode", Float ) = 2
[HideInInspector] _Blend( "Mode", Float ) = 0

Expand Down
4 changes: 2 additions & 2 deletions Assets/Nowhere/HoshiyukiToon/Shaders/LitOutline.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Assets/Nowhere/HoshiyukiToon/Shaders/ToonLit.shader
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Shader "HoshiyukiToon/Lit" {

// Lit Options
[ToggleOff] _UseStandardGI("Use Standard GI", Float) = 0
[ToggleOff] _BlendOcclusionToAlbedo("Blend Occlusion to Albedo", Float) = 0
[Enum(UnityEngine.Rendering.CullMode)] _Cull("Cull Mode", Float ) = 2
[HideInInspector] _Blend("Mode", Float) = 0
}
Expand All @@ -37,6 +38,7 @@ Shader "HoshiyukiToon/Lit" {
CGPROGRAM
#pragma multi_compile _ NWH_TOON_CUTOUT
#pragma multi_compile _ NWH_TOON_STANDARDGI
#pragma multi_compile _ HTS_BLEND_OCCLUSION_TO_ALBEDO
#pragma surface surfLitBase ToonRampMetallic2 fullforwardshadows addshadow
#pragma target 3.0
#define HTS_USE_POINTLIGHTRAMP
Expand Down
2 changes: 2 additions & 0 deletions Assets/Nowhere/HoshiyukiToon/Shaders/ToonLitFade.shader
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Shader "HoshiyukiToon/LitFade" {

// Lit Options
[ToggleOff] _UseStandardGI("Use Standard GI", Float) = 0
[ToggleOff] _BlendOcclusionToAlbedo("Blend Occlusion to Albedo", Float) = 0
[Enum(UnityEngine.Rendering.CullMode)] _Cull("Cull Mode", Float ) = 2
[HideInInspector] _Blend("Mode", Float) = 0
}
Expand All @@ -50,6 +51,7 @@ Shader "HoshiyukiToon/LitFade" {
CGPROGRAM
#pragma multi_compile _ NWH_TOON_CUTOUT
#pragma multi_compile _ NWH_TOON_STANDARDGI
#pragma multi_compile _ HTS_BLEND_OCCLUSION_TO_ALBEDO
#pragma surface surfLitBase ToonRampMetallic2 fullforwardshadows keepalpha
#pragma target 3.0
#define HTS_USE_POINTLIGHTRAMP
Expand Down
4 changes: 2 additions & 2 deletions Assets/Nowhere/HoshiyukiToon/Shaders/ToonLitFade.shader.meta

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
Expand Up @@ -8,7 +8,7 @@ Material:
m_PrefabInternal: {fileID: 0}
m_Name: Suzanne_ao
m_Shader: {fileID: 4800000, guid: d6ca4d37b0ad45e429f895352d602cb5, type: 3}
m_ShaderKeywords: _USESTANDARDGI_OFF
m_ShaderKeywords: HTS_BLEND_OCCLUSION_TO_ALBEDO _USESTANDARDGI_OFF
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
Expand Down Expand Up @@ -73,6 +73,7 @@ Material:
m_Floats:
- _Blend: 0
- _BlendFactor: 0.589
- _BlendOcclusionToAlbedo: 1
- _BumpScale: 1
- _Cull: 2
- _Cutoff: 0
Expand All @@ -88,6 +89,7 @@ Material:
- _OutlineSize: 0.002
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularFactor: 0
- _SpecularHighlights: 1
- _SpecularStrength: 1
- _SrcBlend: 1
Expand Down
Binary file modified HoshiyukiToonShader_beta.unitypackage
Binary file not shown.

0 comments on commit 864ee1b

Please sign in to comment.