I get the materials to change, i.e. the floor. But when my wood floor switches to a carpet, the reflections in the glass and other reflective surfaces are still of the wood…
Can I update reflection captures during runtime?
I thought of turning the ReflectionCapture objects into Blueprints, give them a Custom event that fires a “Update Capture” and then trigger these each time a new material has been chosen via UMG Material Switching…
My problem is: I cannot find a node that says something like “update Capture” and my Google-Fu is kinda low today and I cannot find anything about this…
Can you tell me if
a) this is possible during runtime
b) a node that can actually do this
c) my idea of linking the blueprints make any sense
Thank you very much and have a great day!
TL;DR = It says in the documentation that the Reflection Capture Actors are updated before runtime… but what about changing materials during runtime? Is there a way to the material change with an “Update Capture”
Those reflection probes are very specifically and strictly static, saved before the game ships. They can be updated in real time in the editor, so maybe if you were awesome at editing source code you could bring that feature to your game.
Otherwise, you would have to cook up a more performance-expensive solution like a SceneCaptureCube or Cubemap texture inside every material.
You could try capturing an HDR cube map of the finished level and use that in your Post Process for the reflection. This way is not going to give you super accurate results but it will allow you to change things without having to worry about artifacts. You can read more about how to use Cubemaps in UE4 from the following .
, I’ve been hoping in vain for this functionality with every update since release. It seems to be a simple thing as it already works in-editor. The only apparent reason things like this haven’t been exposed is because VR and other gimmicks unfortunately take priority over actual functionality and creative control. I’m incredibly disappointed with where the engine has been going, all its potential is being neglected in favor of dumbification, so that everyone who wants to make generic games with as little effort as possible can fulfill their dreams of being yet another generic #indiedev.
Technically reflection captures are static lighting. You can force a recapture at runtime though with the console command ‘r.ReflectionCapture’, this will cause a hitch and a lighting pop.
in one of my applications I had a similar problem. I was changing light colors of ambient lights using umg, unfortunately the reflections of the light color wouldn’t update.
However, I used the workaround mentioned by DanielW: I created a “execute console command” node and put in the command ‘r.ReflectionCapture’. It is triggered everytime the user applies the changed material. the user will see a loading screen for about .2 sec while the reflection captures are updating.
Not ideal, but working.
Another thing that comes to my mind ist experimenting with planar reflections. maybe this’ll work better for you. planar reflections are updated constantly.
Hi all
I’m having the same problem as the OP - glass wall panel and when I change from wood floor to carpet the reflection still shows the timber.
Is there a way to solve this in 4.19?
Planar Reflections seems to have disappeared from 'Rendering/Optimisations??
I’m an Arch Vis UE4 noob!
Reflection captures can only be updated in the editor, AFAIK,because they are supposed to be pre-filtered, compressed and packaged into cube map arrays offline.
If it is, how do you do a real-time day/night cycle?
(Unreal is supposed to be great at graphics, so I hope this topic is missing some vital information, because in Unity, you can basically update a reflection probe on tick if you want to.)
It does **NOT **work in the packaged game! (because of this check in ReflectEnvironmentCapture.cpp (line 1439))
if (FPlatformProperties::RequiresCookedData())
{
UE_LOG(LogEngine, Warning, TEXT("No built data for %s, skipping generation in cooked build."), *CaptureComponent->GetPathName());
return;
}
It’s hacky
short hickup (which was to be expected)
for (ULevel* Level : World->GetLevels())
{
if (Level->bIsVisible)
{
if (Level->MapBuildData)
{
Level->MapBuildData->InvalidateReflectionCaptures(nullptr);
}
}
}
FScene* Scene = (FScene*) World->Scene;
if (Scene)
{
TArray<UReflectionCaptureComponent*> ReflectionCapturesToUpdate;
for (TObjectIterator<UReflectionCaptureComponent> Itr; Itr; ++Itr)
{
if (IsValid(*Itr))
{
ReflectionCapturesToUpdate.Add(*Itr);
}
}
bool bOldIsEditorScene = Scene->bIsEditorScene;
Scene->bIsEditorScene = true;
World->Scene->AllocateReflectionCaptures(ReflectionCapturesToUpdate, TEXT("UpdateReflectionRuntime"), false);
Scene->bIsEditorScene = bOldIsEditorScene;
}
else
{
// IT DIDN'T WORK
}
Using UE4.21 btw
If anyone can figure out how to get it to work in the packaged game without editing engine source code I’d be very grateful!
The reason why this doesn’t work in packaged games is because capture data is compressed and packed into texture arrays as part of the level lighting data, so all the code that does that is part of the editor and not the runtime. Also, a crucial element of reflection capture processing is generating the mip maps, which AFAIK is pretty expensive since you can’t simply downsize each cubemap side as you’d do on a 2D texture: it needs to be resampled in spherical space to be able to blur correctly across the cube face boundaries.