- Home /
How to render polygons in unity?
I have developed an algorithm to create a map with mountains and such based on height and moisture. I have got a lot of polygons which I would like to render, each with vertices with their own X Y Z position...but I dont seem to find a way to draw anything in Unity which is frustrating me since this was so much easier in XNA.
I have tried creating a mesh but dynamically but it is just so slow and it also has a maximum number of vertices.. I just want to create lots of flat surfaces specifying each vertex's position..is there a way to do this in unity?
Thank you!
You said you tried creating a mesh dynamically but it's slow, so it sounds like you have already found the solution to making dynamic meshes. That is what you want to do right? If you want better speed and to use the built-in terrain, you could develop an external tool based on your algorithm to generate a heightmap, and load it into the Unity terrain. Or you could build an external tool to generate the mesh data itself and load it as a mesh. Are you really asking if there's a faster way to do it? We would have to see your code to help with that question. You can create lots of flat surfaces, specifying each vertex's position in Unity. I wouldn't recommend creating them as separate $$anonymous$$esh elements, so how you approach it will depend on how you texture, if you're using a LOD based algorithm for your terrain, etc. If you can post some details, I'm sure someone will be glad to help.
Creating meshes dynamically is typically very fast, so I guess you should optimize your code. You can create multiple meshes in order to bypass the max vertex per mesh limit, which is better for culling anyway. You could also use a vertex shader.
hey eric, I finally managed to render meshes very fast optimizing my code as you said.. I am having problem texturizing my shapes since their shape is irregular..I want the texture to repeat x ammount of times over the surface (mesh).. is this possible?
Your answer
![](https://koobas.hobune.stream/wayback/20220613145645im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Mesh Probs 1 Answer
Why windZone is not working on my 3d model 1 Answer
Looking for a method of creating "Ground meshes" without adding tons of models to my project. 1 Answer
Meshes instead of terrains 1 Answer
Lines / markers on terrain 0 Answers