Light Probe is too slow

Hi everyone, I have a question and need your help.
I have a model, after adding a light probe to the rootNode, it takes 30 seconds to render, I want to know if there is a way to speed up the rendering of the light probe, or I am using the wrong way.
Here’s how I use the light probe:

        EnvironmentCamera envCam = new EnvironmentCamera(256, new Vector3f(0, 0, 0), Image.Format.RGB8);
        stateManager.attach(envCam);
        Application app = this.stateManager.getApplication();
        envCam.initialize(stateManager, app); //Manually initilaize so we can add a probe before the next update happens
        LightProbe probe = LightProbeFactory.makeProbe(envCam, rootNode);
        probe.getArea().setRadius(5); //Set the probe's radius in world units
        probe.setPosition(new Vector3f(0, 0.25f, 0)); //Position it in 3d space
        rootNode.addLight(probe);

And,my model is 10MB,almost 190k points

I also tried to use the SDK to bake the light probe into the model, but the generated j3o exceeds 20MB and the program reports an error. I found that JME does not allow me to load a model larger than 20MB, and I don’t know what goes wrong.

It helps to know what the error is.

I’ve loaded models >200 MB in size before… so it’s something specific to your setup.

Then I just need to bake the light probe and light to the model in the JME SDK and then import my program, right?
Real-time rendering of light probes takes 30s to take effect. Is this normal?

Sorry!It’s my fault. I thought it was the simulator’s problem before, so I changed the moble phone to test but there was also the problem. Just now I borrowed an Android device with more memory and the test passed.

Hmmm… this is on mobile? That’s brand new information.

These models didn’t seem very big for desktop but I suspect they are HUGE for mobile.

I have no experience with mobile so others will have to chime in.

…you definitely want to pregenerate light probes or use prebuilt ones, see: Texture of glb does not load - #14 by pspeed

That’s if you even use PBR on mobile. I don’t know what the recommended practice is these days.

2 Likes

Thanks for your reply, I will read your article carefully.
I have been testing with Android mobile devices before, but the model with more than 20MB will report an error. Today, the test suddenly works fine, and I don’t know what settings I changed to make the error disappear.
Just now, I used the JME SDK to add a light probe and light source to the model file in advance. After importing it to the Android mobile device, it took effect, the reflective material of the metal can be clearly seen,and appears at the same time as loading the model
If I add the light probe directly in the program,it takes almost 30s for my model to show the metallic reflective effect on Android devices.I didn’t investigate the exact reason.I think it maybe too performance consuming, I checked that the GPU was running at full capacity.
(Ps: I noticed some posts saying that Android devices cannot load light probes correctly, this is how I tried to make it work:
EnvironmentCamera envCam = new EnvironmentCamera(256, new Vector3f(0, 0, 0), Image.Format.RGB8); )

As mentioned you should generate the light probe once and save it as j3o file then at runtime you just need to load it and get the probe from j3o file instead of regenerating it.

Also, someone developed a version of PBR material optimized for mobile.

You can take a look at it here:

3 Likes

Also note that everything out of this radius won’t be affected by the light probe. 5 seems a small value, you might set it to something like 500 or so, depending on your scene size.

1 Like

based on all posts here, you just need:

  • save generated probe as j3o(and load on mobile as j3o) instead each time generating it on Mobile that is VERY BAD

  • (optional) use MobilePBRLighting material to speed up things

  • in future provide more information instead make people guess things. (you didnt told it was mobile on start, and you didnt provide exception(error) log you mentioned you had)

3 Likes

Thank you for your reply! I’ll try on it.

1 Like

Sorry,it’s my falut. :joy:

1 Like