NormalMap

This commit is contained in:
ousttrue 2025-02-27 20:50:12 +09:00
parent 6a92f38064
commit 98a16e81a9
3 changed files with 88 additions and 52 deletions

View File

@ -1040,10 +1040,10 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -240.6666717529297,
"y": -167.99998474121095,
"width": 148.6666717529297,
"height": 36.0
"x": -250.0,
"y": -129.3333740234375,
"width": 148.6666259765625,
"height": 35.99998474121094
}
},
"m_Slots": [
@ -1251,9 +1251,9 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 41.33331298828125,
"y": -774.6666870117188,
"width": 129.33340454101563,
"x": 29.33331871032715,
"y": -714.666748046875,
"width": 129.33334350585938,
"height": 126.66668701171875
}
},
@ -1564,10 +1564,10 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -30.666671752929689,
"y": -480.6666259765625,
"width": 184.66668701171876,
"height": 254.66665649414063
"x": -42.66670608520508,
"y": -420.66668701171877,
"width": 184.66665649414063,
"height": 254.6667022705078
}
},
"m_Slots": [
@ -1682,10 +1682,10 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 191.83334350585938,
"y": -719.625,
"width": 209.33334350585938,
"height": 304.0
"x": 180.0,
"y": -660.0,
"width": 209.33328247070313,
"height": 303.99993896484377
}
},
"m_Slots": [
@ -1976,10 +1976,10 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -16.666717529296876,
"y": -131.99996948242188,
"width": 184.66671752929688,
"height": 254.6666717529297
"x": -26.000001907348634,
"y": -93.33338928222656,
"width": 184.66665649414063,
"height": 254.66668701171876
}
},
"m_Slots": [
@ -2088,10 +2088,10 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 445.9999694824219,
"y": -225.99998474121095,
"x": 443.3333435058594,
"y": -192.66668701171876,
"width": 209.33328247070313,
"height": 328.0000305175781
"height": 327.99993896484377
}
},
"m_Slots": [
@ -2224,10 +2224,10 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 189.33331298828126,
"y": -207.33331298828126,
"width": 209.33331298828126,
"height": 304.0
"x": 180.0,
"y": -168.6667022705078,
"width": 209.33328247070313,
"height": 303.99993896484377
}
},
"m_Slots": [
@ -2437,9 +2437,9 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -113.33329010009766,
"y": -795.3333740234375,
"width": 120.66663360595703,
"x": -125.33336639404297,
"y": -735.3333740234375,
"width": 120.66670989990235,
"height": 150.66668701171876
}
},
@ -2499,10 +2499,10 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -277.33331298828127,
"y": -756.0,
"width": 132.00001525878907,
"height": 36.0
"x": -289.3334045410156,
"y": -696.0000610351563,
"width": 132.00006103515626,
"height": 36.00006103515625
}
},
"m_Slots": [
@ -2583,10 +2583,10 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -240.6666717529297,
"y": -119.9999771118164,
"width": 178.0,
"height": 35.999969482421878
"x": -250.0,
"y": -81.3333969116211,
"width": 177.9999542236328,
"height": 35.99997329711914
}
},
"m_Slots": [
@ -2631,6 +2631,29 @@
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "da1f526e56c749649fdde4460e6ab70e",
"m_Id": 3,
"m_DisplayName": "Normal",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Normal",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SamplerStateMaterialSlot",
@ -2791,10 +2814,10 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 714.6666870117188,
"y": -428.6665954589844,
"width": 110.00006103515625,
"height": 102.6666259765625
"x": 724.0000610351563,
"y": -192.66668701171876,
"width": 110.0,
"height": 126.66663360595703
}
},
"m_Slots": [
@ -2803,6 +2826,9 @@
},
{
"m_Id": "eb34d529e298407aa3606f9cbcdc7819"
},
{
"m_Id": "da1f526e56c749649fdde4460e6ab70e"
}
],
"synonyms": [],
@ -2932,9 +2958,9 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -278.6666259765625,
"y": -451.9999694824219,
"width": 133.33328247070313,
"x": -290.66668701171877,
"y": -392.00006103515627,
"width": 133.33334350585938,
"height": 36.0
}
},
@ -2983,10 +3009,10 @@
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 271.3333435058594,
"y": -402.6666259765625,
"x": 259.33331298828127,
"y": -342.6666564941406,
"width": 127.33328247070313,
"height": 120.00003051757813
"height": 119.99992370605469
}
},
"m_Slots": [

View File

@ -55,9 +55,7 @@ namespace UniVRM10.VRM10Viewer
ImportSurfaceSettings(src, context);
await ImportBaseShadeColorAsync(data, src, mtoon, context, getTextureAsync, awaitCaller);
// await ImportMetallicRoughnessAsync(data, src, context, getTextureAsync, awaitCaller);
// await ImportOcclusionAsync(data, src, context, getTextureAsync, awaitCaller);
// await ImportNormalAsync(data, src, context, getTextureAsync, awaitCaller);
await ImportNormalAsync(data, src, context, getTextureAsync, awaitCaller);
// await ImportEmissionAsync(data, src, context, getTextureAsync, awaitCaller);
// context.Validate();
@ -112,5 +110,17 @@ namespace UniVRM10.VRM10Viewer
}
}
}
private static async Task ImportNormalAsync(GltfData data, glTFMaterial src, TinyMToonMaterialContext context, GetTextureAsyncFunc getTextureAsync, IAwaitCaller awaitCaller)
{
if (src.normalTexture is { index: >= 0 })
{
if (GltfPbrTextureImporter.TryNormalTexture(data, src, out _, out var desc))
{
context.BumpMap = await getTextureAsync(desc, awaitCaller);
context.BumpScale = src.normalTexture.scale;
}
}
}
}
}

View File

@ -37,8 +37,8 @@ namespace UniVRM10.VRM10Viewer
if (_urpMaterialForGrayscale != null)
{
var m = Instantiate(_urpMaterialForGrayscale);
// m.SetFloat("_Metallic", 0);
// m.SetFloat("_Roughness", 1);
m.SetFloat("_Metallic", 0);
m.SetFloat("_Roughness", 1);
visual.GetComponent<Renderer>().material = m;
}
}