1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ARCoreで平面に実寸大ポスター(PNG)を貼る

Last updated at Posted at 2019-07-30

ハッカソンでARCoreを用いて画像データを平面に貼る機会があったので備忘録として残しておきます。
使用したサンプルプログラム:https://ktaka.github.io/codelab/sceneform-ar-ja/#0
上記のサンプルプログラムをベースに行う

貼りたい画像(PNG)をBlenderでOBJ形式変換する

https://qiita.com/nutti/items/5e9ebe9c28751066b688
上記を参考にImport Images as Planeを入れる
File -> Import -> Images as PlanesをクリックしてPNGからPlaneを生成する
スクリーンショット 2019-07-30 15.25.34.png

Location,Rotationを調整する(全て0)
スクリーンショット 2019-07-30 15.26.14.png

Export -> Wavefront(.obj)で書き出す
スクリーンショット 2019-07-30 15.26.47.png

OBJ形式をプロジェクトに取り込む

blenderで生成した.objファイルと.mtlファイルが生成されるのでそれをAndroid Studioのプロジェクトに入れる。

Android Studio > Preferences > PluginsでGoogle Sceneform Tools (Beta)を入れる
スクリーンショット 2019-07-30 15.32.50.png

対象の.objを右クリックするとImportSceneform Assetが表示されるのでクリックしてFinishを押す
スクリーンショット 2019-07-30 15.29.47.png

sfbファイルが出力されるのでsamplers.params.usage_typeを"Color"に変更
model.scaleを好きな値(実際試してみて調整)にする
スクリーンショット 2019-07-30 15.36.44.png
あとはベースとなっているサンプルと同様にMainActivityを書き換えて表示する

  • 微妙に本来透明な部分が半透明になってしまうので原因がわかる人がいましたら教えてください!
1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?