Kaleidoscope 2D/3D マニュアル

f:id:nkdtr:20170203133811p:plain

 

Kaleidoscope 2D/3D マニュアル

バージョン情報

1.05

- バグ修正:ハンドルを用いて変更した情報が保存されない

1.04

- 機能追加:テクスチャ出力

- 機能追加:テクスチャオフセット

1.03

- 機能追加:テクスチャ自動スクロール

1.02

- 誤植修正

1.01

- 初期版リリース

 

サンプル動画

 

youtu.be

 

機能リスト

  • 3面の鏡による反射を計算し、万華鏡をシミュレートします
  • 2D/3Dバージョンがあります
  • コンフィグ可能
    - 反射ごとの明るさ減衰率
    - 鏡の配置(3角形の頂点を指定)
    - テクスチャパターン
      -- RenderTextureも使えます
  • PNG出力(

    https://youtu.be/FI3xuAeAnws

    )

 

ストア 

Asset Store

 

使い方

-2D

youtu.be

  • KaleidoscopeQuad をシーンに配置します
  • ハンドルを使って三角形の形状を調整します
  • テクスチャを差し替えます

-3D

youtu.be

  • Kaleidoscope3D をシーンに配置します
  • ハンドルを使って三角形の形状を調整します
  • テクスチャを差し替えます

 

API

メソッド

SetTexture(Texture)

-テクスチャを差し替えます

 

ApplyTriangleToParam

-変更したプロパティをマテリアルに反映させます

-実行時にプロパティを変動させる場合に使用します

 

プロパティ

Reflectance

-鏡面の反射率 ([0.0 1.0]の範囲を想定)

-反射ごとにピクセルの明るさに乗算されます

  1.0より小さい値のとき、周辺部に行くほど暗く表示されることになります。

 

TextureScroll (ver 1.03 ~)

-自動的にテクスチャをスクロールします。

 単純なパターンからアニメーションが生成されます。

 

TextureOffset (ver 1.04 ~)

-TextureScrollに似ていますが、こちらは自動的にはスクロールしません。

-スクロールの速度、向きを動的に制御したい場合はこちらを使用してください。

 

OutputDirectory (ver 1.04 ~)

OutputFileNameBase

-テクスチャ出力に用いるディレクトリ及びファイル名のベースです。

 実際の出力時にはファイル名に番号が付加されます。 

 

 

 

 

Kaleidoscope 2D/3D Manual

f:id:nkdtr:20170203133811p:plain

 

Kaleidoscope 2D/3D Manual

Updates

1.05

- bugfix : triangle modification not saved if it was done by handles

1.04

- new feature : texture baking

- new feature : texture offset

1.03

- new feature : texture scroll

1.02

- fixed typo

1.01

- released

 

Sample Video

 

youtu.be

 

Features

  • Simulates kaleidoscope with 3 mirrors via simple optical calculation
  • 2D / 3D versions available
  • Configurable
    - Attenuation rate per reflection
    - Layout of mirrors (vertices of the triangle constructed by mirrors)
    - Source texture pattern
      -- Also Nice with RenderTextures
  • Exporting as png image file(

    https://youtu.be/FI3xuAeAnws

    )

Store 

Asset Store

 

How to Use

-2D

youtu.be

  • Place KaleidoscopeQuad prefab on your scene
  • Modify the shape of triangle by the position handle (consists of three-arrows)
  • Replace the texture of the material

-3D

youtu.be

  • Place Kaleidoscope3D prefab on your scene
  • Modify the shape of triangle by the position handle
  • Replace the texture of the material

 

APIs

Methods

SetTexture(Texture)

-Replaces the texture to sample from

 

ApplyTriangleToParam

-Updates material parameter by triangle modified in editor

-Used for applying dynamically modified properties

 

Properties

Reflectance

-Reflectance of mirrors (expecting value in range of [0.0 1.0])

-This value is multiplied on the sampled color at every reflection.

  So the edge part of resulting material will be darker than center if reflectance is less than 1.0.

 

TextureScroll (ver 1.03 ~)

-Automatically scrolls the texture, changing simple pattern into complex animation.

 

TextureOffset (ver 1.04 ~)

-Similar to TextureScroll, but this doesn't cause automatic scroll.

-Better if you want to control the scroll speed dynamically.

 

OutputDirectory (ver 1.04 ~)

OutputFileNameBase

-For texture baking; defining the name and directory of created image file. 

 

 

 

 

おすすめコンテンツ

とくにYoutubeへは有象無象をUPしているので、

おすすめコンテンツをここでまとめておきます。

 

Unityアセット「SkinnedMetaballBuilder」(宣伝)

