Coder Social home page Coder Social logo

unitychantoonshaderver2_project's Issues

Shader not reflecting baked/skybox lighting

I have been messing with this shader and I am a big fan of it as it's real-time shadows.
An issue I have been running into is the problem the title suggests, you can sort of overcome this with Unlit_Intensity.

However, this creates another issue of it being too bright when you actually want it to be pitch black in pitch black lighting.

I don't know if this from settings I am unaware of or if this is genuinely something on the shader's end. But either way I'd appreciate a solution if possible.

Image references
https://imgur.com/a/p3Sq75V

Singlepass compatible.

Hi guys, My current project is MagicLeap (MixedReality) game and I'm using this Toon_DoubleShadeWithFeather.shader for many objects in my game. But a weird thing happens, I can only see the object in the left eye while the right eye is rendered nothing. I figure out that this shader is not compatible with single-pass render.

There are 2 solutions: First one is enable force multipass in magic leap setting.
image
Another solution is upgrading the shader to become compatible with single pass. According to this: https://docs.unity3d.com/Manual/SinglePassInstancing.html to use SinglePassInstacing advantages. But I don't know how to upgrade that shader. Does anyone know how?

UniversalRP:Transparent objects looks different

半透明オブジェクトの表示が異なる ⇒・Quad_SPNormalの透過よりも下の見え方が異なっている。 ・Sphere_FleshのFlesh_Trans側マテリアルが表示されていない。

Very slow with UTSURP and VR

In the UNITY-CHAN SSU_URP project sample, non-VR is fast, but VR is very slow.
I think there is a problem with the shader.
コメント 2020-07-10 162026

サンプルプロジェクトをOculusGo向けにビルドするときのエラーに関して

ちょっと趣旨が違うかもしれないのとissue立てていいか迷ったんですけど
UnityChanToonShaderがここ最近初心者に使われてるので立てました。
Unity初心者の人がUniteのslideとかみてシングルパス設定でビルドしたとき
PostProcessingのShaderやImageEffectsのUTS_EdgeDetectで「undeclared identifier 'sampler_CameraDepthTexture' 」が出るんで初心者の人たち困ったりするから
回避方法とかREADMEとかにあるといいかなっと思いました。

srp batcher compitable?

I have checked urp branch.unfortunately,it doesn't support srp batcher now.Do you have a plan for this?

Invalid subscript 'vertexSH'

I'm getting the following issue on line 41 in UniversalToonBodyDoubleShadeWithFeather.hlsl

invalid subscript 'vertexSH'

Compiling Vertex program with LIGHTMAP_ON DIRLIGHTMAP_COMBINED _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _ENVIRONMENTREFLECTIONS_OFF _IS_PASS_FWDBASE _IS_TRANSCLIPPING_OFF _IS_ANGELRING_OFF _IS_CLIPPING_OFF _EMISSIVE_SIMPLE
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
Disabled keywords: _NORMALMAP _ALPHATEST_ON _ALPHAPREMULTIPLY_ON _EMISSION _METALLICSPECGLOSSMAP _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A _OCCLUSIONMAP _SPECULARHIGHLIGHTS_OFF _SPECULAR_SETUP _RECEIVE_SHADOWS_OFF _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS _ADDITIONAL_LIGHT_SHADOWS _SHADOWS_SOFT _MIXED_LIGHTING_SUBTRACTIVE _SHADINGGRADEMAP _IS_TRANSCLIPPING_ON _IS_ANGELRING_ON UTS_USE_RAYTRACING_SHADOW _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE _EMISSIVE_ANIMATION FOG_LINEAR FOG_EXP FOG_EXP2 UNITY_NO_DXT5nm UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_VIRTUAL_TEXTURING

image

What's the most compatible batching way for UTS?

I see SRP Batcher is checked in UTS2URPPipelineAsset, will UniversalToon support SRP Batcher?
Also, which is the best way batching a lot of small UTS models under stardard pipeline?
Static batching or Dynamic batching(Maybe not work because UTS is a multi pass shader).
Or should GPU Instancing work?
I have tried to test with hundreds UTS objects (same mesh, same material, with low vertices just like cube), neither SRPBatcher nor GpuInstancing takes effect.
So I wonder if there's any configuration I miss or UTS doesn't support them currently.
Any advice would be appreciated.Thanks.

Restrict shader keyword generation for vrchat

I have to explain to you the shader keyword issue in vrchat. I been waiting for you pick up the issue in my last code update in my fork of uts2-ac which explains the problem. Other shaders have been updating and minimizing their keyword count for vrchat.

