Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

ࣗݾ঺հ࠷ۙϋϚ͍ͬͯΔ͜ͱ ݪཧɿ $0ˠ$0 'F0ʴ$0ˠ'F$0 ໦୸Λ೩΍ͯ͠ൃੜ͢ΔҰࢎԽ୸ૉ͕ ࠭మ ࢎԽమ Λؐݩ͢Δ͜ͱͰమʹͳΔɻ ຊདྷమͷ༥఺͸ˆ͕ͩɺ໦୸ʹ઀͠ ͍ͯΔˍෆ७෺ΛؚΉ͜ͱʹΑΓڽݻ఺ ߱Լ͕ى͜ΓɺΑΓ௿͍Թ౓Ͱ༹༥͠࿍ ͷఈͰమմͱͳΔɻ

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

ࣗݾ঺հ࠷ۙϋϚ͍ͬͯΔ͜ͱ ࢀߟจݙɿ ɾӬా࿨޺ɹ ɹΠν͔Β࡞Δమ ೶ࢁړଜจԽڠձ ɾӬా࿨޺ɹ ɹਓ͸ͲͷΑ͏ʹమΛ࡞͖͔ͬͯͨ ߨஊࣾ ɾڥɹஐ༸ɹϨϯΨࣜͨͨΒ੡మ࿍ʹΑΔమͮ͘Γ IUUQXXXUPSBZTGPSKQBDUJWJUZTDJFODF@FEVQEGI@QEG ɾᜊ౻౒ɾࡔຊູɾߴ௩ल࣏ɹ౛ঊ͕ܧঝ͢Δ఻౷ٕज़ͷࣗવՊ ֶతௐࠪ IUUQTXXXSFLJIBLVBDKQPVUMJOFQVCMJDBUJPOSPOCVOSPOCVOQEG QEG

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

γΣʔμ ʔΞʔτͱ͸ʁ

Slide 14

Slide 14 text

%&.0

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

γΣʔμ ʔͱ͸ʁ

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

γΣʔμ ʔͱ͸ʁ

Slide 27

Slide 27 text

γΣʔμ ʔͱ͸ʁ

Slide 28

Slide 28 text

γΣʔμ ʔͱ͸ʁ

Slide 29

Slide 29 text

γΣʔμ ʔͱ͸ʁ

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

γΣʔμ ʔΞʔτͷ ࢓૊Έ

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

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

Slide 39

Slide 39 text

J04Ͱͷ࡞Γํ

Slide 40

Slide 40 text

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

Slide 41

Slide 41 text

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

Slide 42

Slide 42 text

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

Slide 43

Slide 43 text

࣮ફ.4-

Slide 44

Slide 44 text

جຊฤ

Slide 45

Slide 45 text

جຊฤ

Slide 46

Slide 46 text

جຊฤ #include using namespace metal; fragment float4 Basic1(float4 pixPos [[position]]) { return float4(1.0, 0.0, 0.0, 1.0); }

Slide 47

Slide 47 text

جຊฤ

Slide 48

Slide 48 text

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

Slide 49

Slide 49 text

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

Slide 50

Slide 50 text

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

Slide 51

Slide 51 text

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

Slide 52

Slide 52 text

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

Slide 53

Slide 53 text

#include using namespace metal; fragment float4 Basic1(float4 pixPos [[position]]) { return float4(1.0, 0.0, 0.0, 1.0); } ϑϥά ϝϯτγΣʔμ ʔͷؔ਺໊ جຊฤ

Slide 54

Slide 54 text

let library = device.makeDefaultLibrary() let fragmentFunction = library.makeFunction(name:”Basic1”) . . . let pipelineDescriptor = MTLRenderPipelineDescriptor() pipelineDescriptor.fragmentFunction = fragmentFunction . . . $16ଆͰؔ਺໊͔Β.5-'VODUJPOΛऔಘ͠ ύΠϓϥΠϯͷϑϥά ϝϯτγΣʔμ ʔͱͯ͠ઃఆ͓ͯ͘͠ جຊฤ

Slide 55

Slide 55 text

#include using namespace metal; fragment float4 Basic1(float4 pixPos [[position]]) { return float4(1.0, 0.0, 0.0, 1.0); } 3 ( # Ћ جຊฤ

Slide 56

Slide 56 text

float bool int char short uchar uint ushort half size_t ptrdiff_t void ˞MPOHVOTJHOFEMPOH͸.FUBMҎ߱Ͱαϙʔτ ˞EPVCMFMPOHMPOHVOTJHOFEMPOHMPOHMPOHEPVCMF͸ະαϙʔτ جຊฤ .4-ͷεΧϥʔܕ

Slide 57

Slide 57 text

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-ͷϕΫτϧܕ

Slide 58

Slide 58 text

.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 جຊฤ

Slide 59

Slide 59 text

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-ͷϕΫτϧܕՃݮ৐আ جຊฤ

Slide 60

Slide 60 text

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-ͷϕΫτϧܕεΧϥʔܕͱͷՃݮ৐আ جຊฤ

Slide 61

Slide 61 text

half2x2 half2x3 half2x4 float2x2 float2x3 float2x4 half3x2 half3x3 half3x4 half4x2 half4x3 half4x4 float3x2 float3x3 float3x4 float4x2 float4x3 float4x4 .4-ͷߦྻܕ ໊લۭؒNFUBM಺ جຊฤ

Slide 62

Slide 62 text

return float4(1.0, 0.0, 0.0, 1.0); શͯͷϐΫηϧΛ੺ʹ͢Δ جຊฤ

Slide 63

Slide 63 text

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

Slide 64

Slide 64 text

جຊฤ

Slide 65

Slide 65 text

fragment float4 Basic2(float4 pixPos [[position]]) { return clamp(length(pixPos.xy)/300.0, 0.0, 1.0); } جຊฤ ͜Ε͸Կʁ

Slide 66

Slide 66 text

.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! جຊฤ

Slide 67

Slide 67 text

fragment float4 Basic2(float4 pixPos [[position]]) { return clamp(length(pixPos.xy)/300.0, 0.0, 1.0); } MFOHUIؔ਺ جຊฤ

Slide 68

Slide 68 text

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) جຊฤ

Slide 69

Slide 69 text

fragment float4 Basic2(float4 pixPos [[position]]) { return clamp(length(pixPos.xy)/300.0, 0.0, 1.0); } DMBNQؔ਺ جຊฤ

Slide 70

Slide 70 text

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) جຊฤ

Slide 71

Slide 71 text

9 : 8JEUI )FJHIU 8JEUI )FJHIU ϐΫηϧ࠲ඪܥ جຊฤ

Slide 72

Slide 72 text

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

Slide 73

Slide 73 text

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

Slide 74

Slide 74 text

جຊฤ

Slide 75

Slide 75 text

fragment float4 Basic3(float4 pixPos [[position]]) { return step(300.0, length(pixPos.xy)); } TUFQؔ਺ جຊฤ

Slide 76

Slide 76 text

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) جຊฤ

Slide 77

Slide 77 text

return step(300.0, length(pixPos.xy)); ݪ఺ͱͷڑ཭͕Ҏ্ͷՕॴ͕നɺະຬͷՕॴ͕ࠇ جຊฤ

Slide 78

Slide 78 text

fragment float4 Basic4(float4 pixPos [[position]]) { return smoothstep(300.0, 400.0, length(pixPos.xy)); } جຊฤ

Slide 79

Slide 79 text

جຊฤ

Slide 80

Slide 80 text

fragment float4 Basic4(float4 pixPos [[position]]) { return smoothstep(300.0, 400.0, length(pixPos.xy)); } TNPPUITUFQؔ਺ جຊฤ

Slide 81

Slide 81 text

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 ʹରͯ͠͸ Λฦ͢ جຊฤ

Slide 82

Slide 82 text

TNPPUITUFQ Y ͷάϥϑ جຊฤ

Slide 83

Slide 83 text

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

Slide 84

Slide 84 text

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); } جຊฤ

Slide 85

Slide 85 text

جຊฤ

Slide 86

Slide 86 text

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ؔ਺

Slide 87

Slide 87 text

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 ͷάϥϑ جຊฤ

Slide 88

Slide 88 text

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); } جຊฤ

Slide 89

Slide 89 text

جຊฤ

Slide 90

Slide 90 text

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ؔ਺

Slide 91

Slide 91 text

جຊฤ

Slide 92

Slide 92 text

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; } جຊฤ

Slide 93

Slide 93 text

جຊฤ float m2 = step(500.0, length(pixPos.xy)); col = mix(col, blue, m2);

Slide 94

Slide 94 text

جຊςΫχοΫ

Slide 95

Slide 95 text

ਖ਼نԽ ࠲ඪม׵ͱ

Slide 96

Slide 96 text

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

Slide 97

Slide 97 text

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

Slide 98

Slide 98 text

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

Slide 99

Slide 99 text

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

Slide 100

Slide 100 text

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

Slide 101

Slide 101 text

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

Slide 102

Slide 102 text

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

Slide 103

Slide 103 text

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

Slide 104

Slide 104 text

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

Slide 105

Slide 105 text

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); } ࠲ඪม׵ͱਖ਼نԽ

Slide 106

Slide 106 text

࠲ඪม׵ͱਖ਼نԽ

Slide 107

Slide 107 text

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); } ࠲ඪม׵ͱਖ਼نԽ

Slide 108

Slide 108 text

9 8JEUI )FJHIU 8JEUI )FJHIU ϐΫηϧ࠲ඪܥ pixPos.xy : ࠲ඪม׵ͱਖ਼نԽ

Slide 109

Slide 109 text

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

Slide 110

Slide 110 text

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

Slide 111

Slide 111 text

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

Slide 112

Slide 112 text

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

Slide 113

Slide 113 text

࠲ඪม׵ͱਖ਼نԽ

Slide 114

Slide 114 text

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

Slide 115

Slide 115 text

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

Slide 116

Slide 116 text

ྫฏߦҠಈ ఺ͷม׵ͱͯ͠ͷࢹ఺ ࠲ඪܥͷม׵ͱͯ͠ͷࢹ఺ ⃗ t − ⃗ t ⃗ P + ⃗ t ࠲ඪม׵ͱਖ਼نԽ

Slide 117

Slide 117 text

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

Slide 118

Slide 118 text

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

Slide 119

Slide 119 text

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

Slide 120

Slide 120 text

ۃ࠲ඪͷར༻

Slide 121

Slide 121 text

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

Slide 122

Slide 122 text

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

Slide 123

Slide 123 text

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); } ۃ࠲ඪͷར༻

Slide 124

Slide 124 text

ۃ࠲ඪͷར༻

Slide 125

Slide 125 text

θ ภ֯ͷ஋ʹΑ͖͍ͬͯ͠஋Λม͍͑ͯΔ float theta = atan2(uv.y, uv.x); float threshold = 0.5*sin(5 * theta) + 0.5; return step(length(uv), threshold); ۃ࠲ඪͷར༻

Slide 126

Slide 126 text

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

Slide 127

Slide 127 text

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

Slide 128

Slide 128 text

Ξχϝʔγϣϯ

Slide 129

Slide 129 text

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

Slide 130

Slide 130 text

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); } Ξχϝʔγϣϯ

Slide 131

Slide 131 text

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); } Ξχϝʔγϣϯ

Slide 132

Slide 132 text

Ξχϝʔγϣϯ

Slide 133

Slide 133 text

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); Ξχϝʔγϣϯ

Slide 134

Slide 134 text

Ξχϝʔγϣϯ

Slide 135

Slide 135 text

Ξχϝʔγϣϯ

Slide 136

Slide 136 text

ෳ੡

Slide 137

Slide 137 text

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); } ෳ੡

Slide 138

Slide 138 text

ෳ੡

Slide 139

Slide 139 text

uv ෳ੡

Slide 140

Slide 140 text

2.0 * uv ෳ੡

Slide 141

Slide 141 text

fract(2.0 * uv); ෳ੡

Slide 142

Slide 142 text

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

Slide 143

Slide 143 text

GSBDUؔ਺ Yͷ୺਺ খ਺෦෼ Λऔಘ͢Δؔ਺ fract(1.5); // 0.5 fract(3.0); // 0.0 fract(-0.1); // 0.9 GSBDU Y ͷάϥϑ T fract(T x) ෳ੡

Slide 144

Slide 144 text

YYͷάϥϑ ෳ੡

Slide 145

Slide 145 text

GSBDU YY ͷάϥϑ ෳ੡

Slide 146

Slide 146 text

GSBDU GSBDU ෳ੡

Slide 147

Slide 147 text

ෳ੡ 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); }

Slide 148

Slide 148 text

ෳ੡

Slide 149

Slide 149 text

ෳ੡ͷࣝผ

Slide 150

Slide 150 text

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); } ෳ੡ͷࣝผ

Slide 151

Slide 151 text

ෳ੡ͷࣝผ

Slide 152

Slide 152 text

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); } ෳ੡ͷࣝผ

Slide 153

Slide 153 text

ෳ੡ͷࣝผ

Slide 154

Slide 154 text

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); } ෳ੡ͷࣝผ

Slide 155

Slide 155 text

qPPSؔ਺ চؔ਺ɹYΛ௒͑ͳ͍࠷େͷ੔਺Λฦ͢ floor(1.5); // 1.0 floor(3.0); // 3.0 floor(-0.1); // -1.0 T floor(T x) qPPS Y ͷάϥϑ ෳ੡ͷࣝผ

Slide 156

Slide 156 text

2.0 * uv ෳ੡ͷࣝผ

Slide 157

Slide 157 text

floor(2.0 * uv) ෳ੡ͷࣝผ

Slide 158

Slide 158 text

ෳ੡ͷࣝผ 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); }

Slide 159

Slide 159 text

ෳ੡ͷࣝผ

Slide 160

Slide 160 text

ෳ੡ͷࣝผ

Slide 161

Slide 161 text

ٙࣅཚ਺

Slide 162

Slide 162 text

ٙࣅཚ਺ TJO Y GSBDU TJO Y

Slide 163

Slide 163 text

ٙࣅཚ਺ GSBDU TJO Y GSBDU TJO Y

Slide 164

Slide 164 text

ٙࣅཚ਺ GSBDU TJO Y GSBDU TJO Y

Slide 165

Slide 165 text

ٙࣅཚ਺ GSBDU TJO Y GSBDU TJO Y

Slide 166

Slide 166 text

ٙࣅཚ਺ GSBDU TJO Y

Slide 167

Slide 167 text

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); } ٙࣅཚ਺

Slide 168

Slide 168 text

ٙࣅཚ਺

Slide 169

Slide 169 text

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 ɿϕΫτϧͷ಺ੵΛऔΔؔ਺

Slide 170

Slide 170 text

ٙࣅཚ਺

Slide 171

Slide 171 text

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); } ٙࣅཚ਺

Slide 172

Slide 172 text

ٙࣅཚ਺

Slide 173

Slide 173 text

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); } ٙࣅཚ਺

Slide 174

Slide 174 text

ٙࣅཚ਺

Slide 175

Slide 175 text

ٙࣅཚ਺

Slide 176

Slide 176 text

Slide 177

Slide 177 text

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); } ৭

Slide 178

Slide 178 text

Slide 179

Slide 179 text

৭ )47৭ۭؒΛ࢖͏ IUUQTKBXJLJQFEJBPSHXJLJ)47৭ۭؒ

Slide 180

Slide 180 text

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͸શͯʙͷ஋

Slide 181

Slide 181 text

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); } ৭

Slide 182

Slide 182 text

Slide 183

Slide 183 text

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); } ৭

Slide 184

Slide 184 text

Slide 185

Slide 185 text

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); } ৭

Slide 186

Slide 186 text

Slide 187

Slide 187 text

Slide 188

Slide 188 text

ۭؒΛ࿪ΊΔ

Slide 189

Slide 189 text

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); } ۭؒΛ࿪ΊΔ

Slide 190

Slide 190 text

ۭؒΛ࿪ΊΔ

Slide 191

Slide 191 text

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); } ۭؒΛ࿪ΊΔ

Slide 192

Slide 192 text

ۭؒΛ࿪ΊΔ

Slide 193

Slide 193 text

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); } ۭؒΛ࿪ΊΔ

Slide 194

Slide 194 text

ۭؒΛ࿪ΊΔ

Slide 195

Slide 195 text

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); } ۭؒΛ࿪ΊΔ

Slide 196

Slide 196 text

ۭؒΛ࿪ΊΔ

Slide 197

Slide 197 text

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); } ۭؒΛ࿪ΊΔ

Slide 198

Slide 198 text

ۭؒΛ࿪ΊΔ

Slide 199

Slide 199 text

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); } ۭؒΛ࿪ΊΔ

Slide 200

Slide 200 text

ۭؒΛ࿪ΊΔ

Slide 201

Slide 201 text

ςΫενϟ

Slide 202

Slide 202 text

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

Slide 203

Slide 203 text

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

Slide 204

Slide 204 text

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

Slide 205

Slide 205 text

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

Slide 206

Slide 206 text

fragment float4 Texture1(float4 pixPos [[position]], constant float2& res[[buffer(0)]], texture2d 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); } ςΫενϟ

Slide 207

Slide 207 text

ςΫενϟ

Slide 208

Slide 208 text

ςΫενϟ

Slide 209

Slide 209 text

ςΫενϟ

Slide 210

Slide 210 text

fragment float4 Texture2(float4 pixPos [[position]], constant float2& res[[buffer(0)]], texture2d 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); } ςΫενϟ

Slide 211

Slide 211 text

ςΫενϟ

Slide 212

Slide 212 text

fragment float4 Texture2(float4 pixPos [[position]], constant float2& res[[buffer(0)]], texture2d 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); } ςΫενϟ

Slide 213

Slide 213 text

ςΫενϟ

Slide 214

Slide 214 text

fragment float4 Texture3(float4 pixPos [[position]], constant float2& res[[buffer(0)]], texture2d 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); } ςΫενϟ

Slide 215

Slide 215 text

ςΫενϟ

Slide 216

Slide 216 text

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

Slide 217

Slide 217 text

fragment float4 Texture4(float4 pixPos [[position]], constant float2& res[[buffer(0)]], texture2d 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); } ςΫενϟ

Slide 218

Slide 218 text

ςΫενϟ

Slide 219

Slide 219 text

ΠϯλϥΫγϣϯ

Slide 220

Slide 220 text

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

Slide 221

Slide 221 text

௖఺ॲཧ ϥελϥΠζ ϑϥάϝϯτॲཧ ೖྗɿ௖఺ྻ ग़ྗɿը૾ όοϑΝ ը໘ղ૾౓ όοϑΝ ܦա࣌ؒ ςΫενϟ όοϑΝ Ճ଎౓ όοϑΝ ϚΠΫԻྔ ςΫενϟ Χϝϥը૾ όοϑΝ ࠷ޙʹ৮ͬͨ఺ ΠϯλϥΫγϣϯ

Slide 222

Slide 222 text

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 tex[[texture(0)]], texture2d cam[[texture(1)]]) { . . . } ΠϯλϥΫγϣϯ

Slide 223

Slide 223 text

%&.0

Slide 224

Slide 224 text

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

Slide 225

Slide 225 text

ϨΠϚʔνϯά

Slide 226

Slide 226 text

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

Slide 227

Slide 227 text

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

Slide 228

Slide 228 text

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

Slide 229

Slide 229 text

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

Slide 230

Slide 230 text

ϨΠϚʔνϯά

Slide 231

Slide 231 text

ϨΠϚʔνϯά

Slide 232

Slide 232 text

ϨΠϚʔνϯά

Slide 233

Slide 233 text

ϨΠϚʔνϯά

Slide 234

Slide 234 text

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

Slide 235

Slide 235 text

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

Slide 236

Slide 236 text

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

Slide 237

Slide 237 text

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

Slide 238

Slide 238 text

IUUQJRVJMF[MFTPSHXXXBSUJDMFTEJTUGVODUJPOTEJTUGVODUJPOTIUN ϨΠϚʔνϯά

Slide 239

Slide 239 text

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

Slide 240

Slide 240 text

NBY " # NBY # " ڑ཭ؔ਺"Ͱఆٛ͞ΕΔܗঢ় ڑ཭ؔ਺#Ͱఆٛ͞ΕΔܗঢ় NBY " # NJO " # ϨΠϚʔνϯά

Slide 241

Slide 241 text

l3BZNBSDIJOHJO3BZNBSDIJOHzDSFBUFECZLBOFUB !LBOFUBBBBB IUUQTXXXTIBEFSUPZDPNWJFXXM4(8Z ϨΠϚʔνϯά

Slide 242

Slide 242 text

ӍཻγΣʔμ ʔղઆ

Slide 243

Slide 243 text

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

Slide 244

Slide 244 text

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

Slide 245

Slide 245 text

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

Slide 246

Slide 246 text

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

Slide 247

Slide 247 text

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

Slide 248

Slide 248 text

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

Slide 249

Slide 249 text

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

Slide 250

Slide 250 text

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

Slide 251

Slide 251 text

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

Slide 252

Slide 252 text

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

Slide 253

Slide 253 text

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

Slide 254

Slide 254 text

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

Slide 255

Slide 255 text

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

Slide 256

Slide 256 text

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

Slide 257

Slide 257 text

4IBEFS"SU4BNQMFT IUUQTHJUIVCDPNUBLBUTV4IBEFS"SU4BNQMFT

Slide 258

Slide 258 text

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

Slide 259

Slide 259 text

&OKPZ4IBEFS 1SPHSBNNJOH