- Home /
Multiple (blended) textures per object/ material.
Hello everyone,
I realize that this has been asked about before, but I could not find a solid answer (or one I could implement). What I'm trying to achieve is a fairly customizable character (robot). I'd like players to be able to choose the base color, tint each decal (and exclude specific textures from customization). An example of what I'd like to create:
Material Robo1:
- Base Colour [choose-able]
- Texture (Mode: Overlay/ Add/ Screen): Metal plating. [not editable]
- Texture: Decal1 (i.e.: logo) [tint-able]
- Texture: Rust [not editable]
Now my question is not about the scripting itself, but rather:
- (How) can I add multiple textures to one material?
- (How) can textures' modes (such as add, overlay, etc) be set?
- Can a texture's tint/ hue be modified through JS?
I have no experience with Shading Languages, so writing my own shader isn't really an option for me.
Thanks in advance,
Patrick
Answer by Loius · Oct 02, 2010 at 07:13 PM
You need to create multiple materials (in your modeling program). You can then alter them individually (including shader, which is what provides the add/multiply/etc), and achieve the effect you're wanting here. You can still link the materials to the same texture, they'll just be able to be easily tinted.
Optionally, you could then create a texture programmatically based on how the user customizes their character. Save that texture in the customization screen, then, in-game, use that texture for the player model. That might be better performance-wise, but it's much more complicated. I haven't gotten to that point in my own game yet, so I don't have any code snippets on how to do it, but check out the Texture2D and Texture entries in the Script Reference
Thanks for your answer! I don't think I understand though. How would I go about making multiple materials? I can do it in Unity, but in Blender I typically use 1 material with X textures. In there I can only assign 1 material per object (except when I use Nodes). Also, I may be missing the obvious here, but (how) can I alter the Shader? Do you mean in it's Shading Language? I have no idea how I'd have to go about doing it coding-wise.
Thanks again for your reply though, I'll look into the Script Reference entries! =)
Answer by Ilovegames · Oct 22, 2010 at 05:13 AM
I this video will help you it is from youtube and it shows how to assign multiple materials so take a look at it and I hope it helps. http://www.youtube.com/watch?v=hCYViRJFf5w
Your answer
Follow this Question
Related Questions
Better to use multiple objects or textures with basic paperdolling? 0 Answers
Anyone have shader that supports two UV channels? 1 Answer
Playing a range of sounds from an object 0 Answers
How to apply a color to the second texture in this shader? 1 Answer
Spawn object with different material. 0 Answers