To explain the keywords limit quickly. Shaders in vrchat only get about ~140 slots SHARED with everyone and if the set maxes out world post-processing can break and the user goes blind due to not having critical defines; this is the worst case. The developers and other shader writers are aware of this and adapting to the strict conditions for keywords.

The issue became worse in recent weeks because we realized in a material's debug mode, ALL KEYWORDS listed in the "keyword" text box get uploaded with an avatar and flood the limit, including old shaders that material may have had in the past from other shaders.

There is no Unity mechanism to clear out the keyword set in unity 2017, so a vrchat user has to restart their client to refresh. The keyword set is first-come-first-serve.

UTS2 will all toggles on in your code goes up ~26, enum add about 2, multi compiles about another 5.

So the max hit is about ~33.

It should be close to zero.

The keyword restricting work arounds for shader writers are:

  1. For code branching, stop using #if defines. Do not use any pre-processor defines except the ones that are used in Standard shader, because those are already safe to use and defined.

  2. For properties, stop using the normal [toggle] and enums that create keywords. Each [toggle] auto creates a keyword when that toggle is enabled and it gets uploaded with the material in the avatar into vrchat, this is not good.

  3. Adopt custom GUI properties that dont create keywords.

For problem (2), i have worked hard to solve this in UTS2-ac by replacing all [toggle] properties with a common set "" or "__" keyword. So you should replace all [toggle] with [toggle()] or [toggle(__)] and the intimidate keyword flooding issue is solved. After this property change you continue using the Float value in your lerp() functions or conditional logic.

Also (2) for enums, use number based enums, such as:

[Enum(NML,0,POS,1)] _outline_mode ("OUTLINE MODE", Int) = 0

For _outline_mode i now use branching if-else control to decide the logic, although i am mindful here of coding multi-choice enums and not on/off features like a toggle with lerp().

All the popular shaders in vrchat are minimizing their keyword usage to avoid the max keywords limit. The losing shaders are the ones that need their custom keywords, such screen post processing which break.

I recommend studying what I did and copying that or improving it. For (3) and custom GUI I will recommend studying how the Arktoon shader in its recent update removed all keywords.

Thank you for understanding the urgency of the keyword issue.

Reference [toggle] mechanics:
https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html

Reference on the idea of "_". Although it hints using "__":
https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html

Broken link in license terms

In the license at https://unity-chan.com/contents/license_en/ the clause that seems like it should apply to the code in this repo reads:

