カメラ

公式サイト:

カメラ | Unity マニュアル [公式]

概要

参考:

カメラ | Unity マニュアル [公式]

使い方

参考:

カメラについて | Uinty 使い方ガイド

カメラの使い方を理解しよう! | XR-Hub

カメラの基本設定を理解しよう! | XR-Hub

設定

  • Clear Flags
    • Skybox
    • Solid Color
    • Depth only
    • Don’t Clear
  • Background
  • Culling Mask
  • Projection
    • Perspective
    • Orthographic
  • Size
  • Field of View
  • Physical Camera
  • Clipping Planes
    • Near
    • Far
  • Viewport Rect
    • X
    • Y
    • W
    • H
  • Depth
  • Rendering Path
    • Use Graphics Settings
    • Forward
    • Deferred
    • Legacy Vertex Lit
    • Legacy Deferred (light prepass)
  • Target Texture
  • Occlusion Culling
  • Allow HDR
  • Allow MSAA
  • Allow Dynamic Resolution
  • Target Display

参考:

リアルなレンダリングをする場合のチェック項目 | Shade3D チュートリアル

カメラ | Unity 2020.3 マニュアル [公式]

マウスで操作する

コード:

CameraController.cs  – GitHub Gist

シーンビューの視点位置にカメラを配置する

Ctrl + Shift + Fシーンビューに整列させる (Align with View)

動画:

Ctrl Shift F to Match the Camera to the Scene View

参考:

シーンビューカメラの位置に Camera を移動する | いんでぃーづ

カメラを選択した状態で Ctrl + Shift + F を押すと Scene ビューと Game ビューのカメラを同期できる | コガネブログ

これは便利!カメラの位置をシーンビューの視点と一致させる方法 | おもちゃラボ

Unity ホットキー | Unity 2018.4 マニュアル [公式]

背景

参考:

Camera.backgroundColor | Unity スクリプトリファレンス [公式]

描画順 (Depth)

カメラのレンダリング順序を指定する。

参考:

Camera.depth | Unity スクリプトリファレンス [公式]

How do I force my cameras to render in a certain order? | Unity Support [Official]

camera order | Unity Forum

Camera Rendering Order | Unity Forum

Problems with camera rendering order | Unity Forum

焦点距離/画角 (FOV)

  • Field of View画角 (デフォルト60/単位度)

参考:

Unity と FOV 設定 | トマシープが学ぶ

投影方法 (Projection)

  • 透視投影 (Perspective)
  • 平行投影 (Orthographic)
こちらのページを参照

参考:

投影法 | WisdomSoft

透視投影と平行投影を合成するには | Mtk’s Blog

Camera.orthographic | Unity スクリプトリファレンス [公式]

物理カメラ (Physical Camera)

  • Focal Length焦点距離 (デフォルト50/単位mm)
  • Sensor Type / Sensor Size (単位mm)
    • 8mm (4.8 × 3.5)
    • Super 8mm (5.79 × 4.01)
    • 16mm (10.26 × 7.49)
    • Super 16mm (12.52 × 7.41)
    • 32mm 2-perf (21.95 × 9.35)
    • 35mm Academy (21 × 15.2)
    • Super-35 (24.89 × 18.66)
    • 65mm ALEXA (54.12 × 25.59)
    • 70mm (70 × 51)
    • 70mm IMAX (70.41 × 52.63)
    • Custom (デフォルト36 × 24)
  • Lens Shift
  • Gate Fit
    • Vertical解像度ゲートをフィルムゲートの高さに合わせる
    • Horizontal解像度ゲートをフィルムゲートの幅に合わせる (デフォルト)
    • Fill解像度ゲートをフィルムゲートの高さあるいは幅のいずれか小さい方に合わせる
    • Overscan解像度ゲートをフィルムゲートの高さあるいは幅のいずれか大きい方に合わせる
    • None解像度ゲートを無視して、フィルムゲートのみを使用する。アスペクト比を保つことなく、レンダリング画像をゲームビューの大きさに合わせて縦横拡大する。

参考:

Unity 2018.2 で追加された Physical Camera とはナンゾや? | テラシュールブログ

物理カメラの使用 | Unity マニュアル [公式]

カメラを切り替える

参考:

カメラの切り替えをスクリプトで実現しよう! | XR-Hub

Unity でカメラをスクリプトから切り替えられるようにする | かめくめ

主観カメラへの切り替えと、プレイヤーの移動方法について | TECH Projin

Unity でカメラ切り替えをするスクリプトを書いたよ/5つのカメラを数字キーで切り替え | 神部まゆみのブログ

カメラの切り替えの実装/実装パターン3つ紹介 | dasuko の技術ブログ

