AR

SceneForm

https://developers.google.com/sceneform/images/hellosceneform-demo.mp4

기본적으로 Anchor 기반으로 Application의 Scene이 구성됨

어플리케이션 시작 후, 카메라로 주변을 비추게 되면 주변의 평면을 SceneForm이 자동으로 탐지하며, 그때부터 TapOnPlane listener가 activity에 attach되어 사용자의 터치에 이벤트를 발생시킴

SceneForm이 인식한 평면에 터치를 하게되면 해당 좌표(Sceneform 좌표계, world coordinate)에 Anchor가 생성되고, AnchorAnchorNode, TransformableNode, Node등 renderable한 node를 부착할 수 있다.

원래라면 Tap을 통해서만 Anchor를 생성할 수 있지만, world coordinate를 직접 지정하여 Anchor를 생성할 수 있다.

/** Create symbol node with given informations */
fun createAnchor(worldCoord: Vector3): AnchorNode {
    val anchorNode = AnchorNode()
    anchorNode.worldPosition = worldCoord
    return anchorNode
}

아래와 같이 사전에 정의된 Filament 기반 PBR Renderer를 Sceneform에 적용시킬 수 있다

renderer.filamentView.colorGrading = ColorGrading.Builder()
    .toneMapping(ColorGrading.ToneMapping.FILMIC)
    .build(EngineInstance.getEngine().filamentEngine)

ToneMapping에는 Linear, Filmic 등이 있음.

MapGo에서는 Renderable node로 ModelRenderableViewRenderable를 사용하고 있다.

ModelRenderable은 3D obj model을 rendering 하기 위한 node로, 임의의 GLTF URL을 주는 것으로 생성할 수 있다.