メタボールっぽいものを扱うアセットです

http://u3d.as/gAE(ストア)

http://nkdtr.hatenablog.com/entry/2015/06/11/000322(マニュアル)

・掘れる壁のデモ(アセット内に同梱)

youtu.be

・エディタでマップ生成

www.youtube.com

 

Portal

わりと有名なゲームの真似事。

ワープ先の映像が見えており、視界が連続したままワープできる仕掛けです。

qiita.com

動画(Unity)

youtu.be

動画(UE4)

youtu.be

 

MarchingCubesによる曲面、武器の軌跡のスカラー場への作用(UE4)

毎フレームLineTraceするような方法ではきれいに切れないので、

フレーム間の軌跡を扇形と見なしてその領域を削り取ります。

youtu.be

 

シェーダー、RenderTextureを用いた波紋(Unity)

波動方程式を解いているだけですが、

実装方法に面白みがあると思います。

qiita.com

youtu.be

 

マウスの軌跡をメッシュ化

下の二つの記事の内容を使っています。

qiita.com

・今では公式にProceduralMeshComponentが実装され(Experimental)不要に。。。

qiita.com

連続した座標をつないでパイプ状のメッシュを作ります。

時間差で相似形を追加し枝分かれしたように見せています。

youtu.be

 

レイマーチング法

Unityでやっている人がいたので、UE4でやってみました。

今ではVolumeDecalsが公式に実装され不要に。。。

qiita.com

youtu.be

・金色の螺旋はこういうメッシュが存在するわけではなく、カメラの前に置かれた板にマテリアルで描かれています。

 

UE4マテリアル入門記事

PBRとかフォトリアルとかは他の人に聞いてください。

エフェクトとしてのマテリアルのための記事です。

qiita.com

qiita.com

qiita.com

qiita.com

qiita.com

 

ツイッター遊び

ツイッターAPIを使ってみる遊び(Unity)

軌道に特に意味はなく単に遊び心です。

www.youtube.com

 

UE4ぷちコン

第三回

youtu.be

第四回

youtu.be

第4回UE4ぷちコン 投稿作品について

 

f:id:nkdtr:20151008200603p:plain

 

↓これに「REFLEKT」というタイトルの縦スクロールシューティングゲームを作って投稿しました。

historia.co.jp

 

概要

シューティングゲームです。

パワーアップとかはありません。

ライフ制、一回死ぬか全2ステージクリアでゲームオーバーです。

 

プレイヤー、エネミー共に兵器は射程無限の光速ビームのみ

 

3種類の特殊操作
 ・ビーム強化:そのまま。でも無策に使うと死を招く
 ・壁の鏡面化:壁を鏡面化しビームを反射させる。無策に使うと死を招く
 ・敵の捕獲:近隣の敵を捕獲して盾とする。ビームを射つ敵は武器にもなる。捕獲した敵に気を取られて死にやすい

 

