Back to articles
Real-time Conversion of Polygon Vertices from Rectangular to Cylindrical Coordinates in Unity

Real-time Conversion of Polygon Vertices from Rectangular to Cylindrical Coordinates in Unity

via Dev.toShoichi Okaniwa

Introduction In Unity, I needed to convert polygon vertex coordinates from rectangular (Cartesian) coordinates to cylindrical coordinates in real time, so I created a Shader for that purpose. The sample Unity project is available here: https://github.com/segurvita/UnityCylindricalCoordinate What It Does The animation above shows the actual rendering result. Here is what it can do. The mesh floating at the top is the original mesh shape, and the one rolling on the ground below is the result of converting it to cylindrical coordinates. (More precisely, it renders the coordinates obtained by converting from rectangular to cylindrical coordinates and then projecting them back into rectangular space.) Everything except the Shader uses the same data. In this animation the objects are stationary, which makes it hard to convey, but since the coordinate conversion happens in real time, any deformation of the original mesh via animation is properly reflected. As a bonus, I also wrote the inverse

Continue reading on Dev.to

Opens in a new tab

Read Full Article
5 views

Related Articles