Material Question (applies to decals/particle effects)
Posted: Sat Dec 16, 2006 12:02 am
I'm coding a simple FPS, but have started adding more complicated features. I'm pretty confused on this current situation, and was wondering if you could lend me a hand with a theory of how to fix my issue-
I'm trying to create it so that when a bullet impacts a certain material (like cement or metal) the decal effect and particles thrown are different between the different materials. (So when i shoot a metal post it sparks or when i shoot wood splinters fly)
I've already coded my own decal system, and it can apply the decals and such correctly, but i can't figure out how to make it different between the materials.
I've tried manually applying materials to everything in the scene, but this takes way too much work and is innefficient. For example i design my map in 3ds then i tried making every different materialed object separately and placed it manually in the scene with a manually applied material (with my own material system).
I'm just asking for some opinions on how i could do this differently.
Material system example
I made a struct to cover materials and in this struct it has
"MaterialType;" as a variable. I then apply the material to the object and make the MaterialType= "cement" or "wood", etc. This kind of works, but if the level gets big the performance hit is bad since every hit the system checks for MaterialType and then applies a different particle effect/decal for each impact.
Also the material system covers sounds, lighting, etc so you understand my issue...
I'm not asking for code or anything just helpful suggestions.
Thanks in advance.
I'm trying to create it so that when a bullet impacts a certain material (like cement or metal) the decal effect and particles thrown are different between the different materials. (So when i shoot a metal post it sparks or when i shoot wood splinters fly)
I've already coded my own decal system, and it can apply the decals and such correctly, but i can't figure out how to make it different between the materials.
I've tried manually applying materials to everything in the scene, but this takes way too much work and is innefficient. For example i design my map in 3ds then i tried making every different materialed object separately and placed it manually in the scene with a manually applied material (with my own material system).
I'm just asking for some opinions on how i could do this differently.
Material system example
I made a struct to cover materials and in this struct it has
"MaterialType;" as a variable. I then apply the material to the object and make the MaterialType= "cement" or "wood", etc. This kind of works, but if the level gets big the performance hit is bad since every hit the system checks for MaterialType and then applies a different particle effect/decal for each impact.
Also the material system covers sounds, lighting, etc so you understand my issue...
I'm not asking for code or anything just helpful suggestions.
Thanks in advance.