Unreal Engine 5 tutorial and break down of a new feature introduced in #UE5 called Light Weight Instances or LWI. It's useful for Instancing Actors, especially for Open World or Large scale games. Socials: Twitter: / amiransari09
Thanks A lot for this valuable Information but I have a question how can we turn them back to light weight for example if i drop pickup i want to turn my pickup into light weight if this possible that will save lot of Performance.
Super helpful! keep it up! It'd be great to see 2 extra scenario breakdowns. Multiplayer/replication example a object that has multiple static mesh components on it, represented as a singlar actor (e.g. a table with items on it)
ISM, HISM, Auto-Instancing and now Light Weiht Instances: I think i'm losing track of the advantages, disadvantages, and intended uses. What does the new technology offer in terms of performance compared to the old ones?
You also need to do this in development editor and not ind ebug game I've noticed or else the chairs just disappear. Thanks for the tutorial, it was great!
If I follow the steps between 1:00 and 1:24, without editing any blueprints, will I have an instanced mesh? For example, I make a window, I add a Hierarchical InstancedStaticMesh as you've shown. Now, if I duplicate the mesh by doing simply copy and paste, will the second mesh require calculation or will it be instanced? I tried to do so, and it created another statichmeshcomponent under the main one. I wanted to know this, I only found the procedure in your tutorial, thank you in advance.
cool vid! i guess this only affects cost of interactive objects in the scene, but not for actual rendering the object itself right? like if it was all nanite, or nanite LWI, would the LWI run faster?
Thanks for watching! Glad you found it useful. Yeah it's a more optimized way of having a large number of actors in the level. As for the rendering , The meshes are instanced so they are rendered in a batch , which essentially is cheaper than placing/rendering individual meshes. I haven't looked into whether Nanite works with Mesh instancing or not.
Nice video but I have a question. You showed how the LightWeightInstances become the real BP_Chair once you interact with them but is this also reversable if you dont interact anymore? Maybe with one of the functions you mentioned?
Thanks for the kind words! Yeah so the system does not automatically convert it back to Light weight instances, but you can do it manually by calling "ConvertActorToLightWeightInstance" and pass the actor you want to convert to a Light weight instance as the parameter.
It seems very finicky using it in runtime. I tried spawning some actors in runtime and converting them to lightweight instances. They dissapear, but if i shut down the game they show up as instances in the editor. What if you want them to become instances on the go ? Spawn them and then make them instances? there isnt much about it online
You mention that other information about the actor, in addition to the transform can be added. How would you add additional value types (float, boolean, etc) about the actor?
Sure, You can take a look at the ALightWeightInstanceManager::SetDataFromActor, So what you can do is to Create you own manager derived from "ALightWeightInstanceManager" then override the function called "SetDataFromActor". Then within the function you can customize what you wish to store when the actor is converted into a light weight instance. You also want to inherit from the FLWIData structure and add the properties you need and to in order to tell the manager to use your new struct, you can override AllocateInitData and allocate your own struct instead.
After some time, I've been unable to succeed. As someone with no prior C++ experience, this is beyond what I am able to accomplish. Would you be willing to make a short tutorial of how to add a few other basic variable types, in addition to the transform? I'm working on a voxel game like Minecraft, where each block is an actor that gets converted into a LW Instance. However, since each block requires more data than a single mesh and transform (such as block id, material, even shape), I am unable to implement all the visual differences for blocks that have been converted into LW Instances.
Hello, every time I try to add a static mesh to the InstancedStaticMeshComponent (the step at 5:13) the editor instantly crashes. Do you know why this might be happening? Edit: Nevermind, I watched your other video and figured it out.
Interesting, have you setup the hierarchical instanced static mesh component Mesh ? It should be set on the manager. I’ll try to get a project file and upload it for you.
That is supercool!! And makes my thought about buying an instance pool plugin obsolete 😅 This will push my Keeper-Like Gridmap to a more performant Level
Hello, thank you very much for this video, could you please explain how to implement it from scratch and if it is compatible with destructible meshes, thank you.
Hi thank you for the kind words , this video pretty much explains how to setup one from scratch. But if there is anything specific you need clarification on let me know . As for being compatible with destructible, You can definitely convert it back to a full actor and destruct the mesh right before the destruction. E.g right after getting hit by a axe , convert it to a full actor and then destruct it.
Yes, you need to enable the LightWeightInstancesEditor plugin, as shown at time stamp 2 minute and 10 seconds , then you should be able to select an actor in the world and use the actor menu at the top of the screen to convert it.
1. I enabled the LightWeightInstancesEditor plugin. 2. Currently the Actor in the world is an Actor Blueprint. I selected the actor Blueprint. 3. Where can I find the "actor menu" at the top of the screen to convert the actor blueprint to a light weight instance. 4. The actor blueprint does not have the "Variable Name" so I cannot enable the "InstancedStaticMesh Component" noted at time index 4:47 5. Do I need to convert the actor blueprint to a standard static Mesh, then try to make a Light weight instance out of it?
@@seanrodrigues8323 Have you created the Manager blueprint referenced at 4:20 and placed it in the world? As for the Actor menu, you can see the reference at 5:50. 4. When you created the manager class, you have to select the one named "LightWeightInstanceStaticMeshManager" as the parent. I might do another video soon, showing in detail how to set up one! Let me know if you have any other question
I've uploaded a new walkthrough video on how to setup Light Weight instances from scratch , let me know if that helps :) ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Zgt6Wx-wlKE.html
When you say "We are only storing its transform...". This is not entirely true, under the hood those are just good old HISM components which properties are hidden. Nice video though!
Thanks for the kind word! You might be confusing lightweight instances with HISM, The use of HISM is only for the rendering side of Light instances. In fact, Lightweight instances are not only meant to be used for actors with meshes. you can have a lightweight instance of an actor that is entirely data-oriented and does not require rendering. I only use LightWeightInstance Static Mesh so I could show a visualization of how the system works in the video but you can use lightweight instances without any mesh or rendering. it's more than just hiding properties. You can refer to How the engine now treats Tracing and casts, you no longer get an actor but instead an ActorHandle which is just an id of the Actor that has been traced. In fact, The majority of the engine has been changed to accommodate lightweight instances. I suggest you look into LightWeightInstance Manager to see how the process is implemented under the hood. When you convert an actor to a lightweight instance, The actor is removed from the world and only its Transform is stored which is mapped to a Handle Id then the moment you convert the instance back to an actual actor, the actor gets created at the transform. Few places I would recommend looking at , if you are interested in learning about Light Weight instances : 1 - ALightWeightInstanceManager 2 - FLightWeightInstanceSubsystem 3 - FHitResult, Where instead of an actor you get a "FActorInstanceHandle HitObjectHandle". Let me know if you still need more info , I'll be glad to help out😊
@@amiransarimy97 Thanks to you for the video :) I don't know really what happens, at first it just kept crashing for an assert but we work around that by setting the seed as the first thing in the blueprint different from 0. Now it doesn't crash but when I choose my BP and then go to the Change to LightWeight in the Actor panel, my BP just disappears. If I add instances to the manager, they don't show up. I'm probably missing something very stupid here... Haven't you experienced the crashes for the asserts? HierarchicalInstancedStaticMesh.cpp #3186
@@cafo5997 Yeah I've experienced the crash as well when you set the HISM component mesh before setting the Random Seed. Interesting, I'll try the Light Weight instances again tomorrow and probably record a video if I can.
@@cafo5997 Hey i think i figured it out, The BP just disappearing also happened to me, so there seems to be a bug , and the work around is to Place the manager in the world , Save the level , restart the editor and then actually convert the actors to light weight instances. I've also uploaded a new video on it : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Zgt6Wx-wlKE.html