RTPreview is a real-time ray tracing plugin for Bakery Lightmapper that makes it possible to quickly visualize and tweak lighting for future lightmaps before baking them.
RTPreview is not a production renderer, but a "how lightmapper sees your scene" kind of view. What you will see is what every traced ray sees in Bakery, meaning its main purpose is fine-tuning lighting and making sure your geometry and materials are properly represented.
Similar to Bakery itself, RTPreview can take advantage of RTX hardware to render faster (but does not require it).
You need to have Bakery installed first. Then download RTPreview package and just install it on top. RTPreview will be unpacked to standard Bakery folders: Assets/Bakery and Assets/Editor/x64/Bakery.
Click Bakery -> Preview. Then you have two options:
- Disable Render In Scene View. Type desired width/height of the window. Click Open Preview. Preview will be shown in its own window.
- Enable Render In Scene View. Click Open Preview. Preview will be rendered directly in Scene View.
In both cases preview camera will follow editor camera.
Click Close Preview to close the window or stop rendering to Scene View.
Export geometry and maps checkbox controls if scene geometry/materials will be exported to Bakery. Must be enabled if running for the first time or if there were any changes to them.
Exposure value can be tweaked to control HDR brightness of the image.
- You shouldn't expect materials to look as they do in engine. Bakery uses Unity's Meta Pass to gather albedo/emission information, meaning surface textures will have the same resolution as lightmaps (probably on the low side). However, a benefit of this approach is that any procedurally computed color coming from custom shaders will be visible. Another benefit is being able to see future lightmap resolution from textures and making sure they didn't leak any wrong color during mip-mapping. Meta Pass does not provide specular information, so there will be no specular highlights or reflections in preview.
- Any resolution-related settings only affect Meta Pass, but not lighting. Lighting in preview is calculated for every screen pixel.
- Any sample count settings (GI samples, shadow samples for various lights) have no effect on preview. Preview uses infinite, progressively increasing sample count for everything. One special case that is taken into account is setting shadow samples to 0 for Direct and Point lights in order to disable their shadows completely.
- Scene geometry (including Light Mesh geometry) and materials can not be changed while preview is running. To apply these changes you must close and open preview again with "Export geometry and maps" option enabled.
- Objects set to not cast any shadows are not visible in preview. This is actually how Bakery works: objects not casting shadows can gather lighting lighting around them but are transparent for rays.
- Bitmasks are currently not respected in preview.
- Direct light's texture projection is currently not respected.
- Subsurface scattering does not currently render in preview.
- When rendering to a window, no Unity post effects are applied (window exists as a completely separate program). When rendering to Scene View, post effects can be applied, but note that preview image is 8-bit sRGB, so any HDR postprocessing (such as tonemapping) will not display correctly. Will be improved in future updates.
- Very large scenes (or scenes with too many high resolution lightmaps) can cause an "Out of memory" error, even if they can be baked. This is because preview has to share video memory with Unity running the same scene, while baking makes it possible to unload it from engine.
If RTPreview opens and then closes by itself immediately or after a few seconds, please check and report last lines printed to .ftracelog.txt (placed in Assets/Editor/x64/Bakery by default).
When using any custom scripts that alter Bakery light values in the editor, RTPreview must be notified of change in a following way: