めくるめくシェーダーアートの世界/The World of Dazzling Shader Art

56ffef8ea4a48c8560b825f7f14ef4a9?s=47 ta_ka_tsu
September 06, 2019

めくるめくシェーダーアートの世界/The World of Dazzling Shader Art

iOSDC2019

56ffef8ea4a48c8560b825f7f14ef4a9?s=128

ta_ka_tsu

September 06, 2019
Tweet

Transcript

  1. Ί͘ΔΊ͘ γΣʔμΞʔτͷ iOSDC Japan 2019 ੈք

  2. !UB@LB@UTV ذෞݝࡏॅ ࣗݾ঺հ %$"%ܥϓϩάϥϚʔ %$".ܥϓϩάϥϚʔ ϑϦʔϥϯεˡ/PX ձࣾઃཱ

  3. ࣗݾ঺հ ࠷ۙϋϚ͍ͬͯΔ͜ͱ

  4. ࣗݾ঺հ࠷ۙϋϚ͍ͬͯΔ͜ͱ ੡మ

  5. ࣗݾ঺հ࠷ۙϋϚ͍ͬͯΔ͜ͱ ࡐྉɿ ࠭మɾ໦୸

  6. ࣗݾ঺հ࠷ۙϋϚ͍ͬͯΔ͜ͱ ࡞Γํɿ ଱೤ϒϩοΫͰ࡞ͬͨ ࿍ͷதͰઈ͑ͣ෩Λૹ Γଓ͚ͳ͕Β໦୸Λ೩ ΍͠ɺҰఆ͓͖࣌ؒʹ ࠭మɾ໦୸Λަޓʹ౤ ೖͯ͠਺࣌ؒૢۀ

  7. ࣗݾ঺հ࠷ۙϋϚ͍ͬͯΔ͜ͱ

  8. ࣗݾ঺հ࠷ۙϋϚ͍ͬͯΔ͜ͱ ݪཧɿ $ 0ˠ$0 'F0ʴ$0ˠ'F $0 ໦୸Λ೩΍ͯ͠ൃੜ͢ΔҰࢎԽ୸ૉ͕ ࠭మ ࢎԽమ Λؐݩ͢Δ͜ͱͰమʹͳΔɻ

    ຊདྷమͷ༥఺͸ˆ͕ͩɺ໦୸ʹ઀͠ ͍ͯΔˍෆ७෺ΛؚΉ͜ͱʹΑΓڽݻ఺ ߱Լ͕ى͜ΓɺΑΓ௿͍Թ౓Ͱ༹༥͠࿍ ͷఈͰమմͱͳΔɻ
  9. ࣗݾ঺հ࠷ۙϋϚ͍ͬͯΔ͜ͱ

  10. ࣗݾ঺հ࠷ۙϋϚ͍ͬͯΔ͜ͱ ݱࡏɿ మͷ୸ૉྔͷௐ੔ʹ௅ઓத ˞ৄ͍͠ਓ͕͍ͨΒ ͥͻΞυ όΠεԼ͍͞

  11. ࣗݾ঺հ࠷ۙϋϚ͍ͬͯΔ͜ͱ ࢀߟจݙɿ ɾӬా࿨޺ɹ  ɹΠν͔Β࡞Δమ ೶ࢁړଜจԽڠձ ɾӬా࿨޺ɹ  ɹਓ͸ͲͷΑ͏ʹమΛ࡞͖͔ͬͯͨ ߨஊࣾ

    ɾڥɹஐ༸ɹϨϯΨࣜͨͨΒ੡మ࿍ʹΑΔమͮ͘Γ IUUQXXXUPSBZTGPSKQBDUJWJUZTDJFODF@FEVQEGI@QEG ɾᜊ౻౒ɾࡔຊູɾߴ௩ल࣏ɹ౛ঊ͕ܧঝ͢Δ఻౷ٕज़ͷࣗવՊ ֶతௐࠪ IUUQTXXXSFLJIBLVBDKQPVUMJOFQVCMJDBUJPOSPOCVOSPOCVOQEG QEG
  12. None
  13. γΣʔμ ʔΞʔτͱ͸ʁ

  14. %&.0

  15. γΣʔμ ʔΞʔτͱ͸ʁ 4IBEFSUPZ IUUQTXXXTIBEFSUPZDPN

  16. (-4-4BOECPY IUUQHMTMTBOECPYDPN γΣʔμ ʔΞʔτͱ͸ʁ

  17. 2ԿΛ΍͍ͬͯΔͷ͔ʁ γΣʔμ ʔΞʔτͱ͸ʁ

  18. "γΣʔμ ʔΛར༻ͯ͠ ֆΛඳ͍͍ͯΔ γΣʔμ ʔΞʔτͱ͸ʁ

  19. γΣʔμ ʔͱ͸ʁ

  20. ࣍ݩίϯϐϡʔλάϥϑΟοΫεʹ͓͍ͯɺ γΣʔσΟϯάʢӄӨॲཧʣΛߦ͏ίϯϐϡʔλ ϓϩάϥϜͷ͜ͱɻʮTIBEFʯͱ͸ʮ࣍ୈʹมԽ ͤ͞ΔʯʮӄӨɾάϥσʔγϣϯΛ෇͚Δʯͱ͍ ͏ҙຯͰɺʮTIBEFSʯ͸௖఺৭΍ϐΫηϧ৭ͳ ͲΛ࣍ʑʹมԽͤ͞Δ΋ͷʢΑΓ۩ମతʹɺڱٛ ͷҙຯͰݴ͑͹ؔ਺ʣΛҙຯ͢Δɻ 4IBEFS IUUQTKBXJLJQFEJBPSHXJLJγΣʔμʔ γΣʔμ

    ʔͱ͸ʁ
  21. ࣍ݩ$(ͷඳըͷ࢓૊Έ ௒؆қ൛ ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ γΣʔμ ʔͱ͸ʁ

  22. ࣍ݩ$(ͷඳըͷ࢓૊Έ ௒؆қ൛ ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ ϨϯμϦϯά ύΠϓϥΠϯ γΣʔμ

    ʔͱ͸ʁ
  23. ࣍ݩ$(ͷඳըͷ࢓૊Έ ௒؆қ൛ ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ γΣʔμ ʔͱ͸ʁ

  24. ࣍ݩ$(ͷඳըͷ࢓૊Έ ௒؆қ൛ ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ γΣʔμ ʔͱ͸ʁ

  25. ࣍ݩ$(ͷඳըͷ࢓૊Έ ௒؆қ൛ ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ γΣʔμ ʔͱ͸ʁ

  26. γΣʔμ ʔͱ͸ʁ

  27. γΣʔμ ʔͱ͸ʁ

  28. γΣʔμ ʔͱ͸ʁ

  29. γΣʔμ ʔͱ͸ʁ

  30. ৄ͘͠͸ͪ͜Β IUUQTTQFBLFSEFDLDPNUBLBUTV[VPUVUFXBLBSVSFOEBSJOHVQBJQVSBJO DQVEFENJBPIVB γΣʔμ ʔͱ͸ʁ

  31. ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ γΣʔμ ʔͱ͸ʁ

  32. ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ ɾɾɾϓϩάϥϜهड़ ɾɾɾϓϩάϥϜهड़ ɾɾɾݻఆॲཧ γΣʔμ ʔͱ͸ʁ

  33. ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ ɾɾɾϓϩάϥϜهड़ ɾɾɾϓϩάϥϜهड़ ௖఺γΣʔμ ʔ ϑϥά

    ϝϯτγΣʔμ ʔ γΣʔμ ʔͱ͸ʁ
  34. γΣʔμ ʔΞʔτͷ ࢓૊Έ

  35. γΣʔμ ʔΞʔτͷ࢓૊Έ ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ ͭͷ఺Ͱ ࡾ֯ܗΛͭඳը 

          
  36. γΣʔμ ʔΞʔτͷ࢓૊Έ ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾

  37. γΣʔμ ʔΞʔτͷ࢓૊Έ ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾

  38. ʮϐΫηϧ࠲ඪΛೖྗͱͯ͠৭Λग़ྗ͢Δؔ਺ʯ ͦͷؔ਺͕શϐΫηϧʹద༻͞Εͯը૾͕Ͱ͖Δ ຊ࣭తʹ͸͜Ε͚ͩɻ γΣʔμ ʔΞʔτͷ࢓૊Έ

  39. J04Ͱͷ࡞Γํ

  40. J04Ͱͷ࡞Γํ ͓ͦΒ͘ํ๏͸ͭ %"1*ɿ8FC(- ඳըઌɿ8,8FC7JFX γΣʔμ ʔݴޠɿ(-4- %"1*ɿ.FUBM ඳըઌɿ$".FUBM-BZFS γΣʔμ ʔݴޠɿ.4-

    %"1*ɿ0QFO(-&4 ඳըઌɿ$"&"(--BZFS γΣʔμ ʔݴޠɿ(-4- EFQSFDBUFE!
  41. J04Ͱͷ࡞Γํ ະݕূ %"1*ɿ8FC(- ඳըઌɿ8,8FC7JFX γΣʔμ ʔݴޠɿ(-4- %"1*ɿ.FUBM ඳըઌɿ$".FUBM-BZFS γΣʔμ ʔݴޠɿ.4-

  42. J04Ͱͷ࡞Γํ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPONFUBM VTJOH@B@SFOEFS@QJQFMJOF@UP@SFOEFS@QSJNJUJWFT ࢀߟɿ6TJOHB3FOEFS1JQFMJOFUP3FOEFS1SJNJUJWFT ࡾ֯ܗΛͭඳ͚ͩ͘ͳͷͰ ϑϥά ϝϯτγΣʔμ ʔҎ֎͸ׂѪ

  43. ࣮ફ.4-

  44. جຊฤ

  45. جຊฤ

  46. جຊฤ #include <metal_stdlib> using namespace metal; fragment float4 Basic1(float4 pixPos

    [[position]]) { return float4(1.0, 0.0, 0.0, 1.0); }
  47. جຊฤ

  48. #include <metal_stdlib> using namespace metal; fragment float4 Basic1(float4 pixPos [[position]])

    { return float4(1.0, 0.0, 0.0, 1.0); } ૊ΈࠐΈؔ਺ͷΠϯΫϧʔυ جຊฤ
  49. #include <metal_stdlib> using namespace metal; fragment float4 Basic1(float4 pixPos [[position]])

    { return float4(1.0, 0.0, 0.0, 1.0); } ໊લۭؒNFUBMΛ࢖͏ͱ͍͏એݴ جຊฤ
  50. #include <metal_stdlib> using namespace metal; fragment float4 Basic1(float4 pixPos [[position]])

    { return float4(1.0, 0.0, 0.0, 1.0); } ϑϥά ϝϯτγΣʔμ ʔ༻ͷؔ਺Ͱ͋Δͱ͍͏ؔ਺ଐੑ جຊฤ
  51. #include <metal_stdlib> using namespace metal; fragment float4 Basic1(float4 pixPos [[position]])

    { return float4(1.0, 0.0, 0.0, 1.0); } ϥελϥΠβ͔Β౉͞ΕΔϐΫηϧ࠲ඪͰ͋Δ͜ͱΛࣔ͢ Ҿ਺ଐੑ جຊฤ
  52. #include <metal_stdlib> using namespace metal; fragment float4 Basic1(float4 pixPos [[position]])

    { return float4(1.0, 0.0, 0.0, 1.0); } ೖྗͱͳΔϐΫηϧ࠲ඪΛ֨ೲ͢Δม਺ جຊฤ
  53. #include <metal_stdlib> using namespace metal; fragment float4 Basic1(float4 pixPos [[position]])

    { return float4(1.0, 0.0, 0.0, 1.0); } ϑϥά ϝϯτγΣʔμ ʔͷؔ਺໊ جຊฤ
  54. let library = device.makeDefaultLibrary() let fragmentFunction = library.makeFunction(name:”Basic1”) . .

    . let pipelineDescriptor = MTLRenderPipelineDescriptor() pipelineDescriptor.fragmentFunction = fragmentFunction . . . $16ଆͰؔ਺໊͔Β.5-'VODUJPOΛऔಘ͠ ύΠϓϥΠϯͷϑϥά ϝϯτγΣʔμ ʔͱͯ͠ઃఆ͓ͯ͘͠ جຊฤ
  55. #include <metal_stdlib> using namespace metal; fragment float4 Basic1(float4 pixPos [[position]])

    { return float4(1.0, 0.0, 0.0, 1.0); } 3 ( # Ћ جຊฤ
  56. float bool int char short uchar uint ushort half size_t

    ptrdiff_t void ˞MPOHVOTJHOFEMPOH͸.FUBMҎ߱Ͱαϙʔτ ˞EPVCMFMPOHMPOHVOTJHOFEMPOHMPOHMPOHEPVCMF͸ະαϙʔτ جຊฤ .4-ͷεΧϥʔܕ
  57. float2 float3 float4 bool2 bool3 bool4 int2 int3 int4 char2

    char3 char4 short2 short3 short4 uchar2 uchar3 uchar4 uint2 uint3 uint4 ushort2 ushort3 ushort4 half2 half3 half4 جຊฤ .4-ͷϕΫτϧܕ
  58. .4-ͷϕΫτϧܕ֤ίϯϙʔωϯτ΁ͷΞΫηε float4 vec(1.0, 2.0, 3.0, 4.0); float a = vec.x;

    // 1.0 float b = vec.y; // 2.0 float c = vec.z; // 3.0 float d = vec.w; // 4.0 float e = vec.r; // 1.0 float f = vec.g; // 2.0 float g = vec.b; // 3.0 float h = vec.a; // 4.0 vec.x = 3.0; // (3.0, 2.0, 3.0, 4.0) float i = vec.r; // 3.0 جຊฤ
  59. float4 vec1(4.0, 4.0, 4.0, 4.0); float4 vec2(1.0, 2.0, 4.0, 8.0);

    float4 v1 = vec1 + vec2; // (5.0, 6.0, 8.0, 12.0) float4 v2 = vec1 - vec2; // (3.0, 2.0, 0.0, -4.0) float4 v3 = vec1 * vec2; // (4.0, 8.0, 16.0, 32.0) float4 v4 = vec1 / vec2; // (4.0, 2.0, 1.0, 0.5) .4-ͷϕΫτϧܕՃݮ৐আ جຊฤ
  60. float4 vec(1.0, 2.0, 3.0, 4.0); float4 v1 = vec +

    2.0; // (3.0, 4.0, 5.0, 6.0) float4 v2 = vec - 2.0; // (-1.0, 0.0, 1.0, 2.0) float4 v3 = vec * 2.0; // (2.0, 4.0, 6.0, 8.0) float4 v4 = vec / 2.0; // (0.5, 1.0, 1.5, 2.0) vec = 1.0; // (1.0, 1.0, 1.0, 1.0) .4-ͷϕΫτϧܕεΧϥʔܕͱͷՃݮ৐আ جຊฤ
  61. half2x2 half2x3 half2x4 float2x2 float2x3 float2x4 half3x2 half3x3 half3x4 half4x2

    half4x3 half4x4 float3x2 float3x3 float3x4 float4x2 float4x3 float4x4 .4-ͷߦྻܕ ໊લۭؒNFUBM಺ جຊฤ
  62. return float4(1.0, 0.0, 0.0, 1.0); શͯͷϐΫηϧΛ੺ʹ͢Δ جຊฤ

  63. fragment float4 Basic2(float4 pixPos [[position]]) { return clamp(length(pixPos.xy)/300.0, 0.0, 1.0);

    } جຊฤ
  64. جຊฤ

  65. fragment float4 Basic2(float4 pixPos [[position]]) { return clamp(length(pixPos.xy)/300.0, 0.0, 1.0);

    } جຊฤ ͜Ε͸Կʁ
  66. .4-ͷϕΫτϧܕ4XJ[[MJOH float4 vec(1.0, 2.0, 3.0, 4.0); vec.xy; // (1.0, 2.0)

    vec.zwx; // (3.0, 4.0, 1.0) vec.xxxy; // (1.0, 1.0, 1.0, 2.0) vec.ra; // (1.0, 4.0) vec.rgb; // (1.0, 2.0, 3.0) vec.xyb; // compile error! vec.xy = float2(0.0, 1.0); // (0.0, 1.0, 3.0, 4.0) vec.xxy = float3(5.0, 4.0, 3.0); // compile error! جຊฤ
  67. fragment float4 Basic2(float4 pixPos [[position]]) { return clamp(length(pixPos.xy)/300.0, 0.0, 1.0);

    } MFOHUIؔ਺ جຊฤ
  68. MFOHUIؔ਺ ϕΫτϧYͷ௕͞Λฦ͢ float2 vec2d(3.0, 4.0); length(vec2d); // 5.0 float3 vec3d(1.0,

    1.0, 1.0); length(vec3d); // 1.732… P W MFOHUI W ؔ࿈ɿEJTUBODFؔ਺EJTUBODF Q Q MFOHUI QQ Ts length(T x) جຊฤ
  69. fragment float4 Basic2(float4 pixPos [[position]]) { return clamp(length(pixPos.xy)/300.0, 0.0, 1.0);

    } DMBNQؔ਺ جຊฤ
  70. DMBNQؔ਺ YΛNJO7ʙNBY7ͷൣғʹΫϥϯϓ͢Δ NJO7ʽNBY7 clamp(0.6, 0.0, 1.0); // 0.6 clamp(-0.3, 0.0,

    1.0); // 0.0 clamp(1.2, 0.0, 1.0); // 1.0 DMBNQ Y NJO7 NBY7 NJO NBY Y NJO7 NBY7 T clamp(T x, T minV, T maxV) جຊฤ
  71. 9 :   8JEUI   )FJHIU 8JEUI )FJHIU

    ϐΫηϧ࠲ඪܥ جຊฤ
  72.  ݪ఺ͱͷڑ཭ΛͰׂͬͨ΋ͷΛ໌Δ͞ͱ͍ͯ͠Δ return clamp(length(pixPos.xy)/300.0, 0.0, 1.0); جຊฤ

  73. fragment float4 Basic3(float4 pixPos [[position]]) { return step(300.0, length(pixPos.xy)); }

    جຊฤ
  74. جຊฤ

  75. fragment float4 Basic3(float4 pixPos [[position]]) { return step(300.0, length(pixPos.xy)); }

    TUFQؔ਺ جຊฤ
  76. TUFQؔ਺ Y͕FEHFҎ্ͷ৔߹ʹΛ ͦΕҎ֎ͷ৔߹͸Λฦؔ͢਺ step(0.5, 1.0); // 1.0 step(0.5, 0.3); //

    0.0 step(0.5, 0.5); // 1.0 TUFQ  Y ͷάϥϑ T step(T edge, T x) جຊฤ
  77. return step(300.0, length(pixPos.xy)); ݪ఺ͱͷڑ཭͕Ҏ্ͷՕॴ͕നɺະຬͷՕॴ͕ࠇ جຊฤ 

  78. fragment float4 Basic4(float4 pixPos [[position]]) { return smoothstep(300.0, 400.0, length(pixPos.xy));

    } جຊฤ
  79. جຊฤ

  80. fragment float4 Basic4(float4 pixPos [[position]]) { return smoothstep(300.0, 400.0, length(pixPos.xy));

    } TNPPUITUFQؔ਺ جຊฤ
  81. TNPPUITUFQؔ਺ Y͕FҎԼͷ৔߹͸ FҎ্ͷ৔߹͸Λฦ͢ɻ ͦͷؒͷ৔߹͸Τϧϛʔτิؒ ˞ ͨ݁͠ՌΛฦ͢ɻ FʻF smoothstep(0.5, 1.0, 1.2);

    // 1.0 smoothstep(0.5, 1.0, 0.2); // 0.0 smoothstep(0.5, 1.0, 0.6); // 0.104 smoothstep(0.5, 1.0, 0.9); // 0.896 T smoothstep(T e1, T e2, T x) ˞۠ؒ [e1 , e2 ] 3( x − e1 e2 − e1 )2 − 2( x − e1 e2 − e1 )3 ͷ x ʹରͯ͠͸ Λฦ͢ جຊฤ
  82. TNPPUITUFQ   Y ͷάϥϑ جຊฤ

  83.   return smoothstep(300.0, 400.0, length(pixPos.xy)); جຊฤ

  84. fragment float4 Basic5(float4 pixPos[[position]]) { float4 red(1.0, 0.0, 0.0, 1.0);

    float4 green(0.0, 1.0, 0.0, 1.0); float m1 = smoothstep(300.0, 400.0, length(pixPos.xy)); return mix(red, green, m1); } جຊฤ
  85. جຊฤ

  86. fragment float4 Basic5(float4 pixPos[[position]]) { float4 red(1.0, 0.0, 0.0, 1.0);

    float4 green(0.0, 1.0, 0.0, 1.0); float m1 = smoothstep(300.0, 400.0, length(pixPos.xy)); return mix(red, green, m1); } جຊฤ NJYؔ਺
  87. NJYؔ਺ YͱZͷؒΛBͰઢܗิؒ ˞ ͢Δؔ਺ ʽBʽ  mix(10.0, 20.0, 0.5); //

    15.0 mix(100.0, 50.0, 0.2); // 90.0 mix(10, -10.0, 0.6); // -2.0 T mix(T x, T y, T a) NJY   Y ͷάϥϑ جຊฤ
  88. fragment float4 Basic5(float4 pixPos[[position]]) { float4 red(1.0, 0.0, 0.0, 1.0);

    float4 green(0.0, 1.0, 0.0, 1.0); float m1 = smoothstep(300.0, 400.0, length(pixPos.xy)); return mix(red, green, m1); } جຊฤ
  89.   جຊฤ

  90. fragment float4 Basic5(float4 pixPos[[position]]) { float4 red(1.0, 0.0, 0.0, 1.0);

    float4 green(0.0, 1.0, 0.0, 1.0); float m1 = smoothstep(300.0, 400.0, length(pixPos.xy)); return mix(red, green, m1); } جຊฤ NJYؔ਺
  91. جຊฤ

  92. fragment float4 Basic6(float4 pixPos[[position]]) { float4 red(1.0, 0.0, 0.0, 1.0);

    float4 green(0.0, 1.0, 0.0, 1.0); float4 blue(0.0, 0.0, 1.0, 1.0); float m1 = smoothstep(300.0, 400.0, length(pixPos.xy)); float4 col = mix(red, green, m1); float m2 = step(500.0, length(pixPos.xy)); col = mix(col, blue, m2); return col; } جຊฤ
  93. جຊฤ  float m2 = step(500.0, length(pixPos.xy)); col = mix(col,

    blue, m2);
  94. جຊςΫχοΫ

  95. ਖ਼نԽ ࠲ඪม׵ͱ

  96. ࠲ඪม׵ͱਖ਼نԽ return step(300.0, length(pixPos.xy)); 

  97. return step(320.0, length(pixPos.xy - float2(568.0, 320.0)));   ˞J1IPOF4&ͷ৔߹ ࠲ඪม׵ͱਖ਼نԽ

  98. ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ όοϑΝ ڞ௨σʔλ γΣʔμ ʔʹ͸όοϑΝΛ௨ͯ͡ڞ௨σʔλΛ౉ͤΔ ࠲ඪม׵ͱਖ਼نԽ

  99. ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ όοϑΝ ը໘ղ૾౓ ղ૾౓Λ౉͢ ࠲ඪม׵ͱਖ਼نԽ

  100. // όοϑΝͷ࡞੒ resolutionBuffer = device.makeBuffer(length: 2 *ɹMemoryLayout<Float>.size, options: []) .

    . . // όοϑΝ΁ղ૾౓Λॻ͖ࠐΈ memcpy(resolutionBuffer.contents(), [width, height], 2 * MemoryLayout<Float>.size) . . . // ϑϥάϝϯτγΣʔμʔͷόοϑΝͱͯ͠ઃఆ renderEncoder.setFragmentBuffer(resolutionBuffer, offset: 0, index: 0) ࠲ඪม׵ͱਖ਼نԽ
  101. // όοϑΝͷ࡞੒ resolutionBuffer = device.makeBuffer(length: 2 *ɹMemoryLayout<Float>.size, options: []) .

    . . // όοϑΝ΁ղ૾౓Λॻ͖ࠐΈ memcpy(resolutionBuffer.contents(), [width, height], 2 * MemoryLayout<Float>.size) . . . // ϑϥάϝϯτγΣʔμʔͷόοϑΝͱͯ͠ઃఆ renderEncoder.setFragmentBuffer(resolutionBuffer, offset: 0, index: 0) ࠲ඪม׵ͱਖ਼نԽ
  102. fragment float4 Hogehoge(float4 pixPos [[position]], constant float2& res [[buffer(0)]]) {

    . . . } όοϑΝ͔Β౉͞ΕΔ஋Ͱ͋Δ͜ͱΛࣔ͢ Ҿ਺ଐੑ ࠲ඪม׵ͱਖ਼نԽ
  103. fragment float4 Hogehoge(float4 pixPos [[position]], constant float2& res [[buffer(0)]]) {

    . . . } όοϑΝ͔Β౉͞ΕΔ஋͸ ࢀরܕ͔ϙΠϯλܕͰड͚औΒͳ͚Ε͹ͳΒͳ͍ ࠲ඪม׵ͱਖ਼نԽ
  104. fragment float4 Hogehoge(float4 pixPos [[position]], constant float2& res [[buffer(0)]]) {

    . . . } .4-Ͱ͸ࢀরܕ΍ϙΠϯλܕʹ͸ ΞυϨεۭؒम০ࢠ͕ඞཁ ࠲ඪม׵ͱਖ਼نԽ
  105. fragment float4 CodSys1(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; return step(length(uv), 1.0); } ࠲ඪม׵ͱਖ਼نԽ
  106. ࠲ඪม׵ͱਖ਼نԽ

  107. fragment float4 CodSys1(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; return step(length(uv), 1.0); } ࠲ඪม׵ͱਖ਼نԽ
  108. 9   8JEUI   )FJHIU 8JEUI )FJHIU ϐΫηϧ࠲ඪܥ

    pixPos.xy : ࠲ඪม׵ͱਖ਼نԽ
  109.   8JEUI   )FJHIU 8JEUI )FJHIU ࠲ඪ஋Λഒ͢Δ 2.0

    * pixPos.xy ࠲ඪม׵ͱਖ਼نԽ  8JEUI  )FJHIU
  110.   8JEUI   )FJHIU 8JEUI )FJHIU 2.0 *

    pixPos.xy - res ղ૾౓ΛҾ͘ 8JEUI )FJHIU ࠲ඪม׵ͱਖ਼نԽ
  111.         (2.0 *

    pixPos.xy - res)/min(res.x, res.y) ղ૾౓ͷখ͍͞ํͰׂΔ   ࠲ඪม׵ͱਖ਼نԽ
  112.         float2 uv

    = (2.0 * pixPos.xy - res)/min(res.x, res.y) uv.y *= -1.0 :࠲ඪΛ൓సͤ͞Δ           ࠲ඪม׵ͱਖ਼نԽ
  113.          

            ࠲ඪม׵ͱਖ਼نԽ
  114. ৽͍͠࠲ඪ VW Ͱݪ఺த৺ɺ൒ܘͷԁ return step(length(uv), 1.0); ࠲ඪม׵ͱਖ਼نԽ

  115. ࠲ඪม׵ͷߟ͑ํͷίπ ɾ఺ͷม׵ͱݟΔ ɾ࠲ඪܥͷม׵ͱݟΔ ౳Ձͳͭͷࢹ఺Λ࣋ͭ͜ͱ ࠲ඪม׵ͱਖ਼نԽ

  116. ྫฏߦҠಈ ఺ͷม׵ͱͯ͠ͷࢹ఺ ࠲ඪܥͷม׵ͱͯ͠ͷࢹ఺ ⃗ t − ⃗ t ⃗ P

    + ⃗ t ࠲ඪม׵ͱਖ਼نԽ
  117. ྫճస ఺ͷม׵ͱͯ͠ͷࢹ఺ ࠲ඪܥͷม׵ͱͯ͠ͷࢹ఺ θ θ R(θ) ⃗ P ࠲ඪม׵ͱਖ਼نԽ

  118. ྫεέʔϦϯά ఺ͷม׵ͱͯ͠ͷࢹ఺ ࠲ඪܥͷม׵ͱͯ͠ͷࢹ఺ sഒ 1/sഒ s ⃗ P ࠲ඪม׵ͱਖ਼نԽ

  119. ɾ఺ͷม׵ͱݟΔ ɾ࠲ඪܥͷม׵ͱݟΔ ౳Ձͳͭͷࢹ఺Λ࣋ͭ͜ͱ ࠲ඪม׵ͷߟ͑ํͷίπ ࠲ඪม׵ͱਖ਼نԽ

  120. ۃ࠲ඪͷར༻

  121. ۃ࠲ඪͷར༻ ௚ަ࠲ඪදࣔ x y (x, y)

  122. θ r ۃ࠲ඪදࣔ (r, θ) ۃ࠲ඪͷར༻

  123. fragment float4 Polar1(float4 pixPos [[position]], constant float2 &res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; float theta = atan2(uv.y, uv.x); float threshold = 0.5*sin(5 * theta) + 0.5; return step(length(uv), threshold); } ۃ࠲ඪͷར༻
  124. ۃ࠲ඪͷར༻

  125. θ ภ֯ͷ஋ʹΑ͖͍ͬͯ͠஋Λม͍͑ͯΔ float theta = atan2(uv.y, uv.x); float threshold =

    0.5*sin(5 * theta) + 0.5; return step(length(uv), threshold); ۃ࠲ඪͷར༻
  126. θ ͖͍͠஋ͷม͑ํͰ৭ʑͳܗʹ float theta = atan2(uv.y, uv.x); float threshold =

    0.2*sin(5 * theta) + 0.8; return step(length(uv), threshold); ۃ࠲ඪͷར༻
  127. θ ͖͍͠஋ͷม͑ํͰ৭ʑͳܗʹ float theta = atan2(uv.y, uv.x); float threshold =

    0.1*step(sin(20 * theta), 0.0) + 0.9; return step(length(uv), threshold); ۃ࠲ඪͷར༻
  128. Ξχϝʔγϣϯ

  129. ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ Ξχϝʔγϣϯ όοϑΝ ը໘ղ૾౓ ܦա࣌ؒ΋౉͢ όοϑΝ

    ܦա࣌ؒ
  130. fragment float4 Animation1(float4 pixPos [[position]], constant float2& res[[buffer(0)]], constant float&

    time[[buffer(1)]]) { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; float theta = atan2(uv.y, uv.x) - time; float threshold = 0.2*sin(5 * theta) + 0.8; return step(length(uv), threshold); } Ξχϝʔγϣϯ
  131. fragment float4 Animation1(float4 pixPos [[position]], constant float2& res[[buffer(0)]], constant float&

    time[[buffer(1)]]) { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; float theta = atan2(uv.y, uv.x) - time; float threshold = 0.2*sin(5 * theta) + 0.8; return step(length(uv), threshold); } Ξχϝʔγϣϯ
  132. Ξχϝʔγϣϯ

  133. float theta = atan2(uv.y, uv.x); float amp = 0.2 *

    sin(time); float threshold = amp*sin(5 * theta) + 0.8; return step(length(uv), threshold); Ξχϝʔγϣϯ
  134. Ξχϝʔγϣϯ

  135. Ξχϝʔγϣϯ

  136. ෳ੡

  137. fragment float4 Replication1(float4 pixPos [[position]], constant float2& res[[buffer(0)]], constant float&

    time[[buffer(1)]]) { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; uv *= 2.0; uv = fract(uv) * 2.0 - 1.0; float theta = atan2(uv.y, uv.x) - time; float threshold = 0.2*sin(5 * theta) + 0.8; return step(length(uv), threshold); } ෳ੡
  138. ෳ੡

  139. uv ෳ੡

  140. 2.0 * uv ෳ੡

  141. fract(2.0 * uv); ෳ੡

  142. fract(2.0 * uv) * 2.0 - 1.0 ෳ੡

  143. GSBDUؔ਺ Yͷ୺਺ খ਺෦෼ Λऔಘ͢Δؔ਺ fract(1.5); // 0.5 fract(3.0); // 0.0

    fract(-0.1); // 0.9 GSBDU Y ͷάϥϑ T fract(T x) ෳ੡
  144. Y Yͷάϥϑ ෳ੡

  145. GSBDU Y Y ͷάϥϑ ෳ੡

  146. GSBDU         

    GSBDU      ෳ੡
  147. ෳ੡ fragment float4 Replication1(float4 pixPos [[position]], constant float2& res[[buffer(0)]], constant

    float& time[[buffer(1)]]) { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; uv *= 5.0; uv = fract(uv) * 2.0 - 1.0; float theta = atan2(uv.y, uv.x) - time; float threshold = 0.2*sin(5 * theta) + 0.8; return step(length(uv), threshold); }
  148. ෳ੡

  149. ෳ੡ͷࣝผ

  150. fragment float4 Id1(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; uv *= 2.0; uv = fract(uv) * 2.0 - 1.0; return step(length(uv), 1.0); } ෳ੡ͷࣝผ
  151. ෳ੡ͷࣝผ

  152. fragment float4 Id2(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; uv *= 2.0; float2 id = floor(uv); uv = fract(uv) * 2.0 - 1.0; float threshold = exp(-length(id)); return step(length(uv), threshold); } ෳ੡ͷࣝผ
  153. ෳ੡ͷࣝผ

  154. fragment float4 Id2(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; uv *= 2.0; float2 id = floor(uv); uv = fract(uv) * 2.0 - 1.0; float threshold = exp(-length(id)); return step(length(uv), threshold); } ෳ੡ͷࣝผ
  155. qPPSؔ਺ চؔ਺ɹYΛ௒͑ͳ͍࠷େͷ੔਺Λฦ͢ floor(1.5); // 1.0 floor(3.0); // 3.0 floor(-0.1); //

    -1.0 T floor(T x) qPPS Y ͷάϥϑ ෳ੡ͷࣝผ
  156. 2.0 * uv ෳ੡ͷࣝผ

  157. floor(2.0 * uv)       

                                                             ෳ੡ͷࣝผ
  158. ෳ੡ͷࣝผ fragment float4 Id2(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) {

    float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; uv *= 2.0; float2 id = floor(uv); uv = fract(uv) * 2.0 - 1.0; float threshold = exp(-length(id)); return step(length(uv), threshold); }
  159. ෳ੡ͷࣝผ

  160. ෳ੡ͷࣝผ

  161. ٙࣅཚ਺

  162. ٙࣅཚ਺ TJO Y GSBDU TJO Y

  163. ٙࣅཚ਺ GSBDU  TJO Y GSBDU  TJO Y

  164. ٙࣅཚ਺ GSBDU  TJO Y GSBDU  TJO Y

  165. ٙࣅཚ਺ GSBDU  TJO Y GSBDU  TJO Y

  166. ٙࣅཚ਺ GSBDU  TJO Y

  167. float N11(float v) { return fract(sin(v)*43758.5453123); } fragment float4 Noise1(float4

    pixPos [[position]], constant float2& res[[buffer(0)]]) { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv *= -1.0; return N11(uv.x); } ٙࣅཚ਺
  168. ٙࣅཚ਺

  169. float N21(float2 p) { return N11(dot(p, float2(12.9898, 78.233))); } fragment

    float4 Noise2(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv *= -1.0; return N21(uv); } ٙࣅཚ਺ ˞EPU W W ɿϕΫτϧͷ಺ੵΛऔΔؔ਺
  170. ٙࣅཚ਺

  171. fragment float4 Noise3(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv *= -1.0; uv *= 4.0; float2 id = floor(uv); return N21(id); } ٙࣅཚ਺
  172. ٙࣅཚ਺

  173. fragment float4 Noise4(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv *= -1.0; uv *= 4.0; float2 id = floor(uv); uv = fract(uv)*2.0 - 1.0; float r = N21(id); return step(length(uv), r); } ٙࣅཚ਺
  174. ٙࣅཚ਺

  175. ٙࣅཚ਺

  176. fragment float4 Color1(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv *= -1.0; float2 id = floor(4*uv); float r = N21(id); float g = N21(id + float2(123.34, 32.34)); float b = N21(id + float2(23.0, 342.0)); return float4(r, g, b, 1.0); } ৭
  177. ৭ )47৭ۭؒΛ࢖͏ IUUQTKBXJLJQFEJBPSHXJLJ)47৭ۭؒ

  178. float3 hsv2rgb(float h, float s, float v) { float3 a

    = fract(h + float3(0.0, 2.0, 1.0)/3.0)*6.0-3.0; a = clamp(abs(a) - 1.0, 0.0, 1.0) - 1.0; a = a*s + 1.0; return a*v; } ৭ ৭૬ ࠼౓ ໌౓ )47৭ۭؒΛ࢖͏ ˞I T W͸શͯʙͷ஋
  179. fragment float4 Color2(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv *= -1.0; float2 id = floor(4*uv); float h = N21(id); float3 rgb = hsv2rgb(h, 1.0, 1.0); return float4(rgb, 1.0); } ৭
  180. fragment float4 Color3(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv *= -1.0; float2 id = floor(4*uv); float h = N21(id); float3 rgb = hsv2rgb(h, 0.7, 1.0); return float4(rgb, 1.0); } ৭
  181. fragment float4 Color4(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv *= -1.0; float2 id = floor(4*uv); float h = N21(id); float3 rgb = hsv2rgb(fract(h + 0.2*time), 0.7, 1.0); return float4(rgb, 1.0); } ৭
  182. ۭؒΛ࿪ΊΔ

  183. float grid(float2 p) { float g = 0.0; p =

    fract(p); g = max(g, step(0.98, p.x)); g = max(g, step(0.98, p.y)); return g; } fragment float4 Distorted1(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; uv *= 2; float4 red(1.0, 0.0, 0.0, 1.0); return red * grid(uv); } ۭؒΛ࿪ΊΔ
  184. ۭؒΛ࿪ΊΔ

  185. fragment float4 Distorted2(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; uv *= 2; uv.x += sin(uv.y); float4 red(1.0, 0.0, 0.0, 1.0); return red * grid(uv); } ۭؒΛ࿪ΊΔ
  186. ۭؒΛ࿪ΊΔ

  187. fragment float4 Distorted3(float4 pixPos [[position]], constant float2& res[[buffer(0)]]) { float2

    uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; uv *= 2; uv.x += sin(uv.y); uv.y += sin(uv.x); float4 red(1.0, 0.0, 0.0, 1.0); return red * grid(uv); } ۭؒΛ࿪ΊΔ
  188. ۭؒΛ࿪ΊΔ

  189. fragment float4 Distorted4(float4 pixPos [[position]], constant float2& res[[buffer(0)]], constant float&

    time[[buffer(1)]]) { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; uv *= 2; uv.x += 0.5 * sin(uv.y + time) + 0.5; uv.y += 0.5 * sin(uv.x + time) + 0.5; float4 red(1.0, 0.0, 0.0, 1.0); return red * grid(uv); } ۭؒΛ࿪ΊΔ
  190. ۭؒΛ࿪ΊΔ

  191. fragment float4 Distorted5(float4 pixPos [[position]], constant float2& res[[buffer(0)]], constant float&

    time[[buffer(1)]]) { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; uv *= 2; uv *= 1.0 + (0.1 * sin(time) + 0.1) * length(uv); float4 red(1.0, 0.0, 0.0, 1.0); return red * grid(uv); } ۭؒΛ࿪ΊΔ
  192. ۭؒΛ࿪ΊΔ

  193. fragment float4 Distorted6(float4 pixPos [[position]], constant float2& res[[buffer(0)]], constant float&

    time[[buffer(1)]]) { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; uv *= 2; uv.x += 0.5 * sin(uv.y + time) + 0.5; uv.y += 0.5 * sin(uv.x + time) + 0.5; uv = fract(uv); uv -= 0.5; float theta = atan2(uv.y, uv.x); float threshold = 0.25*sin(5*theta)+0.25; return step(length(uv), threshold); } ۭؒΛ࿪ΊΔ
  194. ۭؒΛ࿪ΊΔ

  195. ςΫενϟ

  196. ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ ςΫενϟ όοϑΝ ը໘ղ૾౓ ςΫενϟ΋౉ͤΔ όοϑΝ

    ܦա࣌ؒ ςΫενϟ
  197. // όοϑΝͷ࡞੒ imageTexture = try! textureLoader.newTexture(name: “icon", scaleFactor: 1.0, bundle:

    nil, options: [.SRGB: false]) . . . // ϑϥάϝϯτγΣʔμʔͷόοϑΝͱͯ͠ઃఆ renderEncoder.setFragmentTexture(imageTexture, index: 0) ςΫενϟ
  198. // όοϑΝͷ࡞੒ imageTexture = try! textureLoader.newTexture(name: “icon", scaleFactor: 1.0, bundle:

    nil, options: [.SRGB: false]) . . . // ϑϥάϝϯτγΣʔμʔͷόοϑΝͱͯ͠ઃఆ renderEncoder.setFragmentTexture(imageTexture, index: 0) ςΫενϟ
  199. fragment float4 Hogehoge(float4 pixPos [[position]], constant float2& res[[buffer(0)]], texture2d<float> tex[[texture(0)]])

    { . . . } ςΫενϟ
  200. fragment float4 Texture1(float4 pixPos [[position]], constant float2& res[[buffer(0)]], texture2d<float> tex[[texture(0)]])

    { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); uv.y *= -1.0; constexpr sampler s(address::clamp_to_edge, filter::linear); return image.sample(s, uv); } ςΫενϟ
  201. ςΫενϟ

  202.         ςΫενϟ

  203. ςΫενϟ

  204. fragment float4 Texture2(float4 pixPos [[position]], constant float2& res[[buffer(0)]], texture2d<float> tex[[texture(0)]])

    { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); // uv.y *= -1.0; constexpr sampler s(address::clamp_to_edge, filter::linear); return image.sample(s, uv); } ςΫενϟ
  205. ςΫενϟ

  206. fragment float4 Texture2(float4 pixPos [[position]], constant float2& res[[buffer(0)]], texture2d<float> tex[[texture(0)]])

    { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); // uv.y *= -1.0; constexpr sampler s(address::clamp_to_edge, filter::linear); return image.sample(s, uv); } ςΫενϟ
  207. ςΫενϟ

  208. fragment float4 Texture3(float4 pixPos [[position]], constant float2& res[[buffer(0)]], texture2d<float> tex[[texture(0)]])

    { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); constexpr sampler s(address::repeat, filter::linear); return image.sample(s, uv); } ςΫενϟ
  209. ςΫενϟ

  210. address::mirrored_repeat address::clamp_to_zero ςΫενϟ

  211. fragment float4 Texture4(float4 pixPos [[position]], constant float2& res[[buffer(0)]], texture2d<float> tex[[texture(0)]])

    { float2 uv = (2.0 * pixPos.xy - res)/min(res.x, res.y); constexpr sampler s(address::repeat, filter::linear); float idY = floor(uv.y * 40); float d = N11(idY); float offset = 0.1 * step(0.8, d); uv.x += offset; return image.sample(s, uv); } ςΫενϟ
  212. ςΫενϟ

  213. ΠϯλϥΫγϣϯ

  214. ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ ΠϯλϥΫγϣϯ όοϑΝ ը໘ղ૾౓ όοϑΝ ܦա࣌ؒ

    ςΫενϟ
  215. ௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ όοϑΝ ը໘ղ૾౓ όοϑΝ ܦա࣌ؒ ςΫενϟ

    όοϑΝ Ճ଎౓ όοϑΝ ϚΠΫԻྔ ςΫενϟ Χϝϥը૾ όοϑΝ ࠷ޙʹ৮ͬͨ఺ ΠϯλϥΫγϣϯ
  216. fragment float4 Sample(float4 pixPos [[position]], constant float2& res[[buffer(0)]], constant float&

    time[[buffer(1)]], constant float& volume[[buffer(2)]], constant float& accel[[buffer(3)]], constant float2& touch[[buffer(4)]], texture2d<float> tex[[texture(0)]], texture2d<float> cam[[texture(1)]]) { . . . } ΠϯλϥΫγϣϯ
  217. %&.0

  218. ϨΠϚʔνϯά εϑ ΟΞτϨʔγϯά

  219. ϨΠϚʔνϯά

  220. ϨΠϚʔνϯά ΧϝϥɾεΫϦʔϯɾΦϒδΣΫτΛԾఆ͢Δ

  221. ϨΠϚʔνϯά ͋ΔϐΫηϧʹண໨

  222. ϐΫηϧͷ৭͸֎ଆ͔Βೖ͖ͬͯͨޫ ϨΠϚʔνϯά

  223. ޫ͕Ͳ͔͜Βདྷͨͷ͔ΛٯʹḷΔ ˠϨΠτϨʔγϯά ϨΠϚʔνϯά

  224. ϨΠϚʔνϯά

  225. ϨΠϚʔνϯά

  226. ϨΠϚʔνϯά

  227. ϨΠϚʔνϯά

  228. ࠷୹ڑ཭Λऔಘʁ Ͳ͏΍ͬͯʁ ϨΠϚʔνϯά

  229. ڑ཭ͰϞσϧܗঢ়ΛܾΊΔ ϨΠϚʔνϯά

  230. f(P) ϨΠϚʔνϯά ͸఺Λೖྗ͠ڑ཭Λग़ྗ͢Δؔ਺ f P

  231. f(P) = 0 ͱͳΔ఺ͷू߹ʂ Ϟσϧͷܗঢ়͸ ϨΠϚʔνϯά f(P) P

  232. IUUQJRVJMF[MFTPSHXXXBSUJDMFTEJTUGVODUJPOTEJTUGVODUJPOTIUN ϨΠϚʔνϯά

  233. fͷ౳஋໘ͱ௚ަ͢Δ εΧϥʔ৔ͷޯ഑ f gradf ͸ gradf ϨΠϚʔνϯά ɿϕΫτϧΛฦؔ͢਺

  234. NBY " # NBY # " ڑ཭ؔ਺"Ͱఆٛ͞ΕΔܗঢ় ڑ཭ؔ਺#Ͱఆٛ͞ΕΔܗঢ় NBY "

    # NJO " # ϨΠϚʔνϯά
  235. l3BZNBSDIJOHJO3BZNBSDIJOHzDSFBUFECZLBOFUB !LBOFUBBBBB  IUUQTXXXTIBEFSUPZDPNWJFXXM4(8Z ϨΠϚʔνϯά

  236. ӍཻγΣʔμ ʔղઆ

  237. ӍཻγΣʔμ ʔղઆ ॎԣൺ͕ҟͳΔάϦουΛ࡞Δ

  238. ӍཻγΣʔμ ʔղઆ άϦου಺ʹԁΛඳ͘

  239. ӍཻγΣʔμ ʔղઆ ԁΛΞχϝʔγϣϯͤ͞Δ

  240. ӍཻγΣʔμ ʔղઆ άϦου΋ಈ͔͢

  241. ӍཻγΣʔμ ʔղઆ άϦου಺ʹখ͍͞఺Λඳ͘

  242. ӍཻγΣʔμ ʔղઆ େ͖͍ԁΑΓ্ͷҐஔͰখ͍͞ԁʹϚεΫΛ͔͚Δ

  243. ӍཻγΣʔμ ʔղઆ খ͍͞ԁʹάϥσʔγϣϯΛ͔͚Δ

  244. ӍཻγΣʔμ ʔղઆ େ͖͍ԁΛগ͠࿪·ͤͯԼଆ͕গ͠େ͖͍ܗʹ͢Δ

  245. ӍཻγΣʔμ ʔղઆ ࠨӈํ޲ʹ΋Ξχϝʔγϣϯͤ͞Δ

  246. ӍཻγΣʔμ ʔղઆ άϦουຖʹλΠϛϯάͱҐஔΛͣΒ͢

  247. ӍཻγΣʔμ ʔղઆ ௨աҐஔۙล͚ͩʹάϥσʔγϣϯϚεΫΛ࡞Δ

  248. ӍཻγΣʔμ ʔղઆ ΧϝϥೖྗΛςΫενϟͱͯ͠ೖྗ͠ ӍཻͷՕॴ͸αϯϓϦϯά͢Δ৔ॴΛͣΒ͢

  249. ӍཻγΣʔμ ʔղઆ άϥσʔγϣϯϚεΫʹԠͯ͡΅͔͢

  250. ӍཻγΣʔμ ʔղઆ 5IF"SUPG$PEF IUUQTXXXZPVUVCFDPNDIBOOFM6$D"M5RE[*%B/95[XY+9H

  251. 4IBEFS"SU4BNQMFT IUUQTHJUIVCDPNUBLBUTV4IBEFS"SU4BNQMFT

  252. ࢀߟ ɾ5IF#PPLPG4IBEFS
 ɹIUUQTUIFCPPLPGTIBEFSTDPN ɾ*OJHP2VJMF[ࢯͷαΠτ ɹIUUQJRVJMF[MFTPSH ɾ5IF"SUPG$PEF ɹIUUQTXXXZPVUVCFDPNDIBOOFM6$D"M5RE[*%B/95[XY+9H ɾXHMEPSH(-4-DPOUFOUT
 ɹIUUQTXHMEPSHEHMTM ɾָ͍͠ʂ6OJUZγΣʔμʔ͓ֆඳ͖ೖ໳ʂ


    ɹIUUQTUDPLX3"/MV$
  253. &OKPZ4IBEFS 1SPHSBNNJOH