[BGM] 魔王魂 様(http://maoudamashii.jokersounds.com/)
[SE] 効果音ラボ 様(http://maoudamashii.jokersounds.com/)

 

動画

youtu.be

 

実行ファイル(Win64ゲームパッド推奨(キーボードにも対応))

及びプロジェクト(音素材抜き)

https://drive.google.com/folderview?id=0B_cqTvJRhk3fNzR5ekpqV3hrTHM&usp=sharing

 

 

反射

テーマが「反射」であったのでそれに見合った要素を組み込んでいます。

難しいことではありませんが、工夫した部分ではあるので軽く説明しておきます。

 

1.ビームの反射

f:id:nkdtr:20151008194500p:plain

毎フレーム発射地点からLineTraceを用いて衝突判定を行い、対象が反射素材のときMirrorVectorを用いて方向を転換、衝突地点から再度LineTraceを行うことで繰り返し反射するのを表現しています。

衝突対象にエフェクトを表示したりダメージを与えたりの処理もここで行います。

 

参考:

Beam(BlueprintClass) のTrace及びTraceSegment関数

 

2.ゲームシーンの鏡像表示

f:id:nkdtr:20151008194709p:plain

壁を鏡面化しているとき、シーンカラーが反転するとともに左右に鏡像が表示されます。

SceneCapture2Dでゲームをいったんテクスチャに書き込み、それをマテリアルで左右反転して板に張り付けることで実現しています。

要するに、実際のシーンには直方体がぴったりくっついて三つ並んでいる形です。

色の反転もついでに行います(反転する/しない はパラメータで変更)。

 

参考:

MainScenePanelMirrored(Material)

 

感想

 ・欲しい絵はできたのでおおむね満足

・はじめてシューティングゲームを作った。ゲームらしいものを作るのも楽しい

・でも次があったらゲーム性は捨てて変なもん作る

Skinned Metaball Builder -インクリメンタルモード-

Skinned Metaball Builder Manual -インクリメンタルモード-

 

"Incremental Modeling" Prefabが ver.1.10 で追加されました.

 

FEATURES

-スキニングなし

-配置したプリミティブを動かすことはできません

-プリミティブ数が増えることによるパフォーマンスへの影響は比較的軽微です

-Sphere/Box二種類のプリミティブが使用できます

-プリミティブのスケール/回転に対応しています

-このモードを使用したゲームライクなサンプルシーン"dungeon2"が追加されています

 https://youtu.be/ZhvNbr7iI7Y

  

 

QUICK START

youtu.be

-"Metaball/Prefabs/IncrementalModeling" prefab をシーンへ配置します

-配置した "IncrementalModeling" の下にある Sphere/BoxBrush を選択します

-選択したBrushの位置や形状を調整します

-"Shift"+"Ctrl/Command"+"E" を押すとプリミティブが配置されメッシュに反映されます

 

Commands

コンポーネントを右クリックすることでコマンドを表示・実行できます。

 

Rebuild : 

 Historyに従ってメッシュを再生成します。

この際、”FixedBounds" や "GridSize"プロパティが再適用されます。

形状が再現されるためには、Historyが完全に残っている必要があります。

 

Clear History:

 Historyを消去します。

Meshはそのまま残ります。

Meshもクリアしたい場合は、つづけてRebuildを実行してください。

 

Properties

ほとんどのプロパティは以前からあるStatic/SkinnedMetaballSeedと同等です。 そちらのリファレンスを参照してください。(http://nkdtr.hatenablog.com/entry/2015/06/10/234607)

以下のものはIncrementalModelingに特有です。

 

Save Brush History :

 "Rebuild"で使用されるHistoryを保存するかどうかを指定します。

 

Brush History :

 保存されたHistoryです。

これを直接編集しRebuildを実行することでメッシュを更新できますが、簡単ではありません(可視化などのツールサポートを実装していません)。

Skinned Metaball Builder Manual -Incremental Mode-

Skinned Metaball Builder Manual -Incremental Mode-

 

"Incremental Modeling" prefab has been added in version 1.10.

 

FEATURES

-NO SKINNING

-Node cannot be moved after placed

-Smaller impact on performance by adding metaball primitives

-Sphere and box primitives available

-Scale and Rotation can- be applied on primitives

-New game-like sample scene "dungeon2" added

 https://youtu.be/ZhvNbr7iI7Y

  

 

QUICK START

youtu.be

-Place "Metaball/Prefabs/IncrementalModeling" prefab on hierarchy

-Select Sphere/BoxBrush under "IncrementalModeling" instance created.

-Modify the position and the shape of the brush

-"Shift"+"Ctrl/Command"+"E" to place the primitive

 

Commands

Right click the component to show and execute commands.

 

Rebuild : 

 Rebuild the mesh by history.

Current "Fixed bounds", "Grid size" are applied correctly.

"Brush History" is required to do this.

 

Clear History:

 Clear current brush history.

Mesh is kept.

If you want your mesh to be cleared also,

do "Rebuild" after this.

 

Properties

Most of the properties are similar to previous Static/Skinned Metaball Seeds,

please refer (http://nkdtr.hatenablog.com/entry/2015/06/05/123458)

Ones below are specific to IncrementalModeling component.

 

Save Brush History :

 Decides save the history that is required to do "Rebuild".

 

Brush History :

 Saved history.

You can modify the history via this property, and do rebuild to apply the modification.

But its not so easy (there is no special tool support(like visualization) for this).

まんが保管庫

まんが保管庫

ユニティちゃんときまぐれお勉強タイム

このコンテンツは、『ユニティちゃんライセンス』で提供されています。

 

ベクトル等の基礎知識について、

個人的に思うツボ的なところを解説していくつもりです。

よく分からないけど何となく使ってる人の助けになればと思います。

 

いちから説明する教科書とは違います。

読んでて詰まる人は数学の教科書から。

 

#1 基底ベクトルと座標系

f:id:nkdtr:20150824231637p:plain

f:id:nkdtr:20150824231722p:plain

f:id:nkdtr:20150824231749p:plain

 

#2 座標と座標系

f:id:nkdtr:20150824233640p:plain

f:id:nkdtr:20150824233654p:plain

f:id:nkdtr:20150824233707p:plain

 

#3 ドット積・射影

f:id:nkdtr:20150824233726p:plain

f:id:nkdtr:20150824233944p:plain

f:id:nkdtr:20150824233959p:plain