isidisi Posted December 15, 2011 Share Posted December 15, 2011 I need to change materials of meshes dynamically(using PaintSurface) and I find the following problem: If I load the same .gmf using LoadMesh 2 times, LoadMesh returns the same reference. Thus when change a material in first object with PaintSurface, also changes in the second. Is there any way to load gmfs more than once and get diferent instances, to change the materials independently? Thanks Quote Link to comment Share on other sites More sharing options...
DaDonik Posted December 15, 2011 Share Posted December 15, 2011 I'm not sure if changing the materials will be possible in Leadwerks3D, because it is not yet released. In Leadwerks Engine 2 there is no way to change the material for a specific instance of a model. You pretty much have to copy the .gmf file and rename it. That way it is the same model but you can use a different material for it. Quote (Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI) Link to comment Share on other sites More sharing options...
isidisi Posted December 15, 2011 Author Share Posted December 15, 2011 I'm not sure if changing the materials will be possible in Leadwerks3D, because it is not yet released. In Leadwerks Engine 2 there is no way to change the material for a specific instance of a model. You pretty much have to copy the .gmf file and rename it. That way it is the same model but you can use a different material for it. Yes I know this, but is not a clean solution. It will be better to add a parameter to LoadMesh function in a future version. Same with materials... Quote Link to comment Share on other sites More sharing options...
Rick Posted December 15, 2011 Share Posted December 15, 2011 LE3D will have that. Another solution for LE2 is to use a shader that lets you offset a giant texture that has the textures you want to use from a value in SetColor I believe. Here is the post and somewhere in here is the shader file you can try out. http://www.leadwerks.com/werkspace/topic/607-non-instancing-copy-command/page__p__5296__hl__instancing__fromsearch__1#entry5296 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.