Skip to content

Environment Probes

tobspr edited this page Apr 15, 2016 · 9 revisions

Environment probes capture the scene from a given point of view. They render their surroundings into a cubemap, which is then used in the main pass to provide more accurate reflections and also some sort of global illumination (although very approximate).

Environment Probe Comparison

To be able to use environment probes, you have to enable the env_probes plugins, either via the [Plugin Configurator](Plugin Configurator) or in config/plugins.yaml.

Creating Environment Probes

There are two possibilities for creating environment probes:

In Blender

To create an environment probe in blender, press space and enter Add Empty. Select the Add Empty option, and then select Cube. You should now see a wireframe cube in your level. You can now scale, move and rotate it to fit your needs.

Important: You need to name the object ENVPROBE (If you have multiple environment probes, blender will add .001, .002 and so on, but thats fine) to make sure the render pipeline knows its an environment probe.

When you finally exported your model, and want to load it, be sure to call render_pipeline.prepare_scene(my_model) after loading your model. This will register your environment probe.

In Python

If you want to create an environment probe manually, you can do so with the following code (For an explanation of the options, see below):

probe = self.render_pipeline.add_environment_probe()
probe.set_pos(Vec3(1, 2, 3))
probe.set_scale(Vec3(10, 10, 5))
probe.set_hpr(Vec3(0, 0, 90))
probe.border_smoothness = 0.05
probe.parallax_correction = True

Options

Border Smoothness

This controls how smoothly the environment probe is blended with the environment at the borders. A very small smoothness will cause a sharp, visible transition whereas a high smoothness will cause a smooth gradient.

Smoothness comparison

Parallax Correction

When parallax correction is enabled, cubemaps will be projected onto a geometry to provide more accurate reflections. Currently only projection onto the Oriented Bounding Box of the cubemap is supported. As you can see in the screenshots below, parallax correction achieves much more accurate reflections. Notice this only works well for planar reflections though, and you might want to disable it in some cases. Comparison:

Parallax comparison