複数のカメラを切り替えたり画面を分割したりする方法 | Uinty 使い方ガイド

カメラの表示を切り替える方法 | もぎブログ

複数のカメラを使用する | Unity マニュアル [公式]

スクリプトで操作する

参考:

プレイヤーにカメラを追従させよう! | XR-Hub

スクリプトから Main Camera を取得するのは簡単だよ | TECH Projin

VR カメラを任意のポジションに移動する方法 – Qiita

スクリプトから MainCamera の Position、Rotation の変更 | kyam 研の忘備録

Unity の Camera 使い方とスクリプト | ゲームの作り方!(dkrevel.com)

UnityEngine.Camera | Unity スクリプトリファレンス [公式]

How to arbitrarily set camera position in world coordinates – Unity Forum

How to get the position of the Main Camera – Unity Answers

camera position in UNITY – Stack Overflow

カリングマスク (Culling Mask)

こちらのページを参照

動画:

Using Camera Culling Mask to Not Render Specific Layers

参考:

Camera の Culliing Mask 設定 – Qiita

特定のゲームオブジェクトだけをカメラに映す方法 | Uinty 使い方ガイド

カメラとレイヤー | KAYAC engineers’ blog

レイヤーによる Main Camera の非表示 | フタバゼミ

Camera.cullingMask | Unity スクリプトリファレンス [公式]

座標変換

参考:

Camera.WorldToScreenPoint | Unity スクリプトリファレンス [公式]

How to get a world position from the center of the screen ? – Unity Forum

Getting game object coordinate (from world coordinate) in screen coordinate – Stack Overflow

How to position 3D object to the camera screen in unity – Stack Overflow

オブジェクトを中心にして回転させる

参考:

Rotate a camera around the object – Unity Forum

複数台のカメラを使う

  • 切り替え
  • ピクチャインピクチャ/ワイプ (PIP / Picture in Picture)
  • 分割 (PBP / Picture by Picture)
  • 合成
  • テクスチャ描画 (Render Texture)
  • マルチディスプレイ
  • バーチャルカメラ (Virtual Camera / Cinemachine)
こちらのページを参照

参考:

2台のカメラを切り替え – Qiita

複数のカメラの使い方/複数カメラ表示/カメラ切り替え | TECH PROjin

画面分割して複数のカメラの映像を表示する | Unity の使い方

対戦ゲームような画面分割を作る方法 | ねこじゃらシティ

レイヤーごとにカメラを分けて写したい | 高原工房

カメラの表示を切り替える方法 | もぎブログ

複数のカメラを同時に画面表示する方法! | もぎブログ

複数カメラの使い方 | SAT-BOX BLOG

複数のカメラを使用する | Unity マニュアル [公式]

マルチディスプレイ | Unity マニュアル [公式]

視野錘台を傾ける (CalculateObliqueMatrix)

クリップ平面を与えて投影行列を計算する。

projection = camera.CalculateObliqueMatrix(clipPlane);
Code language: C# (cs)

参考:

斜め (Oblique) の投影行列で空間を切り取る – Qiita

Camera.projectionMatrix の罠まとめ | fuqunaga

Camera.CalculateObliqueMatrix | Unity スクリプトリファレンス [公式]

Camera.projectionMatrix | Unity スクリプトリファレンス [公式]

Camera.ResetProjectionMatrix | Unity スクリプトリファレンス [公式]

Using an Oblique Frustum | Unity マニュアル [公式]

GeometryUtility.CalculateFrustumPlanes | Unity スクリプトリファレンス [公式]

フレームデバッガー

メニューから「Window > Analysis > Frame Debugger」を選択して開く。

参考:

フレームデバッガー | Unity マニュアル [公式]

Problems with camera rendering order | Unity Forum

Camera コンポーネント

参考:

Camera – 使い方とスクリプト | ゲームの作り方!

UnityEngine.Camera | Unity スクリプトリファレンス [公式]

Render Texture を使う

参考:

Camera.targetTexture | Unity スクリプトリファレンス [公式]

OnPreCull

動画:

How to Hide Objects from a Camera without Layer Masks

参考:

MonoBehaviour.OnPreCull() | Unity スクリプトリファレンス [公式]

Camera.onPreCull | Unity スクリプトリファレンス [公式]

URP

参考:

URP のカメラ | npaka

Cameras | Universal RP 8.2 Manual [Official]

Class UniversalAdditionalCameraData | Universal RP 8.2 Manual [Official]

Cinemachine

こちらのページを参照

ドキュメント:

Cinemachine | Unity マニュアル [公式]

記事をシェアする:
タグ:

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

Protected by reCAPTCHA