Jewel Renderer Manual

Jewel Renderer Manual 

 

Store URL :

https://www.assetstore.unity3d.com/#!/content/110586

 

Support :

mail : nkdtr2011@gmail.com

 

What's New

2018/3/6

Version 1.02 released

- Added option to capture cubemap.

 

2018/3/1

Version 1.01 released

- Added optimization option "MergeSimilarPlanes"

 

What is this?

youtu.be

Jewel Renderer simulates reflection of ray inside convex bodies.

Good for rendering transparent objects, especially gems.

  • No texture required
  • Rich-looking rendering result using simple mesh
  • Runs on Windows/Mac/iOS/Android
    (although it is heavy for mobiles to render widely)

 

Quick start

youtu.be

  1. Put "Jewel" prefab onto your scene
  2. Set your mesh in MeshFilter component
  3. Modify properties (see reference page for details)
  4. Component menu -> "Setup"

Caution : 

Setting background cubemap by Drag&Drop (as done in the movie) seems to be invalid in Unity2018 and later.

Following operation is available instead.

- duplicate "skybox01" material in the package

- set "Cubemap" parameter of the material

- Drag&Drop it into your scene

The movie will be replaced.

 

Sample scenes

Showcase

Sample jewels.

youtu.be

Parameters

Shows how the rendering result changes by parameters.

youtu.be

 

Reference

nkdtr.hatenablog.com

 

Limitations

Recommended:

  • Only convex shapes are fully supported.
    Although you can input non-convex one, the result will be incorrect.
  • Vertices should not be shared by multiple triangles.
    ("Edged," "flat-surfaced" model)
  • Origin (0,0,0) of mesh should be inside the shape.
  • Skyboxes should not include Mip-maps.
    Uncheck "Generate Mip Maps" in the texture's property grid and "Apply".

Performance:

  • Requires considerable GPU cycles, depending on reflection count (configurable) and number of rendered pixels, number of triangles in the mesh and "prism" option.
    To render in best quality, high-spec PC will be required.

 

 

Jewel Renderer Manual - Reference -

Jewel Renderer Manual - Reference -

 

Properties

Color

Internal color of the material.

This color is multiplied to the light color, with power incluenced by the distance it has proceeded through in the jewel.

Alpha element corresponds to the density.

Alpha=0 means it is clear and colorless.

 

MaxReflectionCount

Maximum number that light can reflect in the jewel.

Valid number for this property is 1 to 20.

 

Environment

Cubemap texture to sample reflection/refraction color from.

 

Refractive Index

Refractive index of the jewel body.

 

Base Reflection

Reflection rate for vertically incoming light.

 

Prism

If checked, light is separated into R, G and B with different refraction indices.

Costs almost x3 GPU cycles.

 

MergeSimilarPlanes (ver 1.01~)

If checked, triangles on the same plane are processed at once (faster).

 

AutoCaptureEnvironment (ver1.02~)

If checked, environment cubemap is captured every frame.

This is high-cost process depending on capture resolution.

Capture resolution is set by property "CaptureEnvironmentSize."

 

 

CaptureEnvironmentOnSetup (ver1.02~)

If checked, environemnt cubemap is captured on "Setup."

By this, you don't need to prepare Cubemap as an asset.

Capture resolution is set by property "CaptureEnvironmentSize."

 

CaptureEnvironmentSize (ver1.02~)

Resolution of captured environment.

Power of 2 is said to be good.

Lower resolution makes capturing quicker.

 

Functions

Setup()

Setup material reflecting each properties.

This function is exposed to the context menu : 

click component's gear button->"Setup" to invoke.

 

ApplyNumericParameters()

Apply numeric parameters on the material.

If mesh (in MeshFilter component) or prism property,

you should use "Setup()" instead.

This function is exposed to the context menu : 

click component's gear button->"ApplyNumericParameters" to invoke.

 

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を実行することでメッシュを更新できますが、簡単ではありません(可視化などのツールサポートを実装していません)。