Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Is it possible to apply a tiled sprite to a custom mesh?

Discussion in 'Editor & General Support' started by janimator, Apr 25, 2019.

  1. janimator

    janimator

    Joined:
    Apr 5, 2013
    Posts:
    52
    I'm running into a little issue with my project and I'm hoping someone might have a clever solution to my problem. I am currently trying to texture my custom mesh with a tiled sprite in hopes of utilizing the atlas and ultimately reducing draw calls. Let me try and explain.

    For my project, I'll be creating a bunch of flat meshes at runtime. These meshes will all have different shapes kinda like this one here. I started researching different solutions to create these shapes in a very efficient manner, but I'm stuck between two options that have downfalls.



    Option 1: I was playing around with Unity's new SpriteShapes. While the tool is awesome and can get the job done, the meshes that SpriteShape's generate are a little overkill. The shape I generated there is relatively simple and shouldn't need all those extra polygons. On the other hand with SpriteShapes I can utilize a Sprite Atlas and reduce the draw calls significantly when combined with all the other sprite elements in the game.

    Option 2: I implemented my own custom mesh generator which does wonders to the polygon count. Also, since it's my own implementation I have full control over it. Unfortunately, I can't figure out how to texture it with a sprite utilizing an atlas. Instead, I texture my mesh with a Material. Due to this, I will likely be getting a lot of draw calls when more elements are in play.



    I'm still actively trying to find a solution to my problem. I would love to utilize both the low polygon count and the added bonus of using a sprite atlas to reduce the draw calls when matched up with various other sprites. Is it at all possible to texture my mesh with a sprite? Are there any other solutions anyone can think of? I'm open ears. Thanks in advance for any ideas/suggestion.
     
  2. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    638
    @janimator, it is possible to set level of detail for polygons generated by SpriteShape using Spline Detail setting . Please check the enclosed GIF.

    GeometryDetail.gif