Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Problem with UVs when importing models from .blend or .fbx file

Discussion in 'External Tools' started by theguga96, Oct 22, 2019.

  1. theguga96

    theguga96

    Joined:
    Sep 22, 2019
    Posts:
    4
    Hi guys, I'm new to Unity and I'm trying to make assets for my videogame using Blender but I've encountered a problem when importing the models either from the .blend file or from an .fbx file Unity isn't loading UVs in the correct way. I've applied rotation,scale and position in Blender to the model but it isn't working. I've also tried to import a simple cube with no transformation applied and it doesn't work either.
    I've tried messing around with settings in Unity (swap Uvs, weld vertices, keep quads....) but nothing changed.
    Am I missing something?
    In addition I've added an image showing the shader I'm using (it makes the edges of my cubes emit light) and an image showing the shader applied to a cube made in blender (the left one) and one made in unity (the right one).
     

    Attached Files:

  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    1,788
    I've never had trouble with UVs going from Blender to Unity. Are you sure that your UVs were correct in Blender to begin with?
     
  3. kburkhart84

    kburkhart84

    Joined:
    Apr 28, 2012
    Posts:
    738
    Can you show your UV map in Blender for the model...I'm hoping you aren't applying materials using generated/automatic UVs in Blender, as those things don't get applied to the actual model and are only used when rendering and previewing in Blender. You should be able to snap a screenshot of the UVs of the model if you've done it right. If not, feel free to clarify so we can help.
     
  4. theguga96

    theguga96

    Joined:
    Sep 22, 2019
    Posts:
    4
    sorry for the late response, yes I've checked the uv in blender and it is correct. I've exported the uv, drawn on it and used it as texture and it works.
    I've tried using the same texture in unity and it works as well. The problem rises only when using the shaders
     
  5. theguga96

    theguga96

    Joined:
    Sep 22, 2019
    Posts:
    4
    to generate the uv in blender I've tried either using the smart uv project and manually putting seams on the edges. none ot them worked. as I said previously, if I aplly a texture in blender it is also recognized in unity, the problem rises only when using shaders.
     
  6. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    1,788
    Show your UV layout like kburkhart84 suggested. If I understand your graph correctly, the shader will only work properly if your cube is mapped the same way as the unity cube. Specifically, you need to have each side of the cube encompassing the entire texture space.
     
  7. theguga96

    theguga96

    Joined:
    Sep 22, 2019
    Posts:
    4
    Basically what wanted to achieve is to have the border of my model to emit light. But in this way, it can't be applied to a model that isn't a cube I imagine.
     

    Attached Files:

  8. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    1,788
    It can work just like you want, but you have to UV map every quad of your model so that it square fits inside of it.

    The square is basically a texture map. Imagine putting your UV layout on top of the square that you generated like this image.
    square_uv.jpg
    You see that two squares intersect part of the border, and the rest miss completely. That's why your cube looks the way it does in your first screen shot. You have to scale-up each uv island so that it covers the whole square. That means that each of the squares will all be on top of each other.

    By the way, Unity's built-in cube is already mapped this way, and that's why your shader works on it. You can test this by putting any texture on the built-in cube: you will see the whole texture duplicated on each side.