Closed vegmuffin closed 5 months ago
Thanks for your feedback! We will adopt features of Unity, not just UTS, depending on the severity and number of requests. We currently receive few requests for this feature, but if we receive a large number of same requests, we will consider implementing this. Therefore, we will leave this issue here.
Hi, I'd also like the ability to tile textures on the toon shader.
+1 Would be nice for those values to be public.
You can do this via Debug Inspector and we have been doing it that way for the entirety of our current project.
@H3idi-X There seems to be a lot of requests for it, so I will try to implement it, but there is one problem. I have one problem: I think it would work if I add the following line, but I don't think it would be that cool from a GUI point of view. I would appreciate your feedback.
In UTS3GUI.cs
void GUI_BasicThreeColors(Material material)
{
m_MaterialEditor.TexturePropertySingleLine(Styles.baseColorText, mainTex, baseColor);
//v.2.0.7 Synchronize _Color to _BaseColor.
if (material.HasProperty("_Color"))
{
material.SetColor("_Color", material.GetColor("_BaseColor"));
}
//
EditorGUI.indentLevel += 2;
++ m_MaterialEditor.TextureScaleOffsetProperty(mainTex);
var applyTo1st = GUI_Toggle(material, Styles.applyTo1stShademapText, ShaderPropUse_BaseAs1st, MaterialGetInt(material, ShaderPropUse_BaseAs1st) != 0);
EditorGUI.indentLevel -= 2;
I think it looks perfectly fine!
Understood. It would not be ideal to have you use Debug Inspector to deal with the situation. We can't use much time right now, but I will consider the solution.
@Hum9183, I started implementing your fix, which is essentially correct. However, we need to apply the property to both the 1st and 2nd shading maps. I believe using one sampler for the Base, 1st shading map, and 2nd shading map textures would be a good approach. Implementing this across all the render pipeline shaders will take some time.
Some are done, but some look not working. we are on investigation now.
one sampler for the Base, 1st shading map, and 2nd shading map textures would be a good approach
@H3idi-X
That is a good idea!
If Tilling&Offset is to be shared between BaseMap, 1stShading and 2ndShading, it would be quicker to set _MainTex
as the texture to be passed to TRANSFORM_TEX
macro as shown below.
-- SAMPLE_TEXTURE2D(texture2d, sampler, TRANSFORM_TEX(uv, _1st_ShadeMap))
++ SAMPLE_TEXTURE2D(texture2d, sampler, TRANSFORM_TEX(uv, _MainTex))
I think the actual UTS can handle this by doing the following
In UniversalToonBodyDoubleShadeWithFeather.hlsl (line 142)
#ifdef _IS_PASS_FWDBASE
float3 Set_LightColor = lightColor.rgb;
float3 Set_BaseColor = lerp( (_BaseColor.rgb*_MainTex_var.rgb), ((_BaseColor.rgb*_MainTex_var.rgb)*Set_LightColor), _Is_LightColor_Base );
//v.2.0.5
-- float4 _1st_ShadeMap_var = lerp(SAMPLE_TEXTURE2D(_1st_ShadeMap,sampler_MainTex, TRANSFORM_TEX(Set_UV0, _1st_ShadeMap)),_MainTex_var,_Use_BaseAs1st);
++ float4 _1st_ShadeMap_var = lerp(SAMPLE_TEXTURE2D(_1st_ShadeMap,sampler_MainTex, TRANSFORM_TEX(Set_UV0, _MainTex)),_MainTex_var,_Use_BaseAs1st);
float3 Set_1st_ShadeColor = lerp( (_1st_ShadeColor.rgb*_1st_ShadeMap_var.rgb), ((_1st_ShadeColor.rgb*_1st_ShadeMap_var.rgb)*Set_LightColor), _Is_LightColor_1st_Shade );
//v.2.0.5
-- float4 _2nd_ShadeMap_var = lerp(SAMPLE_TEXTURE2D(_2nd_ShadeMap, sampler_MainTex, TRANSFORM_TEX(Set_UV0, _2nd_ShadeMap)),_1st_ShadeMap_var,_Use_1stAs2nd);
++ float4 _2nd_ShadeMap_var = lerp(SAMPLE_TEXTURE2D(_2nd_ShadeMap, sampler_MainTex, TRANSFORM_TEX(Set_UV0, _MainTex)),_1st_ShadeMap_var,_Use_1stAs2nd);
float3 Set_2nd_ShadeColor = lerp( (_2nd_ShadeColor.rgb*_2nd_ShadeMap_var.rgb), ((_2nd_ShadeColor.rgb*_2nd_ShadeMap_var.rgb)*Set_LightColor), _Is_LightColor_2nd_Shade );
float _HalfLambert_var = 0.5*dot(lerp( i.normalDir, normalDirection, _Is_NormalMapToBase ),lightDirection)+0.5;
Oh, sorry for the confusion. What I wanted to discuss was the lines where we use TRANSFORM_TEX. Thank you for the correction and suggestions.
@H3idi-X
Let's see...
Am I right in saying that I want to keep the UVs of the _MainTex
in a variable and use them in the 1stShading and 2ndShading calculations?
My apologies if I misunderstood.
float2 mainTexUV = TRANSFORM_TEX(Set_UV0, _MainTex);
float4 _1st_ShadeMap_var = SAMPLE_TEXTURE2D(_1st_ShadeMap, sampler_MainTex, mainTexUV);
float4 _2nd_ShadeMap_var= SAMPLE_TEXTURE2D(_2nd_ShadeMap, sampler_MainTex, mainTexUV);
We adopted the formor ones for the fix. We are testing the shaders with graphics test systems.
merged to the main branch.
Hi, we released toon shader 0.9.7-preview this morning. Will you guys please try that one?
Hey @H3idi-X! Thanks for the update! It works and looks good but I've noticed two issues:
Unity URP 2022.3.16f1
Thanks for checking! We will take a look at the two issues above.
@H3idi-X There seems to be a lot of requests for it, so I will try to implement it, but there is one problem. I have one problem: I think it would work if I add the following line, but I don't think it would be that cool from a GUI point of view. I would appreciate your feedback.
In UTS3GUI.cs
void GUI_BasicThreeColors(Material material) { m_MaterialEditor.TexturePropertySingleLine(Styles.baseColorText, mainTex, baseColor); //v.2.0.7 Synchronize _Color to _BaseColor. if (material.HasProperty("_Color")) { material.SetColor("_Color", material.GetColor("_BaseColor")); } // EditorGUI.indentLevel += 2; ++ m_MaterialEditor.TextureScaleOffsetProperty(mainTex); var applyTo1st = GUI_Toggle(material, Styles.applyTo1stShademapText, ShaderPropUse_BaseAs1st, MaterialGetInt(material, ShaderPropUse_BaseAs1st) != 0); EditorGUI.indentLevel -= 2;
Hello, can we create a solution to add uvs functionality, for example, change the uv base color between uv0 and uv1 by changing the script in the shader?
Hi, we have applied fixes for the second of the following issues to task/clippingMaskSampler branch. Could @Hum9183 and @Fabrazz try the branch if it doesn’t make too much trouble?
Fixing the first is difficult due to the design of the Unity Editor for now.
- If you change the tiling value and undo, it doesn't update the values in the component to the previous ones until you deselect & reselect the material.
- Clipping Masks should also take that tiling into account otherwise they don't work.
@H3idi-X That sounds great! In addition, it may be a good idea to synchronize the ClippingMask of the outline
In UniversalToonOutlime.hlsl (lines 96-98)
#elif _IS_OUTLINE_CLIPPING_YES
- float4 _ClippingMask_var = SAMPLE_TEXTURE2D(_ClippingMask, sampler_MainTex, TRANSFORM_TEX(Set_UV0, _ClippingMask));
+ float4 _ClippingMask_var = SAMPLE_TEXTURE2D(_ClippingMask, sampler_MainTex, TRANSFORM_TEX(Set_UV0, _MainTex));
float Set_MainTexAlpha = _MainTex_var.a;
Good point! We fix that. Thank you!
@Hum9183 We applied your suggestion and did the same to the oehter RP shaders to the branch.
@H3idi-X
- If you change the tiling value and undo, it doesn't update the values in the component to the previous ones until you deselect & reselect the material.
I have a simple idea to solve this problem. May I make a PR?
Thanks for the suggestion. As long as it doesn't affect edtior peformance,the PR would be welcome. PR to task/clippingMaskSampler branch is ideal.
Hi, we measured time cunsumed in FindProperties(props). It is negligible. We maerged PR by @Hum9183 and started our internal tests.
All the tests passed and the branch is merged into the main branch.
Hi, we released 0.10.0-preview that we applied the undo/redo fix by @Hum9183.
Can confirm on my end, works as intended now! Thanks!
Describe the bug The base diffuse map for the toon material is missing tiling & offset parameters, while Normal, MatCap and Emission maps have this control.
To Reproduce Steps to reproduce the behavior:
Toon
shaderThree Color and Control Map Settings
Expected behavior The Base Map and other shading maps should have tiling & offset controls.
Desktop (please complete the following information):
Additional context I don't know if this is how it should be, but it definitely is not ideal to not have tiling & offset controls, I want to be able to tile textures. :(