Difference between revisions of "RTPreview"
(→Limitations) |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
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. | 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. | + | Similar to Bakery itself, RTPreview can take advantage of RTX hardware to render faster (but does not require it). |
= Installing = | = Installing = | ||
Line 47: | Line 47: | ||
* Bitmasks are currently not respected in preview. | * Bitmasks are currently not respected in preview. | ||
− | |||
− | |||
− | |||
− | |||
* [[Subsurface_scattering|Subsurface scattering]] does not currently render in preview. | * [[Subsurface_scattering|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 | + | * 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 only in the built-in render pipeline for now. 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. | * 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. | ||
Line 60: | Line 56: | ||
= Troubleshooting = | = Troubleshooting = | ||
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). | 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). | ||
+ | |||
+ | = Scripting = | ||
+ | When using any custom scripts that alter Bakery light values in the editor, RTPreview must be notified of change in a following way: | ||
+ | {{code|<nowiki>// Any BakeryDirectLight parameter change</nowiki>}} | ||
+ | {{code|<nowiki>if (BakeryDirectLight.lightsChanged == 0) BakeryDirectLight.lightsChanged = 1;</nowiki>}} | ||
+ | {{code|<nowiki>//</nowiki>}} | ||
+ | {{code|<nowiki>// Any BakeryDirectLight enabled/disabled/created/deleted</nowiki>}} | ||
+ | {{code|<nowiki>BakeryDirectLight.lightsChanged = 2;</nowiki>}} | ||
+ | |||
+ | |||
+ | {{code|<nowiki>// Any BakeryPointLight parameter change</nowiki>}} | ||
+ | {{code|<nowiki>if (BakeryPointLight.lightsChanged == 0) BakeryPointLight.lightsChanged = 1;</nowiki>}} | ||
+ | {{code|<nowiki>//</nowiki>}} | ||
+ | {{code|<nowiki>// Any BakeryPointLight enabled/disabled/created/deleted</nowiki>}} | ||
+ | {{code|<nowiki>BakeryPointLight.lightsChanged = 2;</nowiki>}} | ||
+ | |||
+ | |||
+ | {{code|<nowiki>// Any BakerySkyLight parameter change</nowiki>}} | ||
+ | {{code|<nowiki>if (BakerySkyLight.lightsChanged == 0) BakerySkyLight.lightsChanged = 1;</nowiki>}} | ||
+ | {{code|<nowiki>//</nowiki>}} | ||
+ | {{code|<nowiki>// Any BakerySkyLight enabled/disabled/created/deleted</nowiki>}} | ||
+ | {{code|<nowiki>BakerySkyLight.lightsChanged = 2;</nowiki>}} | ||
+ | |||
+ | |||
+ | {{code|<nowiki>// Any BakeryLightMesh parameter change</nowiki>}} | ||
+ | {{code|<nowiki>if (BakeryLightMesh.lightsChanged == 0) BakeryLightMesh.lightsChanged = 1;</nowiki>}} |
Latest revision as of 11:27, 1 February 2024
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).
Installing
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.
Running
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.
Tweaking
Any Direct Light, Sky Light, Point Light and Light Mesh can be changed interactively while preview is running.
Additionally, global GI bounce count, Indirect boost, Backface GI and Emissive boost can be modified.
Exposure value can be tweaked to control HDR brightness of the image.
Limitations
- 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.
- 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 only in the built-in render pipeline for now. 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.
Troubleshooting
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).
Scripting
When using any custom scripts that alter Bakery light values in the editor, RTPreview must be notified of change in a following way: