1

I have tried all the method,even seen the filament code,but I don't know why the emissive property can't not work in Sceneform.

the document said

"The main use of emissive is to force an unlit surface to bloom if the HDR pipeline is configured with a bloom pass."

As far as I understand this sentence, Google already knew that Sceneform could not have emissive light

I try to use Filament matc.exe to build a matc file load on Sceneform modified by Thomass,the original mat file like this:

material {
    name : "Emissive Material",
    parameters : [
        {
           type : float4,
           name : emissive
        }
    ],  
    shadingModel : lit,
}

fragment {
    void material(inout MaterialInputs material) {
        prepareMaterial(material);        
        material.baseColor = materialParams.emissive; // work,but no bloom light around.
        material.emissive = materialParams.emissive; // not work when only set it
        material.emissive = vec4(0,1,0,1000000); // not work when only set it        
    }
}

and use Filament matc.exe to build that:

//cd to my filament /bin

matc -p all  -o  ../bloomMat/sceneform_bloom_t23.matc  ../bloomMat/sceneform_bloom.mat

to build a sceneform_bloom_t23.matc file,then paste it to raw directory.

and use that like this:

ModelRenderable.builder()
.setSource(this,Uri.parse("https://.../my_glb_path.glb"))
.setIsFilamentGltf(true)
.build()
.thenAccept(
modelRenderable -> {
    renderable = modelRenderable;
    com.google.ar.sceneform.rendering.Material.builder()
    .setSource(getApplicationContext(),R.raw.sceneform_bloom_t23)
    .build()
    .thenAccept(new Consumer() {
        @OverRide
        public void accept(Material material) {
            material.setFloat4("emissive",1,0,0,1000000); // not work 
            renderable.setMaterial(material);
        }
    });
});

the modle have no bloom light.

I also try to use the sfa doucumentsaid ,use gltf_material.sfm and write sfa file like this:

{
  materials: [
    {
      name: 'unlit_material',
      parameters: [
             { baseColorFactor: [10,10,10,10], }, // work
             { emissiveFactor: 2147483647, }, // not work
             { emissive: 'andy', }, // work ,but not have emissive Light.
             { opacity: null, },
             //{ reflectance: 0, },
           ],
      source: 'build/sceneform_sdk/default_materials/gltf_material.sfm',
    }
  ],
 model: {
    attributes: [ 'Position', 'TexCoord', 'Orientation', ],
    collision: {},
    file: 'sampledata/andy02/andy.obj',
    name: 'andy',
    recenter: 'root',
  },
  samplers: [
    {
     file: 'sampledata/andy02/andy.png',
     name: 'andy',
     pipeline_name: 'andy.png'
    }
  ],
  version: '0.54:2'
}

still not work.

I know the SceneView can have the emissive light,but the question is my company is still use Sceneform.

My expect effect: image(the glowing green arrow, in picture center)

Finally ,my question is, how let the emissive property work on Sceneform?

This is the second time I post this question. In the previous version, I said something that was forbidden.

I hope this question can be answered,thanks a lot.

Ryan M
  • 18,333
  • 31
  • 67
  • 74
小蝦米
  • 13
  • 3

1 Answers1

0

To make the emissive property work, bloom must be enabled on the filament view. With the original sceneform library from google, I think this is not possible, because the filament view cannot be accessed (Maybe it could be done with reflection, though). But it is possible with the sceneform version from this repo: https://github.com/SceneView/sceneform-android

Bloom can be enabled like this (kotlin code):

val bloomOptions = com.google.android.filament.View.BloomOptions()
bloomOptions.enabled = true
scene!!.view.renderer!!.filamentView.bloomOptions = bloomOptions
josias
  • 586
  • 4
  • 9
  • Thank you for your reply! finally,I used the code: ` arSceneView?scene?.renderer?.filamentView?.bloomOptions=bloomOptions.apply { enabled = true } ` to enable the bloom. thank you a lot! – 小蝦米 Apr 04 '23 at 14:18