Jump to content
  • Advertisement
Sign in to follow this  
ibequa

Unity Create a polygon from a texture (2d)

This topic is 1025 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Let's say I've got a rgba texture, and a polygon class , which constructor takes an array of verticies coordinates(x,y). Is there some way to create a polygon of this texture, for instance, using alpha channel of the texture and so on...?

For example, in unity3d, when you add a collider to an object (doesn't matter whether it's a polygon, box, or a circle) the engine automatically generates it's shape according to the sprite it's being applied to.

BTW I'm taking about 2D.

Edited by ibequa

Share this post


Link to post
Share on other sites
Advertisement

This is not relevant if you are creating these textures proceduraly. But if you are talking about textures you already have then you should create the polygons or meshes for it too instead of creating these programmatically.

Edited by menyo

Share this post


Link to post
Share on other sites

You'll notice the ginormous number of triangles that Marching Squares puts out.

 

Don't forget to try running the Marching Squares output through a mesh decimation algorithm. I believe that MeshLab has such a filter. Hopefully it works as expected.

Edited by taby

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!