Atul Vasudev A
Atul Vasudev A

Reputation: 463

How to properly render external texture in Sceneform 1.16.0?

Previously there was a nice article for rendering external texture

None of the code will work with Sceneform 1.16.0, as there are no .sfb, .sfm or .sfa formats. New material seems to be in .matc format which is not human readable. How to create or modify a material in this version of Sceneform?

Using sceneform_camera_material.matc its possible to render a camera to background of Sceneform, but its very pixelated, irrespective of whatever camera preview resolution chosen. GLTF models looks great when loaded, issue is specific to external texture.

Is this some issue related to Linear filtering of textures or something to do with material settings of Google Filament?

Screenshot

Upvotes: 1

Views: 1092

Answers (1)

SGTCheung
SGTCheung

Reputation: 89

If you use Sceneform 1.16 and want to create sceneform.rendering.Material,

(1) You need to create your own matc file with Filmaent matc tool. You can download filament tool at https://github.com/google/filament/releases.

(2) After you create your own matc file, put it in android raw directory, and call

  com.google.ar.sceneform.rendering.Material.builder()
            .setSource(context, R.raw.YOUR_MATC_FILE)
            .build()
            .thenAccept { material->
                //Do something with created sceneform's Material
            }
            .exceptionally { throwable: Throwable? ->
 
            }

Upvotes: 1

Related Questions