(3) "Digital Asset Data of Company's Characters"
Digital Asset Data of Company's Characters means digital data of the Company's Characters which were made into a format usable by standard computers.
Users of the Company's Characters may create derivative works of the Company's Characters under this License by using the Digital Asset Data of Company's Characters.
Further, if a portion of the Digital Asset Data of Company's Characters is converted to items other than the Company's Characters, Users shall comply only with the separately defined "Asset Store Terms of Use and End-user License Agreement" (http://japan.unity3d.com/company/legal/as_terms) and not with this License.

But http://japan.unity3d.com/company/legal/as_terms is a broken link (though https://unity3d.com/legal/as_terms works).

As it stands this renders the project effectively unlicensed, would it be possible to add an explicit license in the repo itself, even if it just points to a working Unity license link?

TCTS_Outline.cginc

アルファ付きでスクショを取る時に抜けてしまって不便なので、アウトラインのアルファは1でいいのかなと思っています。

ToonShader wont compile on ps4 build

When compiling Toon_DoubleShadeWithFeather shader for PS4, the erros on the attached file show up. I used the compile and show code button on the shader inspector window, setting it to Custom Platform - PS4.

Here is 2 of the erros and, just as a sample:

Shader error in 'UnityChanToonShader/Toon_DoubleShadeWithFeather': Program 'vert', ambiguous call to 'lerp'. Found 3 possible candidates: at Assets/ThirdParty/Toon/Shader/UCTS_DoubleShadeWithFeather.cginc(229) (on ps4)

Shader error in 'UnityChanToonShader/Toon_DoubleShadeWithFeather': Program 'frag', ambiguous call to 'dot'. Found 3 possible candidates: at Assets/ThirdParty/Toon/Shader/UCTS_DoubleShadeWithFeather.cginc(175) (on ps4)

I was able to fix them by trying to fix the "ambiguous call" that the compiler was complaining about:
UCTS_DoubleShadeWithFeather.cginc(175) :
was
o.mirrorFlag = dot(crossFwd, UNITY_MATRIX_V[2]) < 0 ? 1 : -1;
changed to:
o.mirrorFlag = dot(crossFwd, UNITY_MATRIX_V[2].xyz) < 0 ? 1 : -1;

UCTS_DoubleShadeWithFeather.cginc(229):
was
float3 lightColor = max(0, lerp(addPassLightColor, lerp(0,min(addPassLightColor,addPassLightColor/pureIntencity),_WorldSpaceLightPos0.w),_Is_Filter_LightColor));
changed to:
float3 lightColor = max(0, lerp(addPassLightColor, lerp(float3(0,0,0),min(addPassLightColor,addPassLightColor/pureIntencity),_WorldSpaceLightPos0.w),_Is_Filter_LightColor));

UCTS_Outline.cginc(90):
was
float signVar = dot(normalize(v.vertex),normalize(v.normal))<0 ? -1 : 1;
changed to:
float signVar = dot(float(normalize(v.vertex)),float(normalize(v.normal)))<0 ? -1 : 1;

I'm not sure if those are the correct fixes for the erros, but those worked for me. As such, I would like have a confirmation if this fixes are correct or what are the correct ones.

Setup:
Unity 2019.2.11f1
Unity-Chan Toon Shader Ver.2.0.7
PS4 SDK: 6.500 (6.720.001)

Toonshader compile output error.txt

Regards

Documentation: Shader Name of UniversalToon

Summary

Latest shader name is Universal Render Pipeline/Toon, but documents use the name UTS/UniversalToon.
Which name is intended one?

Configuration

Problems

Current URP-compatible UTS shader is named as Universal Render Pipeline/Toon after commit 7ae2f23.

Shader "Universal Render Pipeline/Toon" {

In contrast, document use the name UTS/UniversalToon.

**UTS/UniversalToon** is the UTS2 shader for Universal Render pipeline for Unity.

In my understanding, this toon shader is single Uber shader, so there is only one shader name.
Which is correct name?

Comment

Thunks for your great toon shader library.
I love UTS projects.
If this is non-latest documentation problem, I am grad to update documents & make pull request to fix this problem.
If there are some deep problem and my issue is non-sense, very sorry for bothering you.

Android の Vulkan 使用時にシェーダーがフォールバックします

UTS2.0.6をAndroidプラットフォーム向けにビルドする際に、使用するAPIがVulkanで動作する場合、UTSが頂点ライティングシェーダー(?)にまで落とされるようで正常に表示されませんでした。
UTSはVulkan上の動作は対象外でしょうか?

ローカル環境はWindows版のUnity2018.3.9を使用していますが、CloudBuildから同設定のビルドapkでも症状が発生しました。
動作確認機種はROG PhoneとSHIELD Tabletで最小Android APIは7.0以降を指定しています。

PlayerSettingからOpenGLES 3.0モードを優先に変更するか専用にすれば正常に表示されましたが、Vulkan優先か専用にした場合に記載の症状が発生します。
QualitySettingsを変更しても動作に影響は出ませんでした。

プロジェクトは新規に作成し、UTSを使用するモデルと2.0.6をインポートし、PlayerSettingのAPIをVulkanに変更した場合のみで発生します。

また関連があるかわからないのですが、そのビルドを作るときは以下のようなログがConsoleに残ることがありました。(記録がない場合はありますが、動作に変化はありませんでした)

Shader error in 'UnityChanToonShader/Toon_DoubleShadeWithFeather': invalid subscript '_ShadowCoord' at Assets/Toon/Shader/UCTS_DoubleShadeWithFeather.cginc(180) (on gles3)

Compiling Vertex program with UNITY_PASS_FORWARDBASE DIRECTIONAL SHADOWS_SHADOWMASK LIGHTPROBE_SH _IS_CLIPPING_OFF _IS_PASS_FWDBASE
Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER SHADER_API_MOBILE UNITY_HARDWARE_TIER1 UNITY_LIGHTMAP_DLDR_ENCODING

Shader error in 'UnityChanToonShader/Toon_DoubleShadeWithFeather_TransClipping': invalid subscript '_ShadowCoord' at Assets/Toon/Shader/UCTS_DoubleShadeWithFeather.cginc(180) (on gles3)

Compiling Vertex program with UNITY_PASS_FORWARDBASE DIRECTIONAL SHADOWS_SHADOWMASK LIGHTPROBE_SH _IS_PASS_FWDBASE _IS_CLIPPING_TRANSMODE
Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER SHADER_API_MOBILE UNITY_HARDWARE_TIER1 UNITY_LIGHTMAP_DLDR_ENCODING

Shader error in 'UnityChanToonShader/Toon_DoubleShadeWithFeather_StencilMask': invalid subscript '_ShadowCoord' at Assets/Toon/Shader/UCTS_DoubleShadeWithFeather.cginc(180) (on gles3)

Compiling Vertex program with UNITY_PASS_FORWARDBASE DIRECTIONAL SHADOWS_SHADOWMASK LIGHTPROBE_SH _IS_CLIPPING_OFF _IS_PASS_FWDBASE
Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER SHADER_API_MOBILE UNITY_HARDWARE_TIER1 UNITY_LIGHTMAP_DLDR_ENCODING

Shader error in 'UnityChanToonShader/AngelRing/Toon_ShadingGradeMap_StencilOut': invalid subscript '_ShadowCoord' at Assets/Toon/Shader/UCTS_ShadingGradeMap.cginc(207) (on gles3)

Compiling Vertex program with UNITY_PASS_FORWARDBASE DIRECTIONAL SHADOWS_SHADOWMASK LIGHTPROBE_SH _IS_PASS_FWDBASE _IS_TRANSCLIPPING_OFF _IS_ANGELRING_ON
Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER SHADER_API_MOBILE UNITY_HARDWARE_TIER1 UNITY_LIGHTMAP_DLDR_ENCODING

Shader error in 'UnityChanToonShader/AngelRing/Toon_ShadingGradeMap': invalid subscript '_ShadowCoord' at Assets/Toon/Shader/UCTS_ShadingGradeMap.cginc(207) (on gles3)

Compiling Vertex program with UNITY_PASS_FORWARDBASE DIRECTIONAL SHADOWS_SHADOWMASK LIGHTPROBE_SH _IS_PASS_FWDBASE _IS_TRANSCLIPPING_OFF _IS_ANGELRING_ON
Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER SHADER_API_MOBILE UNITY_HARDWARE_TIER1 UNITY_LIGHTMAP_DLDR_ENCODING

Shader error in 'UnityChanToonShader/Toon_ShadingGradeMap_StencilMask': invalid subscript '_ShadowCoord' at Assets/Toon/Shader/UCTS_ShadingGradeMap.cginc(207) (on gles3)

Compiling Vertex program with UNITY_PASS_FORWARDBASE DIRECTIONAL SHADOWS_SHADOWMASK LIGHTPROBE_SH _IS_PASS_FWDBASE _IS_TRANSCLIPPING_OFF _IS_ANGELRING_OFF
Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER SHADER_API_MOBILE UNITY_HARDWARE_TIER1 UNITY_LIGHTMAP_DLDR_ENCODING

[URP]Built-in vector for light direction is not pointing from angle

ビルトインライトディレクションベクトルの設定方向が「正面から」になっていて、「斜め上から」になっていない

2020/01/14
調査中。Legacy パイプラインで、一つもディレクショナルライトがない状態で WorldLightPos0 に入っている値が入っているのは特に仕様でないような。別方法で実装する必要ががあるでしょう。

2020/01/21
一つもDirectional Light がない状態だと Sunlightの値をもとにこの値を計算するはずだが単純に (0,0,-1)を入れたままにしているのでは?

2020-01-21
• が何か案を試す

HRD color range support

The saturate() functions are clamping true color ranges from inputting intense lights and finally allowing the shader to resolve full range colors, this is creating unexpected effects when UTC2 is used for scenes that correctly balance and manipulate full range light effects.

To allow full HRD color range in the shader means removing all saturate() and clamps with color. The reason for this is to allow complete support for unity's post processing stack camera effects and allow worlds to balance high intense light sources: https://docs.unity3d.com/Manual/PostProcessing-Stack.html the effects are mainly for allowing eye-adaptation and blooms to expect light ranges greater than color (1, 1, 1) and manipulating it more realistically.

The standard shader is HDR range and other toon shaders support HDR too. I have come to regularly see light sources in scene high above >2 and also as high as >100 intensity! A scene with eye adaptation will counter balance such intense light source. Unfortunately when light clamped UTC2 is paired against HDR shaders, UTC2 will become unexpectedly blacker because it could not accept the >1.0 color input or output >1.0 color before eye adaption darkens the whole screen.

Likewise a problem with not using HDR range is balancing color used for the Bloom effect, the post process stack defaults bloom at >1.1 color intensity. Combined with eye-adaptation in a HDR shader the bloom will drop correctly, but will not work balance correctly if the shader clamps colors at input or output or attempts to clamp the emission output.

I have found it possible to remove the saturate() functions around all the color manipulating functions and get ok results. Being careful to not touch the mask and shading functions that need saturate() for safe math ranges!

UTC2 edited to handle full HDR color does function well with post processing bloom on the camera somewhat, i found the additive effects of: color ramps + shine + rim light + anti-rim light + additive matcap can result in a amplified color output into emission range, so if a light math rework is needed after removing saturates() it would be the additive combination of those features... I understand PBR shaders have a way to combine the effects and balance the output.

Render Texture でアルファ付きでスクショを撮る際の問題

ゲーム中では問題なく、キャラクターのピンナップ等を出力する際に Render Texture を使ってアルファ付きスクリーンショットを撮影する際にのみ、眉毛などのアルファが眉毛の物のみになってしまいます。
※※ 眉根などアルファが適用されている部分は、肌部分はカラーのみでアルファは考慮されず、アルファ付き PNG では眉毛のテクスチャ通りに抜けてしまう。

Toon_DoubleShadeWithFeather_TransClipping.shader
142 Blend SrcAlpha OneMinusSrcAlpha


Blend One OneMinusSrcAlpha に変えると回避はできますが、若干絵が変わります。
問題がそもそも上記シェーダーで対応すべきか、他のシェーダーの見直しをすべきかまでは確認していません。
下地の肌は Toon_DoubleShadeWithFeather です。

====

それとは別に、アウトラインも TransparentCutout のせいなのか、GIF のようなガビガビのシルエットになってしまいます。※ 背景とアウトラインの境界のみ。肌の上などほかの何かがあれば設定どおり MSAA かかっているように見えます。

====

言葉では説明しづらいのですが、スクショの撮影以外では問題ないので参考まで。

Android OS6 XPeria 501SOで表示がされません。

Shaderの勉強でUCTSを使用させて頂いているのですが、実機で表示がされない為、ご教授頂きたいと思っています。
エラー内容は以下となりました。
GLSL link error: Error: input vs_TEXCOORD2 not declared in output from previous stage
確認頂く事は可能でしょうか?

複雑な形状のオブジェクトに対してCullOffを適応するとアーティファクトが発生することがある

確認環境

  • Windows10 1809
  • Unity 2017.4.15f
  • UTS 2.7.0.1

「リリース」からダウンロードしたUnityChanToonShaderVer2_Project-v.2.0.7.1.zip内のプロジェクトを上記環境で開いて確認しています。

キャラクターへの影響の確認手順

  1. Assets/Sample Scenes/ToonShader.unity を開く
  2. ヒエラルキー内ToonShader_SD_unitychan_humanoid_Illust/Mesh_SD_unitychan/_body に利用されているマテリアル(Assets/Toon/Materials/ToonShader_Main)を開き、次のような変更を加える
    1. シェーダーをToon_DoubleSideWithFeatherからToon_ShadingGradeMap_TransClippingに変更する
    2. カリングモードをCullOffにする
    3. RimLightの LightDirectionMaskとAntipodeanRimlightをONにする

アーティファクトの発生が太腿のあたりで確認できます。
2019-04-05-21-24-47

最低限のマテリアル設定で再現させる手順

新しくマテリアルを作成し、次の設定を行っただけでも再現します。

  1. シェーダーをToon_ShadingGradeMap_TransClippingに変更する
  2. カリングモードをCullOffにする
  3. RimLightの LightDirectionMaskとAntipodeanRimlightをONにする
  4. (そのままだとわからないので)BaseColor、1stShadeColor、2ndShadeColorを暗い色にする

2019-04-05-21-29-52


  • 基本的にUTSのアウトライン用以外のバリエーションであればほぼ全てで上記のようなアーティファクトが見られます。
    • NoOutline/ToonColor_ShadingGradeMap_Transparentでは発生しませんでした。
  • 発生する箇所は、ポリゴンの辺上のみでした。
  • ある程度複雑なジオメトリのオブジェクトに対して発生する傾向があるように見えます。一応、Unityで追加できるSphereでも(ほんのほんのわずかですが)発生することが見られました。
  • あえて「TransparencyLevel」を0未満の値にしてみると、描画が表面と裏面が入り乱れた状態になります。
    • Level=0
      • 2019-04-05-22-01-50
    • Level=-0.1
      • 2019-04-05-22-02-29
    • 発生するアーティファクトの位置は必ずこの入り乱れている状態の境界に位置しているように見えます。
      • (入り乱れる状態が正常なのかどうかは私には区別が付きません)
  • もう少しTransparencyLevelを下げてみると、アルファチャンネルにも入り乱れている様子が確認できます。
    • Level=-0.5
      • 2019-04-05-22-05-01
  • 状況によっては、シーンビューコントロールバーのライティングボタンのON/OFFでアーティファクトが見えなかったり見えたりと様子が変わりました。

  • CullOffで裏面の色が正しく「塗りつぶされない」(厳密に言えば異なるかと思いますが)
    かつ
  • ApRimlightで明るい色を指定したときに目立つ

という状況なのではないかなと考えています。よくよく同じ場所を見てみると、ApRimLightがオフでも本来と異なる極細のラインが描画されていることがわかります。そもそもCullOffにしなければ発生していないように思われるので(特にUTSだとOutlineありならCullOffでも裏面は出てきますし)かなり限定的で重要性も高くない問題かと思いますが、よろしくおねがいします。

Clearify UTS2 Shader license in githubs terms with a LICENSE.md

The UTS2 Shader license needs clarification, and in licensing terms Github understands and accepts and independent of the Unity Chan Character. This legal uncertainty is interfering with legal protections to fork and modify the shader as is, and for what projects that go from FOSS or more restrictive.

pull request permission

Hello.

Does the dev branch have pull request permissions? I am attempting to pull request into it with a warning i do not have permission to push changes into the repository.

HDRP and LWRP support?

Any plan to support HDRP (High-Definition Rendering Pipeline) and LWRP (Lightweight Rendering Pipeline) in future updates?

bug fix, _Offset_Z support for vrchat mirrors

Currently, _Offset_Z it not correctly handled in vrchat mirrors.
Here is the fix, at:

float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - o.pos.xyz);

remove the normalize(), somehow the length between the camera position and vertex matters, i am not sure why this works. Here is the background how mirrors are implemented:
https://wiki.unity3d.com/index.php/MirrorReflection3
My poor guess is the mirror's camera position becomes the "mirror object" world position and that distance is used when the camera's world matrix fuses with the players world matrix into clip space.

What is the difference between Toon_DoubleShadeWithFeather and Toon_DoubleShadeWithFeather_Mobile?

Hi.
I am using unitychanToonShader well.
I have a question and ask a question.
What is the difference between Toon_DoubleShadeWithFeather and Toon_DoubleShadeWithFeather_Mobile?
I've tried using it, and both work the same.
Could someone please explain the specific difference?

Mobile has UsePass in the last line, but it is the same as Toon_DoubleShadeWithFeather.

Thanks for serving unitychan.

Shader error in 'Universal Render Pipeline/Toon': maximum ps_4_0 sampler register index (16) exceeded at Assets/ToonRendering/Toon(Universal)/Shaders/UniversalToonBody.cginc(109) (on d3d11)

Shader error in 'Universal Render Pipeline/Toon': maximum ps_4_0 sampler register index (16) exceeded at Assets/ToonRendering/Toon(Universal)/Shaders/UniversalToonBody.cginc(109) (on d3d11)

Compiling Fragment program with _METALLICSPECGLOSSMAP _OCCLUSIONMAP _MAIN_LIGHT_SHADOWS _NORMALMAP _ENVIRONMENTREFLECTIONS_OFF _EMISSIVE_SIMPLE _IS_TRANSCLIPPING_OFF _IS_ANGELRING_OFF _IS_PASS_FWDBASE _IS_CLIPPING_OFF
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING

Shader Sampler Exeption, when adding to Shader to Material (Model in description)

Hello,

when selecting 'Universal Render Pipeline/Toon' as shader for the attached model, I get the following exception in the Unity Console.
Hilde.zip

I'm using URP in my Project.

Shader error in 'Universal Render Pipeline/Toon': maximum ps_4_0 sampler 


register index (16) exceeded at Assets/ToonRendering/Toon(Universal)/Shaders/UniversalToonBody.cginc(109) (on d3d11)

Compiling Fragment program with _METALLICSPECGLOSSMAP _OCCLUSIONMAP _MAIN_LIGHT_SHADOWS _NORMALMAP _ENVIRONMENTREFLECTIONS_OFF _EMISSIVE_SIMPLE _IS_TRANSCLIPPING_OFF _IS_ANGELRING_OFF _IS_PASS_FWDBASE _IS_CLIPPING_OFF
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING

Specs are:
AMD Ryzen 2600X
GeForce RTX 2070
16 GB RAM
image
image

Greetings Orisin

Use UTS2 In Unity 2020 (URP 7.x ->10.x)

2.2.0 URP UTS2 will not be compiled in the latest unity (recently identified in 2020.2.1f1).

This seems to be a problem as the URP version changes from 7.x to 10.x.
It's been a long time since I haven't heard about update of UTS2,
so i share how to use UTS2 in Unity 2020.

This temporarily eliminates errors and allows for verification of operation,
but does not guarantee complete normal functionality.

Image below are modifications to the codes available in Unity 2020 (URP 10.x)

  1. UniversalToonBodyDoubleShadeWithFeather.hlsl
    2

  2. UniversalToonBody.hlsl
    1

  3. UniversalToonBodyShadingGradeMap.hlsl
    3

  4. UniversalToon.shader (This is not issue about URP 7.x -> 10.x. anyway.. there is corrected typo in enum syntex)
    4


이미지 364

It's a very ignorant method, but i'm able to use UTS2 in the UNITY 2020 versiont anyway.

I hope to hear the news about UTS2 continuously.

Transparent cutout doesn't properly work on Unity 2019

This shader, like many others, suffer problems with transparent cutout on Unity 2019.

UTSPROBLEM

In a model I use for an avatar, this is how it looks like in 2019, it is not supposed to look like that.

Maybe fix it before everything eventually migrates to Unity 2019 and later?

urp/master build error on android platform

there are errors when build ump/master on android platform.
like this:
Assets/Toon(Universal)/Editor/UniversalToonGUI.cs(12,37): error CS0246: The type or namespace name 'BaseShaderGUI' could not be found (are you missing a using directive or an assembly reference?)

URP用UTSシェーダー利用時、「Contribute Global Illumination」がオンになったオブジェクトが一つでも存在すると、invalid subscript 'vertexSH' が発生する

いつもは、Oculus Quest 2(Oculus Link、Windowsビルド)でUnityを使っております。
以下の記事のようにUTSを使わせて頂いていたのですが、10日ほど前にビルド時にエラーが発生していることに気づきました。
https://amaotolog.com/vr/63

検証のため、新規プロジェクトで試したところ、その際はエラーは発生しませんでした。

これまで作ってきたプロジェクト(1年ほど前に作成)の何かがおかしいと考え、新たなプロジェクトにすべてのアセットやスクリプトを移行することにしました。
その移行作業の途中で、「Contribute Global Illumination」にチェックが入ったオブジェクトが一つでも存在していると、エラーになることが分かり、今回の質問をさせて頂きました。

以下に、再現方法を記載しておりますので、ご確認いただけると幸いです。

■開発環境
・Unity 2019.4.15f1
・CPU:AMD Ryzen 7 3700X
・グラボ:ASUS ROG-STRIX-RTX2060S-O8G-GAMING
・UTS/UniversalToon Ver.2.2.0
[ビルド設定]
・ビルドのPlatform(PC,Mac & Linux Standalone)
・Scripting Backend:IL2CPP
・API Compatibility Level:.NET 4.x ※.NET Standard 2.0でも試しましたが結果は同じでした
[その他]
・「Other Settings -> Rendering -> Auto Graphics API for Windows」のチェックを外し、「Direct3D11」を明示的に指定したり、他の項目(VulkanやOpenGLES3などを選択してみましたが、結果は同じでした。

■検証1
(1) 新しいプロジェクトを「Universal Render Pipeline」で作成する。
(2) 「UnityChanToonShaderVer2_Project-urp-2.2.0」をインポートする。
(3) hierarchyで「Main Camera」と「Directional Light」を残し、サンプルの「Post-process Volume」と「Example Assets」は削除する。
(4) Materialを新規作成し、シェーダーをUTSに変更する。設定はそのまま。
(5) hierarchyでオブジェクト(Cube)を新規作成し、(4)のMaterialを設定する。
(6) CubeのInspectorで「Mesh Renderer -> Lighting -> Contribute Global Illumination」にチェックを入れる。
(7) 「Lighting」タブで、「Auto Generate」にチェックが入っているため、自動的に「Generate Lighting」が実行される。
 ※手動で実行してもエラーは発生しました。

 すると、UTSでエラー発生する。

al010819

Shader error in 'Universal Render Pipeline/Toon': invalid subscript 'vertexSH' at /Unity/UnityChanToonShaderVer2_Project-urp-2.2.0/Runtime/Shaders/UniversalToonBodyDoubleShadeWithFeather.hlsl(41) (on d3d11)

Compiling Fragment program with LIGHTMAP_ON FOG_EXP2 _MAIN_LIGHT_SHADOWS _SHADOWS_SOFT _MAIN_LIGHT_SHADOWS_CASCADE _ENVIRONMENTREFLECTIONS_OFF _IS_PASS_FWDBASE _IS_TRANSCLIPPING_OFF _IS_ANGELRING_OFF _IS_CLIPPING_OFF _EMISSIVE_SIMPLE
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING

■検証2
(1) 検証1の(1)と同じ。
(2) 検証1の(2)と同じ。
(3) hierarchy内で「Post-process Volume」のみを削除する。
(4) 検証1の(4)と同じ。
(5) 検証1の(5)と同じ。
 この時、Cubeの「 Contribute Global Illumination」はチェックなしです。
(6) 「Lighting」タブで、「Auto Generate」にチェックが入っているため、自動的に「Generate Lighting」が実行される。
 ※手動で実行してもエラーは発生しました。
(7) 「Build Settings -> Build」ボタンをクリックして、ビルドする。

 すると、UTSでエラーが発生する。
al010820

 Shader error in 'Universal Render Pipeline/Toon': invalid subscript 'vertexSH' at /Unity/UnityChanToonShaderVer2_Project-urp-2.2.0/Runtime/Shaders/UniversalToonBodyDoubleShadeWithFeather.hlsl(41) (on d3d11)

Compiling Fragment program with LIGHTMAP_ON FOG_EXP2 _MAIN_LIGHT_SHADOWS _SHADOWS_SOFT _MAIN_LIGHT_SHADOWS_CASCADE _ADDITIONAL_LIGHTS _ADDITIONAL_LIGHT_SHADOWS _ENVIRONMENTREFLECTIONS_OFF _IS_PASS_FWDBASE _IS_TRANSCLIPPING_OFF _IS_ANGELRING_OFF _IS_CLIPPING_OFF _EMISSIVE_SIMPLE
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING

[補足]
・サンプルアセットの「Example Assets -> Workshop Set -> Drywall Panel」などで、「 Contribute Global Illumination」のチェックが入っているようです。

■補足
・#62で「Invalid subscript 'vertexSH'」が投稿されておりますが、状況が異なる可能性を考え、新たに投稿させて頂きました。
・シェーダーでReimportするとエラーは無くなりますが、ビルドするとエラーが再発します。
・「Oculus Integration」アセットなどが影響していると思いましたが、インポートしていない状態でも発生しました。(今回の検証内容)
・最終目的はVR環境(※)で使う事が目的ですが、現象切り分けのため、今回の検証内容とさせて頂きました。
 ※「Virtual Reality Supported(非推奨設定)」か「XR Plug-in Management(+Oculus)」
・UTSエラーが発生した場合でも、Unityエディター上では正しく表示されているようです。ただ、ビルド時にエラーとなるため、exe起動した際には正しく動作しませんでした。
・今回のエラーが発生した「いつも使っているUnityプロジェクト」では、自分で作成したキャラクターでは「Contribute Global Illumination」はチェックオフですが、Terrainや購入した建物アセットでは「Contribute Global Illumination」のチェックがオンとなっておりました。

UniversalRP:Render Queue config get reset when revered to Custom UI

・Show All Propertiesで設定したRender Queueの設定(Emerald:Transparent / Emerald_Inside:Geometry)が、Custom UIに戻すとおそらく初期値にリセットされてしまう(Emerald:AlphaTest / Emerald_Inside:AlphaTest)。 ⇒結果、カスタムレンダーキューの値が保持できない

impliment full light passes for outlines

As of seeing commit 94ac5ad The outline do not yet have full forward pass light support as the outlines do not have delta passes or support for shadows. As you can guess this creates a miss-match in lighting when outlines are paired with the base toon passes.

I have done a full example of how to implement outlines with delta pass & shadows in my fork https://github.com/ACIIL/UnityChanToonShaderVer2_Project if you need reference. From my experience thankfully the code rewrite is much simpler than working on DoubleShadeWithFeather but i will take time revising all the shader passes parameters again.

Also take note of reordering the outlines passes after the main toon shader passes, as this will prevent fragment overdraw by the depth test. I am not certain if the pass reordering is good for the transparent shaders.

Confirmation of the difference between the answer of issues 58 and the content of the Release log

The answer to "#58"
indicates that neither HDRP nor URP has been officially published.
(on 2020.10.20)

However, the latest release log for "https://github.com/unity3d-jp/UnityChanToonShaderVer2_Project/releases/tag/urp-2.2.0" specifies the official launch of the URP.
(on 2020.07.28)

  1. Is the official release of the URP correct? (2.2.0)
  2. Can you tell me what's going on with HDRP (a rough release plan)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.