たれぱんのびぼーろく

わたしの備忘録、生物学とプログラミングが多いかも

HoloToolkitのシェーダーたち

HoloToolkitにはシェーダーも含まれている.
こいつらはなんだ? 解説記事が日英ともに全然ないぞ?
では調べるしかあるまい…

現時点での結論

Fast Configurable shaderを使えばええんでない?
以上.

状況

階層は Utilitiesの下. HoloToolkit-Unity/Assets/HoloToolkit/Utilities/Shaders at master · Microsoft/HoloToolkit-Unity · GitHub

.cginc含めて18ファイル, だが、実質7つのshaders. 他は共通部分を切り出したファイル.
2017-03-01現在、最終更新から1~11ヶ月経ってる. 他のツールより更新頻度は低そう,だが,大事な更新が2017-01にあった.
Wikiには記載なし!
ReadMeにワンラインの記載, こりゃ試す人少ないっすよ…
github.com

注意事項として、自分でpackagingしないと最新のシェーダーが入ってない (GetStarted.MD、1aにある.unitypackageは1月作製とかで割と古い)

シェーダーたち

2017-01に新世代のシェーダーが颯爽と現れた模様.
その経緯.
github.com

新世代シェーダー

  • FastConfigurable.shader

現役世代シェーダー

  • LambertianConfigurable[Transparent].shader
  • StandardFast.shader : Unity Standard Shaderのハイパフォーマンス互換
  • UnlitConfigurable[Transparent].shader
  • UnlitNoDepthTest.shader
  • VertexLitConfigurable[Transparent].shader
  • WindowOcclusion.shader

FastConfigurable.shader

Very fast shader that uses the Unity light system. Compiles down to only performing the operations you’re actually using. Uses material property drawers rather than a custom editor for ease of maintenance.

LambertianConfigurable[Transparent].shader

Feature configurable per-pixel lambertian [transparent] shader. Use when higher quality lighting [and transparency] is desired, but specular highlights are not needed.
ハイクオリティなシェーダー.
ランバート反射?
specular highlightは無し Specular highlight - Wikipedia

StandardFast.shader

Higher performance drop-in replacement for the Unity Standard Shader. Use when very high quality lighting (including reflections) is needed.
Unity Standard Shaderのハイパフォーマンス完全互換(!)シェーダー.
超ハイクオリティなシェーダー.

UnlitConfigurable[Transparent].shader

Feature configurable unlit [transparent] shader. Use when [transparency and] no lighting is[are] desired.
ライティングなし、テクスチャまんまのシェーダー.

UnlitNoDepthTest.shader

Render with a single texture but ignore depth test resuls so object always appears on top.
…?

VertexLitConfigurable[Transparent].shader

Feature configurable vertex lit [transparent] shader. Use when a higher performance but lower precision lighting trade-off is acceptable. [, and transparency is needed.]
ライティング精度を落とす代わりに、パフォーマンス向上、な感じ?

WindowOcclusion.shader

A simple occlusion shader that can be used to hide other objects. This prevents other objects from being rendered by drawing invisible ‘opaque’ pixels to the depth buffer. This shader differs from Occlusion.shader in that it doesn’t have any depth offset, so it should sort as expected with other objects adjacent to the window.

others

HoloToolkitCommon.cginc

Common shader functionality

macro.cginc

Preprocessor macros to support shaders

Unityの光と影

×光と陰 ○光と影 (light & shadow)

グローバルイルミネーションについて

残念ながら Unity のリアルタイムライトから放たれる光は、一度放たれた後は、反射しません。より写実的でリアルなシーンを作成するためには、事前計算によるライティングを有効にして、グローバルイルミネーションなどの技法を使います。
docs.unity3d.com

Unity では、静的で複雑なライティング効果を計算する事ができます(グローバルイルミネーションまたはGIと呼ばれる技法を使います)。計算結果は、ライトマップと呼ばれる参照用テクスチャマップに保存されます。この計算のプロセスをベイク(焼き付け)と言います。
docs.unity3d.com

