SlideShare a Scribd company logo
Shader Graphを使う
2021/5/30 株式会社トルクス 山田 (@octi)
@地域おこしXR研究会 ゆるもく勉強会
自己紹介:山田宏道
 株式会社トルクス(@島根) 代表取締役
 https://www.facebook.com/hiromichi.yamada
 元ゲームプログラマー
 スマートフォン/PC向け アプリ開発
 VR/ARやドローンなど、最新技術が好き。
 地域おこしXR研究会を発足し、勉強会を開催
しています!
自己紹介<宣伝>
 Magic Leapコンテンツを制作しています
隠岐諸島の歴史をゲームで学べるXR教育コ
ンテンツ | docomo XR | NTTドコモ
A-Leaf(エイ・リーフ)を使用した3D観光案内 |
docomo XR | NTTドコモ
Shader Graphとは
Shader Graphとは
通常のマテリアル(Material)(モデルとかの色・テ
クスチャなど見た目設定)では物足りない🤔🤔
シェーダー(Shader)を書けば複雑な設定も
できる💪💪
シェーダー(Shader)難しい😭😭
💁💁Shader Graph!
Shader Graphとは
 Unity Shader Graph | Unity で
シェーダーを視覚的に構築 | レン
ダリング&グラフィック | Unity
できると確認したことを発表します
 今回の発表内容は「Shader Graphを始める一つの方法」です
 全てを把握するのは大変(開発環境 x 実行環境 x 機能)
 古い環境のキャッチアップ等は本家の仕事
 動かないデバイスや機能もある
 Unity Editor上(Windows 10)で動作確認
 Oculus Quest 2で動作した
 Magic Leap Oneでも動いた
 Bloom系は動かなさそう+見えなさそう
 動かない機能もあると思う
Shader Graphのつくりかた
Shader Graphを使う:流れ
① 対応しているUnityのバージョンを確認
② URPの導入
③ Shader Graphとマテリアルを作成
④ ③をいい感じに使う!<ここが目的>
Shader Graphを使う①
① 対応しているUnityのバージョンを確認
② URPの導入
③ Shader Graphとマテリアルを作成
④ ③をいい感じに使う!<ここが目的>
Unityのバージョン
 Unity 2019.3 以降(多分)
 私が確認した環境
 2019.4.22f1 (2019 LTS)
 2020.2.6f1
Shader Graphを使う②
① 対応しているUnityのバージョンを確認
② URPの導入
③ Shader Graphとマテリアルを作成
④ ③をいい感じに使う!<ここが目的>
URP(SRP)の導入
 Scriptable Render Pipeline(SRP)
 URP: Universal Render Pipeline (旧 LWRP)
 HDRP: High Definition Render Pipeline
 Unityの次の標準レンダリングパイプライン Universal Render
Pipeline は何がどう変わるのか | Unity Learning Materials
(unity3d.jp)
 汎用的な描画の仕組みから、カスタムできる描画の仕組みへの変更
 (HDRPは試していません)
1. Packageを追加
 Package Managerを開き、Universal RPを追加する
 Unityを再起動する
2. Pipelineアセットを作成
 Projectパネルで、Pipelineアセットを作成します。
 Create > Rendering > Universal Render Pipeline > Pipeline
Asset (Forward Renderer)
3. Render Pipelineを設定
 Edit > Project Settings パネルを開く
 Graphics > Scriptable Render Pipeline Settingsを設定
 (前項で作ったもの)
Shader Graphを使う③
① 対応しているUnityのバージョンを確認
② URPの導入
③ Shader Graphとマテリアルを作成
④ ③をいい感じに使う!<ここが目的>
1. Assets内で作成
 Assets > Create
 Shader > Universal Render Pipeline > Unlit Shader Graph を選ぶ
 適当に命名 (like ..FirstSG)
2. マテリアルを作成
 Shader Graphアセットを選び
右クリックからMaterialを作成
 適当に命名
 必要に応じてシーン内のオブ
ジェクトにアタッチする
Shader Graphを使う④
① 対応しているUnityのバージョンを確認
② URPの導入
③ Shader Graphとマテリアルを作成
④ ③をいい感じに使う!<ここが目的>
ノードメモ
イメージから
Image/Raw Imageの情報取得
 MainTex(_MainTex):テクスチャ
 Vertex Color:Color(色)
Ellipse(楕円、円)
 入力:UV, Width, Height
 出力:1次元イメージ
二つの大きさが違うEllipseをSubtractすると
円のラインを描画できる
UGUI:Maskが適用されない
 StencilとZTest関係の設定が必要
 Shader Graphの完成コードをテキストでコピーし、必要なソー
スを追加して別Shaderとして使用する方法が良いらしい。
 How to UGUI ShaderGraph Tutorial! (With Dropdown Mask) –
YouTube
 https://www.youtube.com/watch?v=RxW7_qgkXPo
 だが、ダメっぽい。
 2020.2だからか生成されたコードが複雑すぎる。
ウェブの情報
メモとともに
Unityステーション
 Unity道場2D編 Shader Graph はじめてみよう!実践編(7月13
日号) - Unityステーション
 https://www.youtube.com/watch?v=eJqFLsjPWcY
 #01 カラーの変更
 #02 ブレるような動き
 #03 帯電ぽいやつ
 #04 スキャンライン
 #05 ボーダーライン
詰め込まれている!
 エフェクト作成のために知っておきたいShader Graphの話 -
Unity道場2019 8月
 https://www.youtube.com/watch?v=7ToExWKVZW0
 歪み(屈折)
 https://youtu.be/7ToExWKVZW0?t=1196
 UWPの場合、PipelineのOpaque Textureにチェックを入れ、複数マテリアルで
実現
Custom Function
 自由に記述できる!
 Unity で Shader Graph の Custom Function Node を試してみ
た - 凹みTips (hecomi.com)
 【Unity】C#で定義されたShaderGraphのカスタムノードが使
えない時の対応 – Qiita
 CustomFunctionで独自のノードを実装! - Unity Shader
Graph Advanced Tips – YouTube
 Foo.hlsl として保存
 void BoxFilter_float(Texture2D source, out float4 output)
UGUIで使いたい
 Shader Graphからつくったマテリアルを作成
 _MainTexを参照することでテクスチャ画像を使用可能
 ImageのMaterialに適用する。
勉強素材
 Shader Graph Example Libraryを整理してみる - デコシノニッ
キ (tattichan.work)
 Ice Refraction in Unity Shader Graph [Tutorial] – YouTube
 Glass/Water Refractive Shader in Unity using Shader Graph
(Camera Texture Method) – YouTube
 Grid Shader in Unity LWRP - Shader Graph Tutorial –
YouTube
 https://www.youtube.com/watch?v=JgmIM7qhGh8
勉強素材
 Unity Shader Graph completely explained!
 https://www.youtube.com/watch?v=9aOtie1DKCc
URPに関するメモ
UGUIにBloom等を適用したい
 Canvasの設定をScreen Space – Cameraにすると適用可能
 Cameraの”Post Processing”にチェックを入れておく必要があ
ります。

More Related Content

More from Hiromichi Yamada

UnityでつくるVRアプリ 〜VRの作法とVRTK〜
UnityでつくるVRアプリ 〜VRの作法とVRTK〜UnityでつくるVRアプリ 〜VRの作法とVRTK〜
UnityでつくるVRアプリ 〜VRの作法とVRTK〜
Hiromichi Yamada
 
【地域おこしVR研究会】第1回勉強会「VR業界動向とコンテンツ制作入門」
【地域おこしVR研究会】第1回勉強会「VR業界動向とコンテンツ制作入門」【地域おこしVR研究会】第1回勉強会「VR業界動向とコンテンツ制作入門」
【地域おこしVR研究会】第1回勉強会「VR業界動向とコンテンツ制作入門」
Hiromichi Yamada
 
子どもがOculusダメな理由を調べてみた
子どもがOculusダメな理由を調べてみた子どもがOculusダメな理由を調べてみた
子どもがOculusダメな理由を調べてみた
Hiromichi Yamada
 
Oculus 体験・勉強会「VRコンテンツ制作入門」 2015/05/13
Oculus 体験・勉強会「VRコンテンツ制作入門」 2015/05/13Oculus 体験・勉強会「VRコンテンツ制作入門」 2015/05/13
Oculus 体験・勉強会「VRコンテンツ制作入門」 2015/05/13
Hiromichi Yamada
 
Oculus 体験・勉強会「VRコンテンツ制作入門」
Oculus 体験・勉強会「VRコンテンツ制作入門」Oculus 体験・勉強会「VRコンテンツ制作入門」
Oculus 体験・勉強会「VRコンテンツ制作入門」
Hiromichi Yamada
 
4年前のカメラアプリをSwiftで書きなおした
4年前のカメラアプリをSwiftで書きなおした4年前のカメラアプリをSwiftで書きなおした
4年前のカメラアプリをSwiftで書きなおした
Hiromichi Yamada
 
Words
WordsWords

More from Hiromichi Yamada (7)

UnityでつくるVRアプリ 〜VRの作法とVRTK〜
UnityでつくるVRアプリ 〜VRの作法とVRTK〜UnityでつくるVRアプリ 〜VRの作法とVRTK〜
UnityでつくるVRアプリ 〜VRの作法とVRTK〜
 
【地域おこしVR研究会】第1回勉強会「VR業界動向とコンテンツ制作入門」
【地域おこしVR研究会】第1回勉強会「VR業界動向とコンテンツ制作入門」【地域おこしVR研究会】第1回勉強会「VR業界動向とコンテンツ制作入門」
【地域おこしVR研究会】第1回勉強会「VR業界動向とコンテンツ制作入門」
 
子どもがOculusダメな理由を調べてみた
子どもがOculusダメな理由を調べてみた子どもがOculusダメな理由を調べてみた
子どもがOculusダメな理由を調べてみた
 
Oculus 体験・勉強会「VRコンテンツ制作入門」 2015/05/13
Oculus 体験・勉強会「VRコンテンツ制作入門」 2015/05/13Oculus 体験・勉強会「VRコンテンツ制作入門」 2015/05/13
Oculus 体験・勉強会「VRコンテンツ制作入門」 2015/05/13
 
Oculus 体験・勉強会「VRコンテンツ制作入門」
Oculus 体験・勉強会「VRコンテンツ制作入門」Oculus 体験・勉強会「VRコンテンツ制作入門」
Oculus 体験・勉強会「VRコンテンツ制作入門」
 
4年前のカメラアプリをSwiftで書きなおした
4年前のカメラアプリをSwiftで書きなおした4年前のカメラアプリをSwiftで書きなおした
4年前のカメラアプリをSwiftで書きなおした
 
Words
WordsWords
Words
 

Recently uploaded

APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 

Recently uploaded (20)

APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 

Shader Graphを使う