はじめに esprog.hatenablog.com 上記の記事で行っているように、動的にUVを算出してその部分にエフェクトを掛ける場合などでは あるワールド座標上の点pがシーン内に配置されたモデルの表面上の点であるかどうか調べる モデル表面上の点である場合は、$p$のUVを計算する といった処理が必要になります。 Unityの場合Physics.*cast系メソッドの出力用パラメータにRaycastHit構造体を渡すことでTextureCoordを得ることが出来ます。 このTextureCoordの算出はCalculateRaycastTexCoordという関数呼び出しによって実現されているようですが、INTERNAL_CALLとなっていて詳細までは見ることが出来ませんでした。 3Dテクスチャペイントを行ったりするのに必要な知識だと思い、後学のために自作してみましたよというのが今回のエン
The galaxy and clouds in our game - Lotus Star In our upcoming game, Lotus Star, we wanted our otherwise two-dimensional game mechanic to live in a 3D environment, and we wanted the player to move through space, to give a sense of scale and... wowness , to our game. We spent a great deal of time trying out different techniques to achieve this, and we ended up with a pretty cool one we haven't see
概要 まず, 「ゲーム向けの標準的な物理ベースシェーディング(PBS)の実運用時の良し悪し」については実際に手を動かしているゲーム開発者(プログラマ, アーティスト)なら既にわかっているかと思います. 一方で Twitter のタイムラインを見ていたときに, ゲーム向けの標準的な物理ベースシェーディング(PBS)について「物理的に正しい」と勘違いしている人がいそうということがわかりました. そういうのは普段だったら面倒なので適当にスルーしているのですが(汗), たまたまゲーム業界に影響力がありそうな人が言っていて「これはあんまり良くないなぁ...」と思いました. あと 「物理的に正しい」という言い方だと, 妙に「万能で制限がないようなイメージ」もあるかと思います. ( その抽象的な言葉で思考が停止することがあるのも良くないと思っています. ) ということで, ちょっとここに個人的な意見を書
2017年5月9日,都内で開催されている「Unite 2017 Tokyo」で,ユニティ・テクノロジーズ・ジャパンのコミュニティエバンジェリスト小林信行氏による「Unityで楽しむノンフォトリアルな絵づくり講座:トゥーンシェーダー・マニアックス」と題した講演が行われた。 ゲームで3Dグラフィックスを扱うにも表現方法はさまざまだ。海外の最新ゲームのようにリアルタイム処理でひたすらフォトリアリスティックな表示を追い求める方向もある一方で,まったく写真調でない絵柄,つまりノンフォトリアリスティック(NPR)でのレンダリングもゲームでは多用されている。いわゆるアニメ調のキャラクターが登場するような作品だ。世界的にはさほど人気があるとは言えないのだが,こと日本国内ではフォトリアルよりも好まれる傾向にある。 そこで用いられる,一般にセルシェーディングやトゥーンシェーディングなどと呼ばれる描画法は,基礎
はじめに こんばんは、代表の堂前です! Unityも5.4系がリリースされてしばらく経ち、最近は5.5ベータも出てきました。 そんな折「Unity 5.4 & 5.5 新機能キャッチアップ講座」を読んでいまして、その中で自分が気になったところ(主に描画系)を深く掘り下げていくのを数回に分けて行っていこうと思います。 ※検証したのはMacのUnity5.4.1系になります。 ※推定事項も含まれますので、その点ご了承下さい。 Motion Vectors 今回は「Motion Vectors」について取り上げます。 主にブラー系の用途で使われるもので、Mesh Renderer等に該当する項目が含まれるようになりました。 (5.5系では項目種類が増えますが、今回は5.4系で話を進めます。) ここにチェックを入れると、ベロシティマップ(ピクセルごとの移動量)にそのメッシュの分を書き込むようにな
実践編第2弾「水流を作ってみる」。 以前、某案件で地下浸水を作り、 押し寄せる水流をディスプレイスと屈折を組み合わせて表現したので、 それを解説していきたいと思います。 モデルの準備 こんな感じの場所に、こんな感じで水を流してみます。 屈折 まずは、屈折表現から入れていきます。 詳しくは、以前の記事に描いてありますので、そちらを御覧ください。 今回はこんなテクスチャを用意しました。大小2つの押し寄せる波です。 この後ディスプレイスも加える予定なので、タイリングを合わせる為に、 テクスチャスロットの Scale & Offset ではなく、 別のプロパティ(_WaveTiling)を用意してタイリングさせます。 これだけだとまだ良く分かりませんね。 ディスプレイス 次に、同じ形状のハイトマップを用意してディスプレイスさせましょう。 屈折用のテクスチャと同じ要領でハイトマップを展開します。 ハ
はてなグループの終了日を2020年1月31日(金)に決定しました 以下のエントリの通り、今年末を目処にはてなグループを終了予定である旨をお知らせしておりました。 2019年末を目処に、はてなグループの提供を終了する予定です - はてなグループ日記 このたび、正式に終了日を決定いたしましたので、以下の通りご確認ください。 終了日: 2020年1月31日(金) エクスポート希望申請期限:2020年1月31日(金) 終了日以降は、はてなグループの閲覧および投稿は行えません。日記のエクスポートが必要な方は以下の記事にしたがって手続きをしてください。 はてなグループに投稿された日記データのエクスポートについて - はてなグループ日記 ご利用のみなさまにはご迷惑をおかけいたしますが、どうぞよろしくお願いいたします。 2020-06-25 追記 はてなグループ日記のエクスポートデータは2020年2月28
このプログラムは、面上を伝わる波を、単純な力学アルゴリズムと数値積分法によって計算し、その結果をリアルタイムでアニメーション表示するVCSSLプログラムです。 なお、このプログラムは以下のプログラムの応用編です。先にそちらの方からお読みいただくと、内容がスムーズに把握できるかもしれません。 [力学演算] 力学アルゴリズムによる波のシミュレーション(線上の波) [描画処理] 頂点配列によるモデルの変形アニメーション [モデリング] 頂点配列によるモデルの作成(四角形格子メッシュ形式) 使用方法 ダウンロードと展開(解凍) まず、PC(スマホは未対応)で上の画面の「 ダウンロード 」ボタンを押してください。 するとZIP形式で圧縮されたファイルがダウンロードされます。 Windows をご使用の方は、ここでまずZIPファイルを右クリックし、「プロパティ」を選んで開かれる画面で、 下の方にあるセ
最近色々忙しくて全然更新できていませんでしたが、 ちょうどいいネタを思いついたのと、アドカレが期限超過で1枠空いてたので代わりに投下します。 実装に丸1日、記事書くのに1日くらいかかりました。 目次 表面下散乱(Subsurface Scattering)とは? SSSで出来ること 実装に際しての考え方 実装方法:ランバート反射 実装方法:ハーフランバート 実装方法:曲率を考慮したシェーダ 実装方法:テクスチャ空間での拡散(Texture Space Diffusion:TSD) 実装方法:スクリーン空間での拡散(Screen Space Subsurface Scattering:SSSS) 実装方法:Translucent Shadow Maps:TSM 頂点空間表面下散乱(VSSS:Vertex Space Subsurface Scattering) 実装手順 結果 まとめ 参考
シェーダ書きたくてしょうがないマン! GLSL で暖を取りたいみなさまこんばんは。🔥🔥🔥 世の中にはたくさんの シェーダ書きたくてしょうがないマン が居るはずなんですが、身分を明かすことにより悪の組織から生命を狙われる可能性がある彼らはおいそれと Advent Calendar に投稿することもままなりません。悲しいですね。 そこで、一般市民として平々凡々に生活している私が代わりに、GLSL で世の中の GPU の温度を一度でも温められるようにがんばらなくてはと一念発起いたしました。 GLSL ワークショップ 先日、GLSL のワークショップを開催しました。そこではたくさんのシェーダ作品が投稿され、まさに 隠れシェーダ書きたくてしょうがないマン や、有望な 新人シェーダ書きたくてしょうがないマン を発掘することができました。ありがとうございました。 そんなワークショップで私が投稿した
基本的にどのような開発環境であってもシェーダはシェーダ専用の言語を用いて開発します。 特に Unity のシェーダを開発するときは、ShaderLab と呼ばれる Unity 独自の言語仕様と、 それ以外の言語とを組み合わせることになります。 ShaderLab Cg / HLSL / GLSL 学習のためには既存のコードを読み書きする 書籍 その他の資料 開発環境 シェーダのソースコードハイライタ シェーダのデバッグ ShaderLab Unity でデフォルトのシェーダを新規に追加したとき、必ずこの形式で記述された shader ファイルが生成されます。 Shader Lab のソースコードは実際には次のようなものです。 Shader "MyShader" { Properties { _MyTexture ("My Texture", 2D) = "white" { } … } Su
公式の説明が全く意味不明だったのでメモ Unity - Manual: Rendering with Replaced Shaders カメラに映る全体を単一シェーダで描画したい場合は呼び出すだけ。 camera.SetReplacementShader (shader, null); 問題は特定のシェーダの場合のみ描画したい場合。 第2引数にカスタムタグの「キー」を指定すると、差し替えるシェーダに指定されているタグと対象にセットされているシェーダに指定されているカスタムタグの「値」が一致していた場合描画される。 ここを理解するのに時間がかかりました… shadowcamera.cs camera.SetReplacementShader (shadow, "Shadow"); shadow.shader Tags { "RenderType"="Opaque" "Queue"="Geom
はじめに 普通の書き方をする上で、よく使うことについてメモします。 随時追記予定 事前知識 ShaderLabの概要 ShaderLab は、Cgを用いたUnity独自のShader文法。マテリアルに .shader ファイルを登録します。 突然自作の前に、まずはビルトインのものから ビルトインシェーダの使い方 http://docs-jp.unity3d.com/Documentation/Components/Built-inShaderGuide.html Unityビルトインシェーダ(Diffuseとか)のコードが公開されています。実はかなりの物がSurface Shaderの形式で書かれているので、これを使って勉強すると効率よさそう Unity - Download Archive 基本的な構文 まずはここから Unity公式シェーダリファレンス日本語訳 http://docs-
はじめに ブーリアン演算とは様々な形状を集合演算(足し合わせる(和)、一方から他方を引く(差)、一致する部分を抜き出す(積)など)によって作成する手法です。 ブーリアン演算 - Wikipedia Constructive Solid Geometry - Wikipedia いくつかの実装方法があると思いますが、スクリーンスペースで G-Buffer を加工することでこれを実現する Unity での実装を id:i-saint さんが作られており、実装も公開されていました。 playing with Unity 5's deferred shading pipeline - primitive: blog GitHub - i-saint/Unity5Effects G-Buffer 加工による利点は 3D ソフトなどで見られるメッシュ自体の変形に比べ、多数のオブジェクトを組合せ爆発しな
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く