• Creating Material dynamically
    6 replies, posted
Hey everyone, I wanna create a Material out of two Materials (merging it). The reason is simple: I want to use it in DImage:SetMaterial(...). Therefor, I need to use the first Material, coloring it and then put the second Material above. Is there a way to dynamically create Materials? (I thought about drawing them, receiving texture from screen and setting the texture of the material, but idk how to get this texture out of the screen...)
What about creating your own derma control? Yeah, you can create a rendertexture and do that, but to be honest it's not worthy if you can create your own control
What do you mean with "rendertexture"? It is worth I think, because it could save performance instead of loading 2 Materials all the time. I need them at different places
No, it doesn't work like that at all, rendertexture will be way slower (It's not like it will affect at all, but are you really taking care of caching 2 materials? No) You don't load 2 materials every frame, you only do it once when you require them and then those materials are stored in memory, if you create a render texture, you're still caching both materials, if you don't tell us your real scenario, i can guess you have no idea what are you trying to achieve
Okay I have a base texture. This texture is all the time the same, but it will get colored in the teamcolor of each player. After that, an icon for the player's class needs to be drawn on the colored basetexture. I thought that it could be possible to store this result as a new material.
Huuh...Did you just try to SetColor the texture in DImage? Still not sure why do you want to merge 2 materials
You can use a rendertarget GetRenderTarget render.PushRenderTarget draw your materials to the rendertarget then set the rendertarget to the $basetexture of a fresh new material mymaterial:SetTexture("$basetexture",myrendertarget) Then presto, your new merged material
Sorry, you need to Log In to post a reply to this thread.