This is great, waiting to discover some performance issue since every newer tutorial is way overcomplicating this. Just got all my foliage harvestable in a couple hours and my only real roadblock was a collision error with some of my meshes. Spent the last 2 days trying to get more complicated solutions working and this is just elegant and easy. Now I just need to figure out respawning and/or planting and adding to the foliage instance.
Btw, with C++ you can get the custom data value, we've been using it to also store the health rather than having a separate array for that (Same outcome obviously so doesn't matter too much!)
If the function is available in C++, one can expose that to BP using a Blueprint Function Library and just calling the required functions within wrapper functions. For people who don't want to dive into C++ its a very handy trick. I use it all the time for functions available in C++ but not in BP, like regex, or hit result under cursor (wasn't available prior to 4.2 something). I just checked and FoliageInstancedStaticMeshComponents can also call functions from a BFL.
@@mmertduman Hey! this is a while ago now, and I might be stretching here a bit. I'm in unreal 5 and trying to expose this function. for the life of me, I cant find the function to call in c++. do you have any pointers? I'd just like to read the custom data in bp.
I have been binging your videos lately. I hit a lot of roadblocks recently on a game project and your easy to follow explanations have helped me a lot. Specifically this one and the water shaders videos. Keep up the great work man.
For the people who found that the per-instance custom data doesn't work in standalone mode or packaged project, you might need to call BuildTreeIfOutdated(true, false) in the c++ class after you set the custom data.
For anyone who is a c++ noob like me, I spent 24 hours digging into stuff so you don't have to. Here are the steps to make sure this works in a packaged project in 4.27.2: 1. In your project go to File > New C++ Class 2. Click the checkbox that says Show All Classes 3. Search FoliageInstancedStaticMeshComponent and select Next 4. Name your new class whatever you want, make sure Public is selected, then create class 5. Wait for Visual Studio to compile and open your newly created files 6. In the header file (YourClassWhateverName.h), add the word "Blueprintable" inside the UCLASS function 7. Below GENERATED_BODY() add the following code: public: UFUNCTION(BlueprintCallable) void RefreshCustomDataFoliage() {BuildTreeIfOutdated(true,false);} 8. Save and compile in your project 9. Now you can go to your original blueprint class (if you've already made any of this functionality), go to class settings and change the parent to whatever you named your class when you made your new C++ files. You should have access to the new function RefreshCustomDataFoliage which you can put after changing your custom data from in the video. 10. Go to the foliage editor in your level and change the Component Class to nothing then back to whatever you named it for this video (this should refresh your foliage after re-parenting, otherwise my already placed interactive foliage had disappeared) 11. Save everything and close your project, open your project again and build a new packaged game and voila! *Note: Closing project and re-opening was necessary for me otherwise I got a build error when launching my packaged game Hope this saves anyone some headaches.
what is this possible? :ooooooooo, this is really smart! I'm so happy you showed us this, this is a game changer for performance of foliage, I'm looking with my coworkers to make a variant of this technique to create all grabable items in our VR game :). Awesome vid as always Charlie ♥
We can for sure combine this with a constructor to create all items in a data oriented programming method which would be absolute poggers as we would only need to create the behavior component variants, a data table and the constructor, and in begin play it would generate all the items correctly with their respective behaviors :)
i try to find the way for changing the material of foliage at runtime literally take week and now finally at video with different title i get the solution thank you very much i am surprise that it was just one node setup
Your insight is always helpful. I've been sharing your vids with all of my classmates because your solutions tend to be pretty elegant to some of these design challenges. I'm currently working on a game where some of the things I learned here will really help me bring the team's concepts to life (without killing performance). Is there a place where I can learn more about you and your work? I'd love to work with exactly what you do hahahahah
Thank you!! Really glad to hear that you and the classmates are loving the videos :) This RUclips channel documents everything I've ever done, as I'm pretty new to Unreal/Gamedev (about 14 months now) so I don't actually have any completed projects to show off yet haha
@@GorkaGames How did you get it to send the event any "Event Any Damage from Damageable" in the Foliage Interaction Mesh Component? I am stuck on the same part.
Fantastic, its working, thank you! The only problem is that i dont understand why is it working? We made custom parameter for a *material*, but we set it for *mesh instance*. Why did this parameter changing for material applied to this mesh instance?
Good question! So, each primitive in the engine can hold on to some simple data, even if it's in an instance/batch (location, rotation, etc) which can also be accessed in the shader. Custom data are just arbitrary bits of data that you can set yourself and can also be accessed in the material. So that's why we can have the exact same material on all the foliage thingos, but change a parameter on the mesh itself and get the desired effect.
This looks really sweet but having a hard time following along for a say basic setup that we could customize later... Any way that would be cool to make some time basic system from scratch? thanks guy!
Hey Mystory! Unfortunately I don't really have much free time to put together planned tutorials - all of my videos are improvised on the spot and more aimed towards intermediate users. Hopefully you'll be able to come back at some point and give it another go! :)
I'm not understanding the connection between the foliage instanced static mesh component, and the event take damage damage from damageable. I have a health system on my character, but I can't call it in the FISMC. I also tried making an actor component but can't add a component like I can on a player character blueprint. Any point in the right direction would be appreciated
Google- interfaces unreal, You use on component begin overlap on your player bp, You add the interface to the bush, they under the on overlap you get child components of the type the bush is check to see if it has the correct interface and then call the interface function on it.
Hey Charlie this is an awesome video! I manage to get it working and the only thing is that Custom Data some how doesn't work with PCG graphs in UE5. I was wondering if any other solution can replace the custom data . It only works with foliage tool.
Ok I found a fix if somebody is wondering. In the new created foliage class, call the node Set Num Custom data floats from Event Begin Play and enter 2 in the field. Or May be it's better to be called on the EventDamage... I dunno?!?!
Good video =). I'm wondering if this can work with the grass tool, which the shaders use to procedural spawn grass tiles. There is a gassmap, I'm just not sure if it's accessible. An generally, what if I'm streaming landscape tiles. I still need to test, once the old tile is unloaded, if the new ID's will start at zero again? Some sort of tile/index management system would be necessary then.
Unfortunately not, since I think the Landscape Grass is GPU-spawned procedurally and never really exists on the CPU. It also can't have collision, which would make it kinda useless as well. For interacting with grass you'll want to take a Render Target approach - you can check out the video about my new plugin as an example
Oooh great question... I'm not 100% sure! I think the easiest way would be to have 2 versions in the Foliage editor, one with collision and 1 without, but I'm not sure about collision for just 1 instance index
How are you interacting with the individual foliage with that damage event. It seems like you are using an interface but whne I send a interface messege nothing happens. Is there a part I am missing, is there collision settings I dont know of?
Heyo Bob, make sure that "multi-body overlap" is enabled in the foliage class and then when you get the Hit event, the index of the instance will be in there
@@PrismaticaDev Thanks for the reply (lot of youtubers dont do that)! I guess thats why my sphere/line traces didnt work. I ended up figuring out a way to do it with collision overlap events. I was able to come up with some really cool dynamic effects with it. I am sure with more time there is even more potential. already have some more ideas lined up to try.
@@bobboberton349 I'm curious how you obtained the position of individual foliage using the overlap event, my Impact Point is always 0,0,0 and my foliage local position is always 12800,12800,12800
@@PrismaticaDev Ive been spending alot of time now trying to get the hit logic from the damage event to work but i just cant seem to get it working with the foliage specifically... Its not giving me any specific foliage information when printing, would be awesome to see the logic in that part specifically.
This is great, waiting to discover some performance issue since every newer tutorial is way overcomplicating this. Just got all my foliage harvestable in a couple hours and my only real roadblock was a collision error with some of my meshes. Spent the last 2 days trying to get more complicated solutions working and this is just elegant and easy. Now I just need to figure out respawning and/or planting and adding to the foliage instance.
Btw, with C++ you can get the custom data value, we've been using it to also store the health rather than having a separate array for that
(Same outcome obviously so doesn't matter too much!)
If the function is available in C++, one can expose that to BP using a Blueprint Function Library and just calling the required functions within wrapper functions. For people who don't want to dive into C++ its a very handy trick. I use it all the time for functions available in C++ but not in BP, like regex, or hit result under cursor (wasn't available prior to 4.2 something). I just checked and FoliageInstancedStaticMeshComponents can also call functions from a BFL.
@@mmertduman Hey! this is a while ago now, and I might be stretching here a bit. I'm in unreal 5 and trying to expose this function. for the life of me, I cant find the function to call in c++. do you have any pointers? I'd just like to read the custom data in bp.
I have been binging your videos lately. I hit a lot of roadblocks recently on a game project and your easy to follow explanations have helped me a lot. Specifically this one and the water shaders videos. Keep up the great work man.
For the people who found that the per-instance custom data doesn't work in standalone mode or packaged project, you might need to call BuildTreeIfOutdated(true, false) in the c++ class after you set the custom data.
For anyone who is a c++ noob like me, I spent 24 hours digging into stuff so you don't have to. Here are the steps to make sure this works in a packaged project in 4.27.2:
1. In your project go to File > New C++ Class
2. Click the checkbox that says Show All Classes
3. Search FoliageInstancedStaticMeshComponent and select Next
4. Name your new class whatever you want, make sure Public is selected, then create class
5. Wait for Visual Studio to compile and open your newly created files
6. In the header file (YourClassWhateverName.h), add the word "Blueprintable" inside the UCLASS function
7. Below GENERATED_BODY() add the following code:
public:
UFUNCTION(BlueprintCallable)
void RefreshCustomDataFoliage() {BuildTreeIfOutdated(true,false);}
8. Save and compile in your project
9. Now you can go to your original blueprint class (if you've already made any of this functionality), go to class settings and change the parent to whatever you named your class when you made your new C++ files. You should have access to the new function RefreshCustomDataFoliage which you can put after changing your custom data from in the video.
10. Go to the foliage editor in your level and change the Component Class to nothing then back to whatever you named it for this video (this should refresh your foliage after re-parenting, otherwise my already placed interactive foliage had disappeared)
11. Save everything and close your project, open your project again and build a new packaged game and voila!
*Note: Closing project and re-opening was necessary for me otherwise I got a build error when launching my packaged game
Hope this saves anyone some headaches.
Another great video, thanks! Just implemented this in my game to get resources in the world to react more when units are gathering them.
Yes!! Really awesome to hear. Would be the perfect technique for an RTS game or anything that requires a tonne of interactable objects
as always you give the juice of many amazing stuff that we couldnt figure out or even find YT vids to help with , thanks for sharing
Very happy to hear it :)
Thanks a lot for sharing this Charlie! This is gonna be super useful to me and a lot of other people.
what is this possible? :ooooooooo, this is really smart! I'm so happy you showed us this, this is a game changer for performance of foliage, I'm looking with my coworkers to make a variant of this technique to create all grabable items in our VR game :). Awesome vid as always Charlie ♥
We can for sure combine this with a constructor to create all items in a data oriented programming method which would be absolute poggers as we would only need to create the behavior component variants, a data table and the constructor, and in begin play it would generate all the items correctly with their respective behaviors :)
@@Fokkusu Yes! Haha glad you're already finding some use from the video :) My mind was blown when I found out we could change the foliage class haha
I very grateful indian guys for every tutorials but be honest my ears bleeding, finally found this dude quick usefull tips and trick thanks
Haha I’m glad you find the channel useful :)
Arcadian Rift and Prismatica in the same day? Hell yeah!
Seriously though thanks for the devlog, it was awesome.
Glad you liked it :) And I hope you learned something!
Amazing video, I learned a lot! Thanks for all your great work and keep it up!
Thank you for watching! It's awesome to see people learning stuff from my videos :)
My brushes don't jiggle jiggle, they fold. I like the way yours wiggle wiggles, for sure.
i try to find the way for changing the material of foliage at runtime literally take week and now finally at video with different title i get the solution thank you very much
i am surprise that it was just one node setup
Man these videos are amazing! You explain really well, you made me want to create my own game, thank you!
Your insight is always helpful. I've been sharing your vids with all of my classmates because your solutions tend to be pretty elegant to some of these design challenges.
I'm currently working on a game where some of the things I learned here will really help me bring the team's concepts to life (without killing performance). Is there a place where I can learn more about you and your work? I'd love to work with exactly what you do hahahahah
Thank you!! Really glad to hear that you and the classmates are loving the videos :) This RUclips channel documents everything I've ever done, as I'm pretty new to Unreal/Gamedev (about 14 months now) so I don't actually have any completed projects to show off yet haha
Great video! Thanks for useful information 😁
Glad you liked it :)
An asset named "YeahThisWillWork"... i love it lol
How do I get the take damage event in the Foliage Blueprint?
"YASQUEEN"
"YASQUEEN_MapleBush"
"YeahThisWillWork"
Hahahah you can tell I have great naming conventions :P
Where did Event Take Damage come from?
Great tutorial, but how did you get the "Event Any Damage from Damageable" in the Foliage Interaction Mesh Component??
ok solved it! But now how can I destroy that specific tree that I hit?
@@GorkaGames How did you solve this?
@@GorkaGames How did you get it to send the event any "Event Any Damage from Damageable" in the Foliage Interaction Mesh Component? I am stuck on the same part.
How did you solve this?
Hi, could you please explain how you solved this problem? i can see a lot of people here asking for your help. I cant find Event Any Damage either
Fantastic, its working, thank you!
The only problem is that i dont understand why is it working? We made custom parameter for a *material*, but we set it for *mesh instance*. Why did this parameter changing for material applied to this mesh instance?
Good question! So, each primitive in the engine can hold on to some simple data, even if it's in an instance/batch (location, rotation, etc) which can also be accessed in the shader. Custom data are just arbitrary bits of data that you can set yourself and can also be accessed in the material. So that's why we can have the exact same material on all the foliage thingos, but change a parameter on the mesh itself and get the desired effect.
This looks really sweet but having a hard time following along for a say basic setup that we could customize later... Any way that would be cool to make some time basic system from scratch? thanks guy!
Hey Mystory! Unfortunately I don't really have much free time to put together planned tutorials - all of my videos are improvised on the spot and more aimed towards intermediate users. Hopefully you'll be able to come back at some point and give it another go! :)
I'm not understanding the connection between the foliage instanced static mesh component, and the event take damage damage from damageable. I have a health system on my character, but I can't call it in the FISMC. I also tried making an actor component but can't add a component like I can on a player character blueprint. Any point in the right direction would be appreciated
Google- interfaces unreal, You use on component begin overlap on your player bp, You add the interface to the bush, they under the on overlap you get child components of the type the bush is check to see if it has the correct interface and then call the interface function on it.
Hey Charlie this is an awesome video! I manage to get it working and the only thing is that Custom Data some how doesn't work with PCG graphs in UE5. I was wondering if any other solution can replace the custom data . It only works with foliage tool.
Ok I found a fix if somebody is wondering. In the new created foliage class, call the node Set Num Custom data floats from Event Begin Play and enter 2 in the field. Or May be it's better to be called on the EventDamage... I dunno?!?!
Hey there :) Been really enjoying these videos, but keep hearing you mention the steams but no idea where to find them! Where do you do your streams?
Thanks man! You save my day!
This is amazing
You're amazing :)
Good video =).
I'm wondering if this can work with the grass tool, which the shaders use to procedural spawn grass tiles. There is a gassmap, I'm just not sure if it's accessible.
An generally, what if I'm streaming landscape tiles. I still need to test, once the old tile is unloaded, if the new ID's will start at zero again? Some sort of tile/index management system would be necessary then.
Would this work with multiplayer?
Nice RuneScape song
Yeeeeeeee OSRS soundtrack is the best soundtrack
Hey, this is really great! Is it possible to use with automatic grass?
Could you share the musics info? Ty!
It's the OldSchool RuneScape soundtrack :)
My foliages can't use Set Custum Data Value node, they even can't tigger break point in c++
Hey Charlie, have you figured out how to enable physics in a single foliage instance?
Could this work for grass instanced on the landscape material, if so how?
Unfortunately not, since I think the Landscape Grass is GPU-spawned procedurally and never really exists on the CPU. It also can't have collision, which would make it kinda useless as well. For interacting with grass you'll want to take a Render Target approach - you can check out the video about my new plugin as an example
@@PrismaticaDev Okay Thanks :0
@@PrismaticaDev distance fields could be an alternative.
Amazing tutorial, thank you! Is it possible to disable collision of individual foliage
Oooh great question... I'm not 100% sure! I think the easiest way would be to have 2 versions in the Foliage editor, one with collision and 1 without, but I'm not sure about collision for just 1 instance index
@@PrismaticaDev Thanks for taking your time and answering!
@@azizkurtariciniz No worries at all! I always try to respond to every comment :)
So cooool
No UUUU are
Interesting 🧐
Glad you think so! :)
Great info!!
бетта версия есть , где в это можно поиграть ?
My third eye? I use that to poop with... you didn't make me poop
How are you interacting with the individual foliage with that damage event. It seems like you are using an interface but whne I send a interface messege nothing happens. Is there a part I am missing, is there collision settings I dont know of?
Heyo Bob, make sure that "multi-body overlap" is enabled in the foliage class and then when you get the Hit event, the index of the instance will be in there
@@PrismaticaDev Thanks for the reply (lot of youtubers dont do that)! I guess thats why my sphere/line traces didnt work. I ended up figuring out a way to do it with collision overlap events. I was able to come up with some really cool dynamic effects with it. I am sure with more time there is even more potential. already have some more ideas lined up to try.
@@bobboberton349 I'm curious how you obtained the position of individual foliage using the overlap event, my Impact Point is always 0,0,0 and my foliage local position is always 12800,12800,12800
@@PrismaticaDev Ive been spending alot of time now trying to get the hit logic from the damage event to work but i just cant seem to get it working with the foliage specifically...
Its not giving me any specific foliage information when printing, would be awesome to see the logic in that part specifically.
I've fallen, and I can't get up!
Hahaha I'm tempted to leave that button in the game :P
Please let me pick berries.
Would you prefer blueberries or raspberries??
Great tutorial, just too loud music :-( It would be such much better without that.
Hi
hi
Heyyyyy
boing boing
Bush go brrrrr