事前計算されたリアルタイムグローバルイルミネーション
スタティックなライトマップではシーン内でライティングを変化させる事ができませんが、事前計算によるリアルタイムGIは、シーンの複雑なライティングをインタラクティブに更新する方法を提供します。
docs.unity3d.com

単なる直接光ライティングを避ける方法

  • ambient lightでシーン全体をぼんやり明るく
  • lightを複数配置、間接光もどきとして使う

影とプレゼンス

https://pdfs.semanticscholar.org/b283/aa9d0fad4c5536981f381cf1f99364d89b9c.pdf

https://annex.jsap.or.jp/photonics/kogaku/public/37-07-kenkyuronbun.pdf

HoloLens実機での不具合

Unity Editor上だと動くのに、HoloLens実機にデプロイすると動かない!なんじゃこりゃぁ!?
な現象をリストアップした。
見つけても報告等はしてない、forumに投稿した方がええかな…?

sceneが1つしか読み込まれない

最初のsceneが1つしか読み込まれない.
Only one scene is loaded when holographic app is lunched.
sceneの追加読み込みは可能だが、最初の1シーンが可笑しい.
対応策として、最初はstart用の空sceneのみをload, 他のsceneはunload.
1frame後、必要なsceneを読み込み。
これで私は対応してる.

dllが動かない

外部ライブラリは.dll (いわゆるネイティヴ)を利用してることがある.
HoloLensは32bit Windows10だが、一部dllが動かない.
OVRLipSyncはdllをうまく初期化できてなかった

HoloLensでUnityちゃんに歌の口パクしてもらった

HoloLensでキャラクターに口パクさせてみた

歌に合わせた口パクのさせ方

調べる前に私が思っていた素朴なイメージ:
音源に合わせてミクさんの口を引っ張り、パラパラ漫画みたいに編集してく.

技術の進歩は素晴らしいもので…
音源から発音を抜き出す仕組みがあるんです.
そして、発音を基に表情を変える仕組みがあるんです!
つまり、自動で、人と同じように、口パクできるんです!!
技術はすげぇ…

音源に合わせた口パクはLipSync(くちびるの同期)という.
やり方は次のようなものがある。

  • 音楽データから自動lipSync
    • ボーカル音源を基にする
    • フル音源からボーカル部を抽出する
  • 手作業で付加

以下、調べもの中の内容を未整理なので、後でいろいろ整理する.
例の流れ図はそのうち乗せよう

音楽データを基にするには複数の方法がある.

  1. VOCALOID SDK for Unity
  2. OVRLipSync (Unity addon by Oculus)
  3. MMD4Mecanim LipSync Plugin

VOCALOID SKD for Unity
referenceはローカルに落としてある
soysoftware.sakura.ne.jp
lo25131.hatenablog.com
音声データから歌詞を引き出すのはVOCALOID SDKの範囲外っぽい
サンプルコードひっくり返した結果、「音節数カウント」「発音記号引き出し」「母音引き出し」はある。blendShape率の変更はただのスクリプト.
つまり、何らかの形でこの流れに乗せれば、VOCALOID SDKで統一して発音・LipSyncを扱えるはず。
でも見つからない
…VSQXファイル作ってまえばいいんでない?
それか、純然たる音声認識を使ってしまうか(リアルタイム性に問題ありな気しかしないけど、ネイティブなら何とか…?)
qiita.com

OVRLipSync
www.google.co.jp

MMD4Mecanim LipSync Plugin
github.com
tips.hecomi.com

フル音源・インストを利用したvocal extraction
ボーカル音声の抜き出し方 - ニコニコ動画

OVRLipSyncの可能性、そして悲しみ

2017-02-21で私が検証できるとこまでした結果です。将来どうなるか、本当に検証結果が合っているかは怪しいです
OVRLipSyncはHoloLens上で動かない。

Unity上では素晴らしい動きを見せたOVRLipSync氏、HoloLensにデプロイしたとたん、一切のlipSyncをしなくなる.
なんか設定間違えたかなと思い、Debug.Logしようとして気づいた。
HoloLens実機上でログ見えるの…??
どうも見方が分からず、調べたらDebug.Logの結果をUnity GameObject 3DTextに書き出すとの方法が.
無事デバックの準備が整い、さあ調べたら大変.
ネイティブコードの問題があるようでした.

OVRLipSyncはネイティブコード(OS等に強く依存するコード。C++なのかなんなのかは見てない)でコア部分が書いてある.
C#部はそのラッパーおよびUnity用コード, コード読み解けば分かる.
エラーがあるのはあろうことか、ネイティブコードの初期化部分.
具体的には
OVRLipSync.cs L208あたり
sOVRLipSyncInit = ovrLipSyncDll_Initialize(…
このネイティブ初期化関数が失敗してる.
L290あたり、if(IsInitialized()…)
のなかでエラーコードを無理やりDebug.Logで拾ったところ、-2000: Unknowエラーが…
ネイティブ関数は引数が2つ.
samplingRateとbufferSize.
Unityでの起動時、およびHoloLensでの起動時にこの二つをDebug.Log監視したが、異常なし.
これは…HoloLensでまだ叩けない低レベルAPIをネイティブ内部で叩いてる気しか…

私にはここまでがかけられる労力的限界.
だれか…助けてけろ…

ゼブラフィッシュと移動運動の神経メカニズム

終脳

中脳歩行誘発野

中脳歩行運動野(MLR)に関する方向が見つからない…

網様体

1982, RS cellsなどの同定

総排泄孔あたりの脊髄からHRPをいれてbrain stemの細胞を逆行性染色.
Mauthner cellsとか他の色々とか染色.
Brain neurons which project to the spinal cord in young larvae of the zebrafish - Kimmel - 1982 - Journal of Comparative Neurology - Wiley Online Library

脊髄

筋骨系

発生

行動

http://www.cell.com/neuron/abstract/S0896-6273(14)00332-8?_returnURL=http%3A%2F%2Flinkinghub.elsevier.com%2Fretrieve%2Fpii%2FS0896627314003328%3Fshowall%3Dtrue

initiation of locomotion in adult zebrafish. 2011.

脳幹-脊髄標本におけるtransientな刺激が継続した運動様反応を誘起.
http://m.jneurosci.org/content/31/23/8422.full#fn-group-1

Evidence for a Widespread Brain Stem Escape Network in Larval Zebrafish. 2002.

Ca++imagingでescape時のカルシウムを観察. nMLFやRFで広く観察.
Mauthner cellsのみではなく、広く逃避行動ニューロンが分布か?
http://m.jn.physiology.org/content/87/1/608.abstract?ijkey=5cb54d9cc89832827fde2df32ec49b378f332b61&keytype2=tf_ipsecsha%3FlinkType%3DABST&journalCode=jn&resid=87%2F1%2F608

楔状核/cuneiform nucleus

楔状核とは

楔状核(けつじょうかく), cuneiform nucleus/CuN/CuF

DB

brainInfo

BrainInfo

gene expression?

http://amp.pharm.mssm.edu/Harmonizome/gene_set/cuneiform+nucleus,+right/Allen+Brain+Atlas+Adult+Human+Brain+Tissue+Gene+Expression+Profiles

NeuroLex

Cuneiform nucleus - NeuroLex

辞書? brain stem内での場所書いてある

Cuneiform nucleus | definition of cuneiform nucleus by Medical dictionary

marker

optogenetics

論文リスト

CuNと随意運動の関係性否定

www.ncbi.nlm.nih.gov

CuNが大事、とのletter

http://m.brain.oxfordjournals.org/content/136/10/e251

CuNと麻酔の関係、CuNの免染分類

http://www.jneurosci.org/content/20/9/3319.full.pdf

運動を読み取る/フルダイブVR

真のVR/フルダイブ実現には「運動意図の読み取り」が必須だ.
これが実現すれば、現実世界でコントローラーを持たずに、仮想世界で生きることができる.
本記事では、最先端の科学でどこまで「運動(意図)の読み取り」が可能になったか紹介する.

内容

  • アメリカ BrainGate計画
    • 2012 “reach and grasp” Nature
  • 2013 “high-performance neuroprosthetic” LanCet
  • EEG quadcopter

記事を書く私への注意事項

EEGとか細胞外記録とかはあくまで「実現のための技術」である。
なので、それで分類しないように。

intra-Skeltal, human

2015. clinical translation of a high-performance neural prosthesis.

decoding法の改良による radial-8課題とcircle-tracking課題の成績向上
decoding: ReFIT-KF/recalibrated feedback intention–trained Kalman filter
“A high-performance neural prosthesis enabled by control algorithm design"にNHPでのReFIT-KF結果.
サプリに素晴らしい説明がついている雰囲気.
http://www.nature.com/neuro/journal/v15/n12/full/nn.3265.html
http://web.b.ebscohost.com.ez.wul.waseda.ac.jp/ehost/detail/detail?sid=ebe4409e-9da1-4b2b-96a0-cf01b807edf5%40sessionmgr112&vid=0&hid=128&bdata=Jmxhbmc9amEmc2l0ZT1laG9zdC1saXZl#AN=83621663&db=pbh
VKFのヒト結果は
"Neural control of cursor trajectory and click by a human with tetraplegia 1000 days after implant of an intracortical microelectrode array"に
http://iopscience.iop.org.ez.wul.waseda.ac.jp/article/10.1088/1741-2560/8/2/025027/meta;jsessionid=0969B6C05BA1E5F3987180155626F016.c3.iopscience.cld.iop.org#jne364722s2

VKFについて
“Point-and-Click Cursor Control With an Intracortical Neural Interface System by Humans With Tetraplegia"に http://ieeexplore.ieee.org.ez.wul.waseda.ac.jp/xpls/icp.jsp?arnumber=5703131
ただしこの論文はVKF+clickの論文

VKF自体については
Neural control of computer cursor velocity by decoding motor cortical spiking activity in humans with tetraplegia
http://iopscience.iop.org/article/10.1088/1741-2560/5/4/010/meta

posterior parietal cortex(PPC)からの信号がBMIに使えることのPoC

  1. . decoding motor imagery from the posterior parietal cortex of a tetraplegic human.
    http://www.sciencemag.org/content/348/6237/906.abstract

高いDoF

  1. . high-performance neuroprosthetic control by an individual with tetraplegia.
    DoFが7
    http://www.thelancet.com/journals/lancet/article/PIIS0140-6736(12)61816-9/fulltext

  2. . an electrocorticographic brain interface in an individual with tetraplegia.
    http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0055344
    ECoG-BMIは手術中の簡易な評価で行われてきた?が、きちんと評価してみよう、とのことみたい?

かの有名な

  1. . reach and grasp by people with tetraplegia using a neurally controlled robotic arm.
    http://www.nature.com/nature/journal/v485/n7398/full/nature11076.html
    BrainGate2臨床研究の一部だったはず。

  2. . neuronal ensemble control of prosthetic devices by a human with tetraplegia.
    http://www.nature.com/nature/journal/v442/n7099/abs/nature04970.html
    The participant described in this report, the first in the BrainGate trial, …
    BrainGate臨床研究の第1報告と思われる。

  3. . Direct Control of a Computer from the Human Central Nervous System.
    http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=847815&url=http%3A%2F%2Fieeexplore.ieee.org%2Fiel5%2F86%2F18398%2F00847815

  4. . Restoration of neural output from a paralyzed patient by a direct brain connection.
    https://www.researchgate.net/publication/13618522_Kennedy_P_R_Bakay_R_A_Restoration_of_neural_output_from_a_paralyzed_patient_by_a_direct_brain_connection_Neuroreport_9_1707-1711