Path tracer offline mode override - #329
Merged
Merged
Conversation
| } | ||
| } | ||
|
|
||
| if (bOverridePathTracerOfflineMode) { |
Collaborator
There was a problem hiding this comment.
This PR is great. Here is my proposed design. I'm using UFUNCTIONS instead of UPROPERTIES to make it more clear that they set a piece of deferred state that gets consumed differently to the rest of the state in the capture component. I'm also slightly simplifying existing code here because I just realized that setupView() executes on the game thread, so there is no need for any synchronization primitives on any of the deferred state:
// SpSceneCaptureComponent.h
// ...
// set deferred state to be consumed in an FSceneViewExtension callback
UFUNCTION(BlueprintCallable, CallInEditor, Category="SPEAR")
void RequestPathTracerReset();
UFUNCTION(BlueprintCallable, Category="SPEAR")
void RequestSetOfflineRender(bool bOverrideIsOfflineRender, bool bIsOfflineRender);
// ...
// deferred state to be consumed in an FSceneViewExtension callback
bool request_path_tracer_reset_ = false;
bool request_override_is_offline_render_ = false;
bool request_is_offline_render_ = false;
// SpSceneCaptureComponent.cpp
void USpSceneCaptureComponent2D::Initialize()
{
// ...
request_path_tracer_reset_ = false;
request_override_is_offline_render_ = false;
request_is_offline_render_ = false;
}
void USpSceneCaptureComponent2D::RequestPathTracerReset()
{
SP_ASSERT(IsInitialized());
request_path_tracer_reset_ = true;
}
void USpSceneCaptureComponent2D::RequestSetPathTracerIsOfflineRender(bool bOverrideIsOfflineRender, bool bIsOfflineRender)
{
SP_ASSERT(IsInitialized());
request_override_is_offline_render_ = bOverrideIsOfflineRender;
request_is_offline_render_ = bIsOfflineRender;
}
void USpSceneCaptureComponent2D::setupView(FSceneViewFamily& view_family, FSceneView& view)
{
const TArray<FEngineShowFlagsSetting>& engine_show_flag_settings = GetShowFlagSettings();
for (auto& engine_show_flag_setting : engine_show_flag_settings) {
if (Unreal::toStdString(engine_show_flag_setting.ShowFlagName) == "LightingOnlyOverride" && engine_show_flag_setting.Enabled) {
view.DiffuseOverrideParameter = FVector4f(GEngine->LightingOnlyBrightness.R, GEngine->LightingOnlyBrightness.G, GEngine->LightingOnlyBrightness.B, 0.0f);
view.SpecularOverrideParameter = FVector4f(0.0f, 0.0f, 0.0f, 0.0f);
}
if (Unreal::toStdString(engine_show_flag_setting.ShowFlagName) == "Specular" && !engine_show_flag_setting.Enabled) {
view.SpecularOverrideParameter = FVector4f(0.0f, 0.0f, 0.0f, 0.0f);
}
}
if (request_path_tracer_reset_) {
view.bForcePathTracerReset = true;
request_path_tracer_reset_ = false;
}
if (request_override_is_offline_render_) {
view.bIsOfflineRender = request_is_offline_render_;
}
}
Contributor
Author
There was a problem hiding this comment.
Okay that makes sense
mikeroberts3000
approved these changes
Aug 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This overrides the scene view's offline mode, which changes how path tracer is invalidated. It's not needed for the simple path tracer example but can be useful for some experimental features. For example, you can use this to do manual motion blur, because in this mode the path tracer samples don't get invalidated on camera or object mvement.