LoginSignup
0
0

More than 1 year has passed since last update.

GUI改造6 固定位置カメラ

Last updated at Posted at 2022-12-19

「instantNeRFで遊ぶ Advent Calendar 2022」の20日目です。

今日はinstantNeRFのtestbedに視点変更機能を追加しました。
BlenderやRealityCaptureのようにTop ViewやRight Viewなどのショートカットが欲しかったです。

業務外の個人的な検討活動です。

警告
環境や入力内容によっては現在使用できている状況が壊れることがあります。
あなたの責任と判断で試してください。私は責任を取りません。

テストデータ

sketchfabのNefertiti statueを使用させていただきました。ありがとうございます。

testbed.cu

Testbed::keyboard_event() に下記を追加しました。
HをFront、JをRight、KをBack、LをLeft、YをTop、BをBottomに割り当てました。

	// ZXY			
//from front [ x: 0, y: -180, z: -180 ]			
	if (ImGui::IsKeyDown('H')) {
		m_camera <<
			1.0f, 0.0f, 0.0f, 0.5f,
			0.0f, -1.0f, 0.0f, 0.5f,
			0.0f, 0.0f, -1.0f, m_aabb.max[2];
	}
	//from right [ x: 0, y: 90, z: 180 ]			
	if (ImGui::IsKeyDown('J')) {
		m_camera <<
			0.0f, 0.0f, -1.0f, m_aabb.max[0],
			0.0f, -1.0f, 0.0f, 0.5f,
			-1.0f, 0.0f, 0.0f, 0.5f;
	}
	//from back [ x: 0, y: 0, z: -180 ]			
	if (ImGui::IsKeyDown('K')) {
		m_camera <<
			-1.0f, 0.0f, 0.0f, 0.5f,
			0.0f, -1.0f, 0.0f, 0.5f,
			0.0f, 0.0f, 1.0f, m_aabb.min[0];
	}
	//from left [ x: 0, y: -90, z: -180 ]			
	if (ImGui::IsKeyDown('L')) {
		m_camera <<
			0.0f, 0.0f, 1.0f, m_aabb.min[0],
			0.0f, -1.0f, 0.0f, 0.5f,
			1.0f, 0.0f, 0.0f, 0.5f;
	}
	//from top [ x: 90, y: 0, z: 0 ]			
	if (ImGui::IsKeyDown('Y')) {
		m_camera <<
			1.0f, 0.0f, 0.0f, 0.5f,
			0.0f, 0.0f, -1.0f, m_aabb.max[1],
			0.0f, 1.0f, 0.0f, 0.5f;
	}
	//from bottom [ x: -90, y: 0, z: 0 ]			
	if (ImGui::IsKeyDown('B')) {
		m_camera <<
			1.0f, 0.0f, 0.0f, 0.5f,
			0.0f, 0.0f, 1.0f, m_aabb.min[1],
			0.0f, -1.0f, 0.0f, 0.5f;
	}

実行した様子です。
19日目のcamera pathの改造GUIと合わせて使用しています。
キーボードのH、J、K、Lキーを順番に押しキーフレームの視点を入力しました。

0
0
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
0
0