Textures, Materials, Meshs and Maps?
I have a few questions that i hope can be answered. What is a texture, a mesh and a materiel. I think a texture is the thing that goes on an object to provide details to it and materials to colour it. I think meshes are 3D things. Can someone help me understand the differences between these and what each one does? And i have zero clue what a map is except it help pull things forward and back on a texture i think.
If i have a house and want the front to be different from the back and sides. Like a door for the front then something plain like orange walls for the sides and back. what do i use a texture, a material or a mesh. And how would i do it?
Any and all help is appreciated.
Answer by Statement · Oct 22, 2015 at 04:51 PM
A mesh is a collection of indices and vertices. A vertex is a point in space and can have associated color, normal, uv coordinates and other vertex attributes. Indices are numbers that together with the topology of the mesh define primitives, such as triangles.
Simplified, you can think of the vertices as being dots on a paper with a number associated on them. The indices are a list which says which which vertices to use to build a primitive. Think of it as a connect the dots blueprint:
Except, usually we are connecting triangles or triangle strips instead of line strips in computer graphics. A mesh would define the "physical shape" of your building.
A texture is like a plain image, with some added properties. Images have wrap modes, filter modes and other settings that you can apply, such as mipmaps. For your house example, a texture would likely contain the color to paint all of your walls etc. It is what gives it "texture". Hence the name. It is created with an image editing software, such as mspaint if you are a crappy artist like me, or photoshop if you are one of those rad artsy guys. Then it is imported into Unity.
A material is something that exposes properties for a given shader. A material by itself is not much more than a few values you can set and a reference to a shader. A shader is a piece of code that contain a vertex program and a fragment program. A shader is executed on the graphics cards GPU. The vertex program rearranges the vertices and the fragment program define the colors that will be output to screen. A shader uses vertices from the mesh and textures from the material.
Unity will render a mesh for you if you have a MeshRenderer component. It will use the mesh found on the MeshFilter component. You set the material on the MeshRenderer to specify what shader and which properties (textures, colors, other info) the shader will be supplied when executing on the GPU.
If i have a house and want the front to be different from the back and sides what do i use a texture, a material or a mesh.
It depends on how you want it to be different. Do you want the back to have a different shape? It would most likely be a different mesh. Do you want the back to have a different texture? You need either to update your texture or mesh in a mesh editing software such as maya, max or blender (I dont know what artists use, I am a coder) - to UV map that side to a new area on a texture. To be able to change material for the other side of the building, the other side of the building has to be a separate object.
I recommend you get a book on computer graphics and study it to learn it better.
I forgot to say what i what the difference for the house would be whoops i'll sort that the now. But i was thinking like a door for the front then something plain like orange walls.
Thanks for the answer
I am sorry but I don't understand what you are saying.
Sorry about that i am not great at explaining things. So say i want a house with orange walls for the back of the house and the left and right sides. Then i want a front door for the front. What do i use/do to stop the door going onto all 4 sides of the house. I tried using a texture but not knowing what they are fully and what they do i kinda failed.
The walls would be one mesh.
The door would be one mesh. (If you want to open it)
Both meshes can use the same material, if you've UV mapped both the wall and door on the same texture.
Ok thanks a ton for explaining this to me and helping.
Your answer
Follow this Question
Related Questions
Looking for help with creating a gold texture/reflection for mobile games 0 Answers
Prevent Stretching of Image on Material Assigned to a 3D Plane? 0 Answers
Putting material on one thing puts it on all the things... 0 Answers
Apply texture/materials without stretching them according to the surfaces of the 3D structure 0 Answers
Can unity only show some specific color? 2 Answers