Hi, I’m working on upgrading my game to use the PBR shader, but I’m struggling to understand which textures to set in the shader and how they should look .
I’ve read the 3 PBR articles in the documentation a few times , and I’ve managed to make a lot of models look much better just by switching to the PBR shader and adjusting their roughness and metallicness, but I’m still lost on how to get the reflection of the environment map working.
I was checking the documentation again, and I noticed that there’s a missing link in the ‘advanced pbr part1’ document.
I went to click on the word “here” hoping it would show me example textures for a PBR model, but it looks like the link was removed. Does anyone have the right link so we could fix this broken one? Thanks
Yes you need a light probe.
You can have a look in this test for example
It creates an EnvCamera, and uses it to generate a probe. This probe can then be saved as any other savable.
You just have to place the probe in your environment then use the LightProbeFactory to generate the probe.
Note that you may have to tweak the probe radius.
Thanks for the replies. I took some time to play around with the light probe before posting back, and I was able to get things mostly working using the code from the test example you posted, but I could not figure out how to position the light probe prior to generating its environment map.
I also tried to make a Light Probe in the SDK and the results appear to work perfectly in the SDK as well as in JMB, but when I run my game, the light probe seems to be ignored. Do I need to do anything else in order to load a light probe into the scene after settings it up in the SDK?
I can view the effects of the light probe in JMB, but I wasn’t able to find a way to create a new light probe. I was planning to bring this up and ask if there’s a different way to do this in JMB.
I’m using JMB 1.5.0 and I tried to look under the “+Light” tab but I didn’t see an option for light probes.
I created this light probe in the SDK and can see it in JMB like this picture below shows, but in JMB I only see an option to change the color, and there isn’t a “refresh” button like the SDK has to regenerate the environment map based on the lgiht probe’s location in the scene.
This is the view for light probe properties in the SDK:
Ohhh I forgot I’ve been testing this with an old scene that’s stored as a .j3o file instead of .j3s, that’s why I couldn’t figure it out with JMB.
I’m still unable to get the light probe to work correctly when I run my application though. It looks good in the SDK or in JMB, but doesn’t seem to have the same effect in the scene when I run the application.
I did another comparison with a reflective test model using JMB and the SDK, and I still can’t seem to get the light probe to work in my application as it works in the SDK and JMB.
I took some screenshots to show the difference between running my application compared to the SDK and JMB scene editors. I’m using a rock model with a metallic setting of 0.9 so the differences can be noticed easily.
Here are the effects as they appear when I run my application:
And then here are the effects as they appear in the SDK and JMB scene editors.
Am I missing another step to get this to work correctly at run time?
I think the high quality generation mode is an option if I use the LightProbeFactory and generate a light probe with code, but I’ve managed to get the light probe to work that way with both GenerationType.Fast as well as GenerationType.HighQuality.
The problem I’m having now is with the light probes I’ve created and attached to my scenes in the SDK or in JMB. Is there any extra code I should be calling when I load a Light Probe into my game from a .j3o or .j3s scene?
I believe I may have found out what part of my code is causing the problem. I ran a test case with the same rock model I posted above, and I could not reproduce the problem at first. But then I moved my scene far away to coordinates 2500,0,2500 (the location of the scene i was using to test beforehand) and the problem occurs again.
@Override
public void simpleInitApp() {
/** A white, directional light source */
DirectionalLight sun = new DirectionalLight();
sun.setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal());
sun.setColor(ColorRGBA.White);
rootNode.addLight(sun);
Node rockWithLightProbeScene = (Node) assetManager.loadModel("Scenes/ArenaMaps/MapSacredGrove.j3o");
rootNode.attachChild(rockWithLightProbeScene);
Vector3f loc = new Vector3f(2500,0,2500);
// rockWithLightProbeScene.setLocalTranslation(loc);
// cam.setLocation(loc);
}
If you try to recreate the error, check to see if you get different results with a scene at (0,0,0) compared to placing the same scene at (2500,0,2500) or any location far away from the origin
Here’s a screenshot of showing the difference in results I see by changing the translation of the scene, by un-commenting the 2 commented lines of code in my previous post.
So I’ve gotten it to work at run time now and with both the SDK and JMB, but only when I leave the scene containing the Light Probe at (0,0,0)