Optimize with Custom Data | 5-Minute Materials [UE4/UE5]

  Рет қаралды 34,976

PrismaticaDev

PrismaticaDev

Күн бұрын

Пікірлер: 127
@TheJackuTV
@TheJackuTV Жыл бұрын
For those of you who are adding isntances to Instanced Static Mesh Component you need to use PerInstance Custom Primitive Data node in the material. That will then set the material values on specified instance instead of the parent instanced static mesh component.
@PrismaticaDev
@PrismaticaDev Жыл бұрын
Yessir! IF anyone is interested you can check out my "individual foliage logic" video for some examples kzbin.info/www/bejne/bKTNlGeaptR2fJI&ab_channel=PrismaticaDev
@_Caose
@_Caose 3 жыл бұрын
You are genuinely the most underrated channel about UE and gameDev. Clearly deserve way, WAY more recognition. Thank you for all of your work and effort on KZbin. You Rock! 🤛🏻
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Thanks so much!!
@irissantos4795
@irissantos4795 3 жыл бұрын
This is my favourite channel on youtube hands down! Honestly thank you so much for all your videos and amazing thorough explanation is everything you create! As a 3D Environment artist I feel like these videos are a treasure and really support me in the learning process and development of my skills in unreal 🌟
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
That makes me very happy to hear :) Thanks for watching!
@chaosklappstuhl4905
@chaosklappstuhl4905 Жыл бұрын
Thanks for all your short videos about one specific subject. That is really awesome as you don´t have to skip through hours of tutorials just to get to this one matter.🥳
@TyLovePie
@TyLovePie 2 жыл бұрын
🤯 This video opens up a whole new world that I didn't know existed! You are a the Lord of Materials my man. Thank you for this series. I have spend a lot of time trying to wrap my mind around materials and you just make it so simple.
@bitesizedtech8095
@bitesizedtech8095 2 жыл бұрын
Charlie you've become my favorite game dev on youtube! Keep up the great work and i hope that Prismatica will be a great success for you!
@sigrid714
@sigrid714 Жыл бұрын
I can't believe I never knew about this! This is a total game changer. You are to UE Materials what Mathew Wadstein was to UE Blueprints.
@Kekzmann
@Kekzmann 2 жыл бұрын
The whole vid i was like: I know that music. And then it hit me. OSRS bangers. Nice choice. Perfect background music.
@jennifer.c.miller4428
@jennifer.c.miller4428 2 жыл бұрын
Thank you! I've been trying to find videos about this subject!
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
You're very welcome! :)
@Sivxgamer
@Sivxgamer 11 ай бұрын
Dude exactly what i needed!
@johnmannp
@johnmannp 3 жыл бұрын
Thank you so MUCH for these tutorials!
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Thank YOU so much for watching and supporting as always :)
@LookItsCollin
@LookItsCollin 3 жыл бұрын
What a cool video. Had no idea this was an option. When I had small props like bottles I always used an atlas for different labels and colors. This looks like it could handle that and tons of other stuff at the same time
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Sure could! With the benefit of not needing to have a separate mesh for each bottle and let them all instance together
@erfanbahrami573
@erfanbahrami573 2 жыл бұрын
Hi Charlie Im new to this channel but I must say your videos are fantastic and I've learned so much new things because of your content.. Thank you and keep up the good work
@ebmclovin
@ebmclovin 8 ай бұрын
Ive noticed if you fullscreen itll reduce those draw calls more, giving you a more accurate number. I believe the editor ui elements contribute to draws.
@PrismaticaDev
@PrismaticaDev 8 ай бұрын
Yep, very true. In fact a lot of things in the profilers are affected by the Editor UI so it's always good to fullscreen
@aurintalik
@aurintalik 3 жыл бұрын
You're the best! But also a monster because now I have to go add this to all my materials! \o/ Glad to see the 5 minute materials are back. :)
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Haha you will thank yourself down the line :P
@vincentdautremer3869
@vincentdautremer3869 3 жыл бұрын
welldone it's amazing for optimisation ! Incredible as usual !
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Thank you! :)
@lennybunny93
@lennybunny93 8 ай бұрын
A little PSA to everyone having the same issue. If in UE5.1and later if your custom primitive data doesn't show during runtime while using a Blueprint, it's because you need to setup a default custom primitive data value in Blueprint, after you set the default you can change the value using the set custom primitive data
@yongbinren8810
@yongbinren8810 2 жыл бұрын
Such cool idea, thanks for sharing this
@Malindu-dazz
@Malindu-dazz 6 ай бұрын
Wonderful video. How couldn't I know about this :(
@t3hpwninat0r
@t3hpwninat0r 3 жыл бұрын
I can see the value of adding a component to an actor that gives me buttons in the editor for randomising custom data floats or using the colour picker to set values at a particular index, or even setting values based on some other thing like world z position, copy scale value into custom data float, and of course the most obvious one is to let the actor's blueprint change the value at runtime for whatever reason, like maybe to control how high the red part should be on an old mercury thermometer
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Yesss absolutely - I've been thinking of making a tool that allows the use of an actual colour picker etc instead of the 3 floats haha
@Greenman4890
@Greenman4890 Жыл бұрын
My life has been changed lol thank you
@yurifox5341
@yurifox5341 2 жыл бұрын
man...YOU ARE LEGEND! I started my game project( and one ofy life goal😅) and you really help me understand about unreal techniques that is not easy to find Thank you so much for bringing so much information🙏🏽 Really hope to play your game 😁
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Really glad you're finding the videos helpful :) Don't forget to share with friends!
@captaindeabo8206
@captaindeabo8206 3 жыл бұрын
This is brilliant thanks. i asked myself somtimes what s meant whit the term in UE. Now i Know it Thanks . But i have one point of critique: The Index of a list or arrays are always Integers not a floats. 1 and not 1.0. Its used to numerated or count entry`s in an data structure this is done whit natural numbers. Its like the numeration of the drawers of a shelf. there is usally no onehalf drawer. In this case serval Material paramters (or data in form of a float) are stored in on drawer or(list entry) and numerated via the assignmend of an index (integer).
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
You're correct - although when I say "custom data floats" I mean that the values assigned to each index/ integer are floats, not the indices themselves haha
@LookItsCollin
@LookItsCollin 3 жыл бұрын
HE'S BACK!
@Fokkusu
@Fokkusu 2 жыл бұрын
yoo this shit is lit 🔥🔥 fam 👌😆 💯. Now in a more serious note, if material instances help a lot by being well, instances with allow for variants for the same mat, this is like the same improvement from using different materials for each variant with instances but this custom data improves on the instances, this is WILD. I'm 1000000000000% going to use this. Thanks a lot for this tutorial! :D, this is going to be PERFECT for our object instance system, we will be able to basically instance ALMOST EVERYTHING now
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Haha very glad to hear! Glad I could show you this system :)
@QuiteDan
@QuiteDan 10 ай бұрын
I'm using custom data now to make gradients along a spline mesh.
@dreamingacacia
@dreamingacacia 2 жыл бұрын
I'm not sure if there is an update on this topic but I found this accidently. So I ticked the custom primitive data while the node selected then the name of the parameter including their variables appeared at the object, with this is simpler and nothing to confuse about. Therefore I don't need to be too careful when changing the variables. I'm not sure if this is because they updated it or I just happened to found a better way, but I think I should mention here.
@darkpixal
@darkpixal 3 жыл бұрын
King shit tbh 👑
@unrealdevop
@unrealdevop 10 ай бұрын
Great video, I've been wondering how that batching (Auto-Instancing) worked. I recently heard about it and learned it was introduced in like 4.22 or something. Had no idea that was even a thing.
@leetness13
@leetness13 Жыл бұрын
thanks for the great tutorial ! also there is no way to have dynamic instanced meshes with translucent materials right ? as soon as I switch the material to translucent, it doesnt work anymore
@PrismaticaDev
@PrismaticaDev Жыл бұрын
Hmmm... I'm not actually sure! I'll need to test it out myself to confirm. Maybe if the actors are all set to be Static it will have an easier time dyna-instancing them. It could also be something to do with the separate pass for translucent stuff. I'll report back after some doodling!
@leetness13
@leetness13 Жыл бұрын
@@PrismaticaDev yep everything is static I double checked. and yeah that would be awesome if you could tell me more about that, thanks a lot comrade
@bibigulchik
@bibigulchik 2 жыл бұрын
Thank you!
@alhusseinali
@alhusseinali 10 ай бұрын
Yo, I used to use "dynamic martial instance" to change the texture but it seems like it cause a drawcall per every mesh get applies, the solution is to use a new method called "Custom primitive data" but I wonder Can I use this method to change the texture maps or just the color?
@PrismaticaDev
@PrismaticaDev 10 ай бұрын
Hey hey! You can, although it will increase the shader complexity slightly. You'll need to set up a Switch node with all of the textures being sampled (not a big deal if it's just 2 or 3) and then in to the Value input, you'll put a Custom Data value. So all 3 textures will be sampled, but then you use Custom Data to "show" which one you want, without needing to do dynamic materials.
@rahulnmahajan7224
@rahulnmahajan7224 3 ай бұрын
A question!! Can we use different textures instead of color as custom data parameter? If yes, how?
@PrismaticaDev
@PrismaticaDev 3 ай бұрын
Hey there! You can't "actually" pass through a texture with custom data, however you can use custom data to drive a Switch node between different textures, or you can use a Texture2D Array and use a custom data value to change the W value (the 3rd axis of UVW)
@3DWithLairdWT
@3DWithLairdWT 3 жыл бұрын
Are the custom data values something you can manipulate in BPs during construction or during gameplay? I'd love to implement this into my Trim Sheet based Env project
@PrismaticaDev
@PrismaticaDev 3 жыл бұрын
they absolutely are :) If you have a reference to the static mesh just drag a pin off of it and look for "set custom primitive data" or something. It's a much better option than setting a material parameter because when you set a material parameter at runtime, it automatically converts that material to a Dynamic Material Instance (which will break instancing/batching for that object)
@alhusseinali
@alhusseinali 10 ай бұрын
Hey there, I converted a texture sample to parameter and then when I try to search for "use Custom Primitive data" it wasn't there .. my question is .. can I use this feature with textures parameters as I used to do when I was using dynamic material instances ?
@PrismaticaDev
@PrismaticaDev 10 ай бұрын
Correct - Custom Data is limited to floats only, like UV data and Vertex Colour. However, you can sample multiple textures and then use Custom Data to Lerp between them, or use a Switch node :)
@alhusseinali
@alhusseinali 10 ай бұрын
@@PrismaticaDev Yea I just watched this tutorial and it reminds me about what u told me two weeks ago : kzbin.info/www/bejne/b3jLgKVpaLqprtE Thanks bro you are the best.
@Nefrann
@Nefrann 3 жыл бұрын
Thank you so much for this! Can you use it with Foliage actors? I can't find the "Custom primitive data" option anywhere in foliage stuff :/
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Hey hey there! Unfortunately it isn't exposed by default within the foliage tool, although it's definitely on the foliage instances since I use it to do instanced foliage interaction.
@semirukiya5308
@semirukiya5308 Жыл бұрын
This is great! But I guess it's limited to use normal material types because when it comes to stuff like Material Layers the same one Custom Data parameter would affect all the layers, right?
@PrismaticaDev
@PrismaticaDev Жыл бұрын
Correcto, yeah. Unless you specifically set up different custom data values knowing which affects each different layer
@semirukiya5308
@semirukiya5308 Жыл бұрын
@@PrismaticaDev Is there any way to get around the limit of 35 index count, tho?
@IstyManame
@IstyManame 6 ай бұрын
What's the custom commands window on the bottom? Is that Editor Utility Widget?
@boraycobanoglu1372
@boraycobanoglu1372 Жыл бұрын
this would apply for more complex shaders too right? let's say we are using vertex colors with multiple normal and roughness maps overlays, variations etc. how would one go about at this then?
@_batt
@_batt Жыл бұрын
Here's a question for you, do you think it would be possible to use a scalar custom data as sort of an "index" to choose between a set of different textures in the same material? Like for example, I have a sign model but a bunch of different decals that go on the sign. The scalar is hooked up somewhere in the sign's single material, so if I put in "2" it chooses the second texture, if I put in "8" it chooses the 8th texture, etc. I have the idea in my mind but I'm not familiar with the math required to make it work.
@PrismaticaDev
@PrismaticaDev Жыл бұрын
Yep! Absolutely. You can use the Flipbook function for exactly that
@_batt
@_batt Жыл бұрын
@@PrismaticaDev Thank you! That was exactly what I was looking for.
@3nany
@3nany 2 жыл бұрын
is there a way to make a parameter with only 3 floats in to a custom data. I have base colours that don't have an alpha channel and if i convert those to custom data it adds a 4th channel. Great vid btw. I absolutely am currently making multiple material instances just for colour variation like you explained and this would be way more efficient.
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
I think the only way would be to make 3 single float values and then fed them in to a MakeFloat3 node.
@3nany
@3nany 2 жыл бұрын
@@PrismaticaDev yeah that's a decent workaround. was hoping for sth that uses just one node but thanks this is probably what i will use :)
@Samelion
@Samelion 3 жыл бұрын
Do you know if its possible to access this custom data in post-process?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Unfortunately not, unless you wanted to do some hacky stuff like plug the values in to the Subsurface output and then use the Subsurface buffer in the Post Process
@DevGods
@DevGods 2 жыл бұрын
I wonder whats causing the gpu to run an 20 ms. The amount of triangles?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Oh, I have my FPS locked to 50fps when I record/stream so the GPU is idle for the majority of frame time :)
@unrealfreedom1807
@unrealfreedom1807 Жыл бұрын
Hey this is an amazing tutorial thank you for all your work! How did you achieve these shadow details? There is a pattern in the shadows. How did you do this?
@PrismaticaDev
@PrismaticaDev Жыл бұрын
It's just some basic cel-shading :) It turns gradients in to distinct bands which results in some nice textures
@aeonkitsune3132
@aeonkitsune3132 2 жыл бұрын
Do you think it would be possible to use custom data on an npc that gets skeletal mesh merged at event begin play? I'm poking around with it, and the way I currently have it, in the blueprint viewport my custom data adjustments are showing up, but after getting merged when I hit play to test the game it gets reset. My guess is the new merged mesh doesn't keep the custom data. Do you think there's any way to transfer the custom data into the skeletal merged mesh?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
You should be able to use the “set custom primitive data” function in blueprint to change the custom data at runtime :)
@aeonkitsune3132
@aeonkitsune3132 2 жыл бұрын
@@PrismaticaDev Thank you so much for the quick reply! It's a bit late where I am so I'm hopping off for the night, but I'll definitely try that out tomorrow.
@mindped
@mindped Жыл бұрын
Are there any negatives to doing this?
@PrismaticaDev
@PrismaticaDev Жыл бұрын
It can be a little difficult to manage, for example you might have 2 materials that are using custom data index 0 to do different things. However in Unreal 5, you can search for a custom data index by name which can help with that. As long as you manage it all properly, there’s no downside
@mindped
@mindped Жыл бұрын
@@PrismaticaDev what if i have a building with 1000 bricks.(just an odd example) Would setting the custom data on every brick bring any kind of negative? Memory? anything?
@PrismaticaDev
@PrismaticaDev Жыл бұрын
@@mindped Each of the bricks would need to keep track of 1 piece of data each (a few bytes of data, aka nothing). However, if you were actively setting it on all of them per frame you'd chug a but
@mindped
@mindped Жыл бұрын
@@PrismaticaDev Im glad i found this video. Very awesome potential here. Subscribed :D .. may even hit you up if you are ever interested in freelance work.
@mindped
@mindped Жыл бұрын
@@PrismaticaDev Does not look like HLODs or packed level actors/material instances are supported with this. Unless you know of a way to make them work. HLODs do use the color information or any of the variables. And packed level actors have the same problem...
@SockeYoutube
@SockeYoutube 2 жыл бұрын
Is there also such an optimization for decals? I wanted to make a game like Splatoon but each decal costs 1 drawcall and that is extreme. All decals have had the same material.
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
I'm not entirely sure, but I believe splatoon uses runtime vertex painting for their splats. Decals can be pretty expensive on the rendering side, let alone the draw calls, so it's always fun to think of alternate solutions. Maybe check out my videos about my Blood system for some inspiration!
@Alaabale
@Alaabale 3 жыл бұрын
if you hold v you can get color or vector paramter
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Thank you! I will remember that haha
@iuliandobrogeanu3762
@iuliandobrogeanu3762 4 ай бұрын
I tested it currently with texture arrays applied to planes , for some reason the draw calls is higher on the planes using one MM , yet the planes using different separate MI's is lower , I don't really understand why is it so even tho I used the same commands
@xdragon5502
@xdragon5502 2 жыл бұрын
Do you have a tutorial that shows how to set up this material switching?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Which switching are you referring to?
@xdragon5502
@xdragon5502 2 жыл бұрын
@@PrismaticaDev The "Custom Primitive Data Default"
@cgkrab
@cgkrab 2 жыл бұрын
This is great
@rtgchannel4154
@rtgchannel4154 2 жыл бұрын
Can you please wake tutorial, or tell how to make comic shader? With dots and lines on edges or in a shadow? I can't find a tutorial on youtube or somewhere else
@aeroljohn3331
@aeroljohn3331 Жыл бұрын
so u telling me I can have 10 index of contants parameter and still count as 1 draw call as a material?
@mindped
@mindped Жыл бұрын
Any idea why many of my parameters are showing up as Undeclared (even though they work fine)... while other parameters also work fine but have the name and clickign them takes you to their location on the material?
@polyvival-fpssurvival7659
@polyvival-fpssurvival7659 2 жыл бұрын
Can we just use it on things that we place by hand in the level? Foliage we can't ?
@plasid2
@plasid2 3 жыл бұрын
its something similar to apply the same LODs for multi static meshes? I freak out clicking every single static mesh and chenge number of LOD and camera distance value
@marcusunivers
@marcusunivers Жыл бұрын
My approach is to create Actor Blueprints with puplic variables for manipulating each Mat Inst. But for an easy and dirty way this is good ;)
@zhixoworld
@zhixoworld 10 ай бұрын
we can't use custom primitive data with decals?
@paradox8425
@paradox8425 2 жыл бұрын
Does it reduces movable meshes draw call too? Or is it static only?
@RikiB
@RikiB 4 ай бұрын
For some reason this defaults the value to 0 on every single mesh using the material. It ignores any value you set in the material instance. So of you are trying to use this to change colors or to multiply something its always going to default black? Why doesnt it at least give an option to default to 1?
@RikiB
@RikiB 4 ай бұрын
Its a bit of a workaround but you could just plase and Add node and put the custom data into the A slot - then plug that into your graph. It will change the default to 1 at least. Better than having everything black.
@Extrone
@Extrone 2 жыл бұрын
Thank you, just reduced my draw calls from around 4000 to just 145
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Amazing!
@gursimransingh8726
@gursimransingh8726 3 жыл бұрын
Pls also about volumetric clouds pls specialy cloud sample attributes node
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Unfortunately I've never actually used volumetrics - might be something I do in the future though :)
@gursimransingh8726
@gursimransingh8726 2 жыл бұрын
@@PrismaticaDev ok waiting for your implementations
@peekstone
@peekstone 3 жыл бұрын
Wow - why is this so hidden? - it seems rather important 😅 Thanks for the video about it!
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Haha Unreal is a very deep cave to explore :P
@Jake-co7rt
@Jake-co7rt 2 жыл бұрын
What are "Drokols"? JK. LOL. Our differing accents did confuse me... momentarily. As always, thanks for doing these wonderful super-informative vids. (c:
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Hahahaha drahw cahls!
@Jake-co7rt
@Jake-co7rt 2 жыл бұрын
@@PrismaticaDev I'm from the South-Eastern US, so you nailed it. (c:
@TheDigitalBlaze
@TheDigitalBlaze 2 жыл бұрын
I have only one question: why not variables?
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
As soon as you change a variable (material parameter) at runtime, the material is turned in to a dynamic material instance and can no longer be batch-rendered
@xylvnking
@xylvnking Жыл бұрын
this is the sauce
@mrGreen1539
@mrGreen1539 Жыл бұрын
stat unit
@miloszgierczak4806
@miloszgierczak4806 3 жыл бұрын
@kurvaosobne3897
@kurvaosobne3897 3 жыл бұрын
CUSTOM DARTA
@mrzero2089
@mrzero2089 2 жыл бұрын
theres much esier way but not the best in optimize. it is by using dynamic materials
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
Correcto - however using a Dynamic Instanced Material will prevent the mesh from being dynamically batched/instanced. Custom Primitive Data allows them to be batched together in to 1 draw call
@amooseinaroom1228
@amooseinaroom1228 3 жыл бұрын
everything is the DEVIL to you charlie :'(
@PrismaticaDev
@PrismaticaDev 2 жыл бұрын
You're the DEVIL!!!
Two-Sided Sign Node | 5-Minute Materials [UE4/UE5]
8:40
PrismaticaDev
Рет қаралды 18 М.
Reducing Draw Calls in Unreal! [UE4/UE5/Blender] (Check Description!)
40:11
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
5 Tips to Optimize Environments in Unreal Engine 4
12:23
Intro to Vertex Colour [Unreal Engine]
28:06
PrismaticaDev
Рет қаралды 35 М.
Distance Fields (Part 1) | 5-Minute Materials [UE4/UE5]
9:20
PrismaticaDev
Рет қаралды 119 М.
D-Buffer Decals changed my life! [UE5]
24:12
PrismaticaDev
Рет қаралды 21 М.
Simple Global Wind in UE4 (One weird trick! Everyone hates him!)
19:01
Stylized Material UE5 (Cel Shading) How to | Part 1
17:30
Unreal Bucket
Рет қаралды 2,5 М.
Material Parameter Collection | 5-Minute Materials [UE5]
13:05
PrismaticaDev
Рет қаралды 25 М.
Maximizing Your Game's Performance in Unreal Engine | Unreal Fest 2022
41:53
Quick Fixes for common overlay material problems - UE5
5:29
Edward Bennett
Рет қаралды 1 М.