diff --git a/Main/CGIncludes/XSLighting.cginc b/Main/CGIncludes/XSLighting.cginc index 98b969c..af3cf8f 100644 --- a/Main/CGIncludes/XSLighting.cginc +++ b/Main/CGIncludes/XSLighting.cginc @@ -51,7 +51,9 @@ half4 BRDF_XSLighting(XSLighting i) half4 outlineColor = calcOutlineColor(i, d, indirectDiffuse, lightCol); half lineHalftone = 0; - half stippling = 0; + half stipplingDirect = 0; + half stipplingRim = 0; + half stipplingIndirect = 0; bool usingLineHalftone = 0; if(_HalftoneType == 0 || _HalftoneType == 2) { @@ -61,10 +63,13 @@ half4 BRDF_XSLighting(XSLighting i) if(_HalftoneType == 1 || _HalftoneType == 2) { - stippling = DotHalftone(i, saturate(dot(directSpecular + rimLight + directSpecular, grayscaleVec))) * saturate(dot(shadowRim * ramp, grayscaleVec)); - directSpecular *= stippling; - indirectSpecular *= lerp(0.5, 1, stippling); // Don't want these to go completely black, looks weird - rimLight *= stippling; + stipplingDirect = DotHalftone(i, saturate(dot(directSpecular, grayscaleVec))) * saturate(dot(shadowRim * ramp, grayscaleVec)); + stipplingRim = DotHalftone(i, saturate(dot(rimLight, grayscaleVec))) * saturate(dot(shadowRim * ramp, grayscaleVec)); + stipplingIndirect = DotHalftone(i, saturate(dot(indirectSpecular, grayscaleVec))) * saturate(dot(shadowRim * ramp, grayscaleVec)); + + directSpecular *= stipplingDirect; + rimLight *= stipplingRim; + indirectSpecular *= lerp(0.5, 1, stipplingIndirect); // Don't want these to go completely black, looks weird } half4 col; @@ -77,6 +82,6 @@ half4 BRDF_XSLighting(XSLighting i) col += calcEmission(i, lightAvg); float4 finalColor = lerp(col, outlineColor, i.isOutline) * lerp(1, lineHalftone, _HalftoneLineIntensity * usingLineHalftone); - //finalColor = lerp(finalColor, stippling, 0.9999); + //finalColor = lerp(finalColor, rimLight.xyzz, 0.9999); return finalColor; } \ No newline at end of file diff --git a/XSToon 2.0 _ StippledHalftone.mat b/XSToon 2.0 _ StippledHalftone.mat new file mode 100644 index 0000000..0d1845b --- /dev/null +++ b/XSToon 2.0 _ StippledHalftone.mat @@ -0,0 +1,145 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: XSToon 2.0 + m_Shader: {fileID: 4800000, guid: 85c615217d617204cb497ae6838b8bae, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 6 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BakedCubemap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Matcap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Ramp: + m_Texture: {fileID: 2800000, guid: 529b95e318b684643b47bd73e037118a, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _RampSelectionMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ReflectivityMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecularMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ThicknessMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _AdvMode: 0 + - _AnisotropicAX: 0.25 + - _AnisotropicAY: 0.75 + - _BumpScale: 1 + - _ClearCoat: 0 + - _ClearcoatSmoothness: 0.8 + - _ClearcoatStrength: 1 + - _Culling: 2 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _EmissionToDiffuse: 0 + - _Glossiness: 0 + - _HalftoneDotAmount: 50 + - _HalftoneDotSize: 1.7 + - _HalftoneLineAmount: 150 + - _Metallic: 0 + - _OutlineWidth: 1 + - _ReflectionBlendMode: 0 + - _ReflectionMode: 3 + - _Reflectivity: 1 + - _RimIntensity: 0 + - _RimRange: 0.7 + - _RimSharpness: 0.1 + - _RimThreshold: 0.1 + - _SSDistortion: 1 + - _SSPower: 1 + - _SSSRange: 1 + - _SSSSharpness: 0.2 + - _SSScale: 1 + - _Saturation: 1 + - _ScaleWithLight: 1 + - _ScaleWithLightSensitivity: 1 + - _ShadowRimRange: 0.7 + - _ShadowRimSharpness: 0.3 + - _ShadowRimThreshold: 0.1 + - _ShadowSharpness: 0.5 + - _SpecMode: 0 + - _SpecularAlbedoTint: 1 + - _SpecularArea: 0.5 + - _SpecularIntensity: 0 + - _SpecularStyle: 0 + - _Stencil: 0 + - _StencilComp: 0 + - _StencilOp: 0 + - _TilingMode: 0 + - _UVSetAlbedo: 0 + - _UVSetDetMask: 0 + - _UVSetDetNormal: 0 + - _UVSetEmission: 0 + - _UVSetMetallic: 0 + - _UVSetNormal: 0 + - _UVSetOcclusion: 0 + - _UVSetReflectivity: 0 + - _UVSetSpecular: 0 + - _UVSetThickness: 0 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} + - _MatcapTint: {r: 1, g: 1, b: 1, a: 1} + - _OcclusionColor: {r: 0, g: 0, b: 0, a: 0} + - _OutlineColor: {r: 0, g: 0, b: 0, a: 1} + - _RimColor: {r: 1, g: 1, b: 1, a: 1} + - _SSColor: {r: 0, g: 0, b: 0, a: 0} + - _ShadowRim: {r: 1, g: 1, b: 1, a: 1} diff --git a/XSToon 2.0 _ StippledHalftone.mat.meta b/XSToon 2.0 _ StippledHalftone.mat.meta new file mode 100644 index 0000000..8fe3b13 --- /dev/null +++ b/XSToon 2.0 _ StippledHalftone.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 80add08b1b71e974cb7445f615a6d45f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: