SlideShare a Scribd company logo
1 of 18
Unity×Processing 1 Week
Unity1Week共有会 #9
えふぇ子
自己の紹介
えふぇ子
@EphedrineUniuni
ゲームを作る羊です
内なる世界観をゲームにしたい!
エルデの王になりました 二週目中
話すこと
Processingはいいぞ!!!!
作ったもの
呪いを溜めて呪と天使を滅すゲーム(?)
呪溜
ゲーム性は浜で死にました
身体を侵す呪いの表現
↑主人公の呪い蓄積ゲージと対応した画面端
→天使を呪いで
攻撃したときの
エフェクト
←市民の呪いを
吸収したときの
エフェクト
しくみ
・グレスケ不透明画像をアルファ値を持つものに
(Spriteの設定から)
・Sprite MaskのAlpha Cutoffによって、
透明度がt~1の範囲をマスクとして扱う
Unity上で
・マスク画像の設定
・TextureType :Sprite(2D and UI)
・AlphaSource :From Gray Scale
・Sprite Maskの設定
・Sprite :マスク画像を参照
・AlphaCutoff :スクリプト等からいじる
・CustomRange :複数マスク使うなら必須
SortingLayerを使って範囲を指定
・Sprite Rendererの設定
・MaskInteraction: Visible Outside(又はInside) Mask
今回のマスク用ルール画像
今回のマスク用ルール画像
1
2
1
█ 塗りつぶし候補(ランダム選択)
█ 塗りつぶしたピクセル
█ まだその時ではない
6 10 14 2
1 5 15 9
12 16 11 3
7 4 13 8
・・・
・画像の縁から順に黒~白くしていく
・後に塗るものほど白く
・塗りつぶしたpxの隣のpxも縁判定
※手間だったので段々白くはしてない
で、どう作る?
・グラデーションやパーリンノイズであればPhotoShopやクリスタで十分代用可能
・アルゴリズムを組む必要があるときはコーディング必須
・Processing、結構おすすめ
Processingとは
Processing(プロセシング)は、キャセイ・レアス(英語版)(Casey Reas)とベンジャミン・フライ(英語版)
(Benjamin Fry)によるオープンソースプロジェクトであり、かつてはMITメディアラボで開発されていた。電子
アートとビジュアルデザインのためのプログラミング言語であり、統合開発環境(IDE)である。アーティストに
よるコンテンツ制作作業のために、詳細な設定を行う関数を排除している。 視覚的なフィードバックが即座に得ら
れるため、初心者がプログラミングを学習するのに適しており、電子スケッチブックの基盤としても利用できる。
Java を単純化し、グラフィック機能に特化した言語といえる。
(https://ja.wikipedia.org/wiki/Processingより引用)
フラクタル羊🐑🐑🐑🐑🐑 ライブラリ使用、手書き風お星さま なんか菊っぽさを感じる……!
いいとこ2つ
①Unityの苦手を補ってくれる
②ユニラーにとって学習コスト低め
いいとこ① Unityの苦手を補ってくれる
・Unity、画像ファイル生成苦手ちゃん
// 白色の64×64のテクスチャをAssets/に作成する
private static void CreateTexture()
{
var texture = CreateTempTexture(64, 64, Color.white);
// これを呼ばないと色が書き込まれない
texture.Apply();
System.IO.File.WriteAllBytes(Application.dataPath + "/temp.png",
texture.EncodeToPNG());
// 削除を忘れない
DestroyImmediate(texture);
AssetDatabase.Refresh();
}
/// <summary>
/// 特定の色で埋めたテクスチャを取得
/// </summary>
private static Texture2D CreateTempTexture(int width, int height, Color
defaultColor = default)
{
var texture = new Texture2D(width, height, TextureFormat.RGB24, false);
for (int y = 0; y < texture.height; y++)
for (int x = 0; x < texture.width; x++)
texture.SetPixel(x, y, defaultColor);
return texture;
}
引用:【Unity】単色テクスチャを生成する うにてぃブログ
https://hacchi-man.hatenablog.com/entry/2020/02/29/220000
size(64,64);
background(255);
saveFrame(パス);
=
画像インスタンスを作って1画素ずつ設定
生成方法2通り
colorMode(HSB, 360, 100, 100);
PImage img = createImage(64, 64, RGB); //画像インスタンス作
成
int[] pxs = new int[64*64]; //画素の配列
for(int n=0;n<64*64;n++)pxs[n]=color(0);
for (int n=0; n<50; n++)
{
int col = color(random(360), 50, 90); //色(HSB)か
らintに
int gridPos = (int)random(64);
for (int m=0; m<64; m++)
{
pxs[gridPos*64+m]=col; //配列の値を変更
pxs[gridPos+64*m]=col;
}
}
img.pixels = pxs; //画素配列を適用
img.save(パス); //画像を保存
生成方法2通り
ウィンドウに直接描いてそれを保存
size(512,512); //ウィンドウを作る
colorMode(HSB,360,100,100);
background(0);
noStroke();
blendMode(ADD); //加算モード
for(int n=0;n<100;n++)
{
fill(random(360),40,30); //塗りつぶし色設定
circle(random(width),random(height),100); //円を描く
}
saveFrame(パス) //ウィンドウを保存
いいとこ② C#と似たノリで書ける
・ProcessingはJavaから派生したもの
・静的型付け言語
・オブジェクト指向(画像生成だとあんま意味ないけど)
→C#と近いので学習コストが低い!
・画像生成ならPythonもあるけど 羊は負けてしまったので
・動的型付け許すまじ
おまけ こんなこともできるぞ
れっつProcessing!

More Related Content

Recently uploaded

知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptxsn679259
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...Toru Tamaki
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Gamesatsushi061452
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイスCRI Japan, Inc.
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsWSO2
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルCRI Japan, Inc.
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video UnderstandingToru Tamaki
 

Recently uploaded (10)

知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 

Featured

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

Featured (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Unity×Processing 1 Week.pptx

Editor's Notes

  1. こんばんは、えふぇ子です。UnityかけるProcessing1Weekということで発表
  2. 改めまして自己紹介 えふぇ子という名前と羊のアイコンでゲーム制作 情報系の大学生 Mathamreという数学×弾幕ゲームが代表作となっております
  3. 今回のメインはこれです Processingはいいぞ! 後々詳しく話す
  4. まず今回のu1wで作ったゲーム 呪いを溜めて呪と天使を滅すゲーム、しゅりゅうです で、先ほどKinjoさんが面白さを最初に決めると良いとおっしゃってたと思うんですが 私は今回のは面白さ追求しないようにしようということでゲーム性はほっぽりました 評価は散々ですけどメンタルは保ったまま動けました
  5. 今回は呪いの表現にちょいと力を入れてみようということでこういう演出作った 主人公が呪いを体に溜めるので、その溜め具合に応じて画面はしをもじゃもじゃさせたり 呪いを受けた天使や市民の浸食されてる感じのあれですね
  6. この表現は全部SpriteMaskを使って作成 マスクのアルファ値をグレースケール画像の画素値からとる 白ほど不透明黒ほど透明 SpriteMaskのAlphaCutoffを使って度の透明度からをマスク本体とするかをいじる
  7. Unity上ではこういう設定です 後で資料公開するのでじっくり見たい方はそちらで
  8. で、今回のマスク用ルール画像はこういったものを用意しました
  9. 作成アルゴリズムこんな感じです 画像のエッジのピクセルをランダムに選んで、順に塗りつぶしていきます 先に選ばれたピクセルほど黒く、あとのものほど白くという感じです 1ピクセル塗りつぶしたら、それと隣接するピクセルもエッジとみなしてランダム選出を繰り返します
  10. で、こういうの作るのに何を使うんだという話なんですね 単純なグラデーションやパーリンノイズであればフォトショやクリスタでOK ただ、今回はコーディング必須なのでそいつらは使えぬ そこでProcessingです
  11. メイン来ました Processingとは一つのプログラミング言語ですね えーwikiから引用していますが、大事なのはグラフィックに特化した言語ということですね 例えば↓に載せたgifのような作品が簡単に作れます
  12. 個人的な感想ですが、Unityって画像ファイルを作るのそんなに得意じゃないんですよね こちら引用させていただいたものなのですが、白色塗りつぶしの正方形を作るのにこれだけかかるそうです  えー対してProcessing君これだけです すばらしい ウィンドウサイズ指定して白色で塗りつぶしてセーブです
  13. 生成方法は主に二通り使えます 1つめが画像インスタンスを作って、その画素を1つずつ指定していく方法ですね どちらかというとドット絵っぽいものを作る時のほうがやりやすいと思います 色もHSBだったりRGBだったりで指定できるのでお優しいです 今回もこちらを使いました
  14. もう一つが、ウィンドウに直接図形を描画して、ウィンドウそのものを保存するというものですね さすがにピクセル1つずつ塗りつぶして図形を描くのは超大変なので、図形を使うならこちらだと思います これを使って画面のトランジションを作ったこともあるので、目的によりけりですね
  15. いいとこその2です Processingですね、Javaから派生したもの 静的型付け言語でオブジェクト指向です UnityC#と同じです とても似ていて学習コストが低いのです で、画像生成だとPythonとかでもできると思うんですけど 羊さんはね 負けてしまったので Processingを推します