since the process of creating a light probe with the light probe factory takes a while on low end systems, is there a way to save the data to a file, so it can then be reloaded from a file without having to make a new one?
@Override
public void simpleUpdate(float tpf) {
frame++;
if (frame == 2) {
modelNode.removeFromParent();
final LightProbe probe = LightProbeFactory.makeProbe(stateManager.getState(EnvironmentCamera.class), rootNode, new JobProgressAdapter<LightProbe>() {
@Override
public void done(LightProbe result) {
System.err.println("Done rendering env maps");
tex = EnvMapUtils.getCubeMapCrossDebugViewWithMipMaps(result.getPrefilteredEnvMap(), assetManager);
}
});
((BoundingSphere) probe.getBounds()).setRadius(100);
rootNode.addLight(probe);
//getStateManager().getState(EnvironmentManager.class).addEnvProbe(probe);
}
if (frame > 10 && modelNode.getParent() == null) {
rootNode.attachChild(modelNode);
}
}
Yes you would just want to save your light probe as a .j3o file after generating it, and then you can load it with the asset manager at run time the same way you’d load other models.
Here’s a quick and simple method I wrote for saving my light probes
Is there any chance I could see how your method is used within the rest of the class, because im not sure exactly what Node i should be saving.
I can’t save the rootNode, since it has other spatials and nodes attached, I can’t make a seperate node just for the light as none of my other spatials are children to the seperate node, and i cannot cast the LightProbe to a node?
Create an empty node, attach light probe to it using addLight(); then save node as j3o.
Next time you can load it and get light probe from that and attach it back to your rootNode.