Search Unity

Confused by how textures, geometry and the power of 2 work togethor.

Discussion in 'Getting Started' started by evan_ohara, Jan 21, 2018.

  1. evan_ohara

    evan_ohara

    Joined:
    Oct 28, 2016
    Posts:
    35
    Hey all. I'm not even sure what my question is, I just don't know how to approach this. I will ask this by example.

    How do i successfully marry a plane that is not in powers of 2 with textures that should be powers of 2?

    Also, is there such an idea as pixels per unit in unity? I play old games and notice the same textures applied to different objects and it looks goofy if you can't get the tiling ratios right. Is there a way to instead of setting tiling just set a global pixels per unit? (Or some idea like this, I just don't like how arbitrary it seems to me right now.)

    Thanks!
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Normally by setting UV values on the plane. Its not unusual to have a texture that has blank bits on it that don't get displayed.
     
  3. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    As Kiwi said, that's what UV mapping is. The Po2 thing doesn't have any meaning for meshes; just textures. If you think about what textures and meshes are, it makes sense.

    Textures are bitmap files composed of pixels. A pixel is really just a single point of color data.

    A mesh is a series of vectors (points) and defining data for how those points describe the mesh. So a simple rectangular plane would be 4 points, the two face definitions describing which sets of three points make up the two tris, and vectors indicating the normals of those faces.

    A mesh has no concept of pixels. They're points in 3D space. The same texture mapped to the same plane but with the mesh scaled 100 times larger would show the same texture data at the same relative parts of the mesh surface, but the actual pixels displayed would be quite different.

    Yes, but not for meshes. PPU in Unity is used for sprites and is sort of a way of altering scale.

    This was likely more out of necessity than anything else. Remember earlier how I said a rectangle would be 4 vertices? That's only if the mapped UVs share points. If you want to adjust the positioning of the planes' mapping individually, your UVs are considered 'islands' and when rendering, the vertices are actually duplicated. So avoiding island mapping is one way of saving precious memory.

    Additionally, textures have always been one of the biggest memory hogs (both RAM and storage space) for games, and back in the day, developers had to get very creative with how to reuse textures in order to avoid bloating the size of games and ensure they'd fit on game carts. This is a lost concept in modern gaming, with AAA games typically taking just under 100 GB of storage space and an almost guaranteed 16GB of RAM available.

    To what end? I'm not really sure what the issue is you're trying to circumvent here? Setting up tiling of your meshes? Avoiding the obviousness of tiling?
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    This sounds like the OP would benefit from downloading a modelling package like Blender to spend time learning how to UV map flat meshes to gain more understanding.
     
    Kiwasi likes this.