- Home /
The UVs of the detail mesh objects need to be in the 0-1 range?
I'm trying to create a simple rock mesh as a detail mesh, following instructions here.
http://unity3d.com/support/documentation/Components/terrain-DetailMeshes.html
Needless to say, if I use the standard assets rock, I am perfectly able to add the rock to the terrain mesh details list, and then I'm able to paint the rock into the terrain.
However if I use a mesh created by me, a simple mesh with a simple texture correctly mapped upon it, upon placing my rock detail mesh will get the first texture of the terrain details list. I am aware that the object needs be added as 'vertex lit' so that's not the issue. It's actually plain obvious that the texture is the first of the atlas. Besides, If I manually place the mesh into the scene, it will be rendered correctly instead.
My conclusion after several hours wasted upon this retarded issue, is that there's a problem with UVs... but I can't figure out what on earth the documentation means.
Where do I set the UVs range? In the 3d editor? I've checked out with blender and even if I perfectly know how to set and map an image into the 3d model, I am unable to understand what are these UVs the documentation speaks of.
Please help me understand what are these UVs the documentation speak of, and where or how am I supposed to set their range into "0-1".
Thanks.
UVs are texture coordinates. They map vertices in the mesh to pixels in the texture, so that the system knows which parts of the texture belong to which parts of the mesh. It's like wrapping an object in gift paper and putting needles through the gift paper to pin some specific coordinate of it to some specific point on the object.
Take a look at this page:
http://www.rozengain.com/blog/2007/08/26/uv-coordinate-basics/
It explains how to set the UV coordinates to correctly wrap a texture around a cube; it $$anonymous$$ches you what UVs do in further detail. Don't read too much into the code samples, it's for a different graphics system and not relevant to Unity. But the underlying principle is the same.
Answer by roamcel · Sep 06, 2011 at 06:47 PM
Thanks for the help. With your explanations about uvs I got to understand that the range unity speaks of is the actual POSITIONING of the UV UNWRAP of the mesh, into the texture space.
More precisely: if you unwrap an uv map of a mesh, you can position the uv map OUTSIDE of the texture space, which for example in blender is very easy to see, since you'll have the image, and outside of its bounds, you'll have the uv map's polygons.
The texture mapping performs all the same, since the texture is tiled, but the uv unwrap clearly gets a mapping index which is not in the 0-1 range, which belongs to the "image on the center".
I accessed my mesh, repositioned all of my uv unwrap polygons inside of the texture area, and reimported and voila, textures are mapped correctly in my rock detail mesh.
Answer by garrus · Sep 06, 2011 at 12:04 PM
I'm not an expert on this but 0-1 range means pixel values must be converted to 0-1 so a pixel coordinate of 0,512 on a 512x512 texture would be 0,1 on a 0-1 range. So 256,512 would become 0.5,1 etc.
Your answer
Follow this Question
Related Questions
Assigning UV Map to model at runtime 0 Answers
Problems with Textures, Cinema4D to Unity 3 Answers
Voxel texturing with single texture instead of texturesheet? 0 Answers
Can I feed ShaderGraph a UV map? 0 Answers