LoginSignup
1
1

More than 5 years have passed since last update.

UnityでMVP行列を自前で渡す

Last updated at Posted at 2018-10-01

//各行列の取得方法

var viewMat = _camera.worldToCameraMatrix;
var projMat = _camera.projectionMatrix;
var modelMat = _gameObject.transform.localToWorldMatrix;


//シェーダー側

float4 worldPos = mul(_ModelMat,v.vertex );
float4 viewPos = mul( _ViewMat, worldPos );
float4 projPos = mul( _ProjMat, viewPos );

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1