tiflolinux.org - GNU Social
  • Login

Bienvenido

  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. dave (dthompson@toot.cat)'s status on Saturday, 21-Aug-2021 07:56:52 CEST dave dave

    I learned the math for computing the vertices of an icosahedron but I couldn't think of a way to easily generate the mesh, so I wrapped tape around a d20 I had from back when I played mtg, labeled all the vertices, and used that as reference to build the 20 triangles in the mesh.

    In conversation Saturday, 21-Aug-2021 07:56:52 CEST from toot.cat permalink

    Attachments


    1. https://pool.jortage.com/tootcat/media_attachments/files/106/773/471/603/701/228/original/0d35c59197a03a66.png
    • dave (dthompson@toot.cat)'s status on Saturday, 21-Aug-2021 07:56:45 CEST dave dave
      in reply to

      here's the implementation I ended up with https://git.dthompson.us/chickadee.git/tree/chickadee/graphics/mesh.scm#n437

      In conversation Saturday, 21-Aug-2021 07:56:45 CEST permalink

      Attachments

      1. mesh.scm « graphics « chickadee - chickadee.git - Chickadee Game Toolkit
    • dave (dthompson@toot.cat)'s status on Saturday, 21-Aug-2021 07:56:46 CEST dave dave
      in reply to

      been difficult to focus on anything but in an attempt to get my brain to zone out on something that isn't real life I was able to figure out how to fix the UVs around the poles of the sphere. much better now. adds 12 new vertices to the final mesh.

      In conversation Saturday, 21-Aug-2021 07:56:46 CEST permalink

      Attachments


      1. https://pool.jortage.com/tootcat/media_attachments/files/106/789/274/671/021/961/original/8aa0a769c4bbeb5d.png
      spectrumgomas repeated this.
    • dave (dthompson@toot.cat)'s status on Saturday, 21-Aug-2021 07:56:47 CEST dave dave
      in reply to

      turns out lots of people go down this road and run into the same problem. the solution seems to be to detect the problem by examining the uvs of entire triangles and generating new, fixed vertices. I'll see if I can do that without making my code disgusting.

      In conversation Saturday, 21-Aug-2021 07:56:47 CEST permalink
    • dave (dthompson@toot.cat)'s status on Saturday, 21-Aug-2021 07:56:47 CEST dave dave
      in reply to

      I found a solution that wasn't too gross, but not too great either. added about 27 lines of new code. maybe I can improve upon it, but not now. onto the next and hopefully final problem: bad texture coordinates at the poles.

      In conversation Saturday, 21-Aug-2021 07:56:47 CEST permalink

      Attachments


      1. https://pool.jortage.com/tootcat/media_attachments/files/106/779/249/269/861/209/original/b1124da98281ef00.png
    • dave (dthompson@toot.cat)'s status on Saturday, 21-Aug-2021 07:56:48 CEST dave dave
      in reply to

      I believe the issue here is that the vertices along this seam need to be duplicated but with different u coordinates, one where u=0 and another where u=1. same position and normals, though. it's tricky to solve because my algorithm has no knowledge of where this seam even is.

      In conversation Saturday, 21-Aug-2021 07:56:48 CEST permalink
    • dave (dthompson@toot.cat)'s status on Saturday, 21-Aug-2021 07:56:49 CEST dave dave
      in reply to

      the sphere now has texture coordinates, but there is a very obvious issue. I used the formula here https://en.wikipedia.org/wiki/UV_mapping#Finding_UV_on_a_sphere but it creates a seam where u coordinate does a hard jump from 0 to 1 and creates that gross looking result. I don't know if I'm just missing something. trying to tweak the formula has just introduced new distortions so far.

      In conversation Saturday, 21-Aug-2021 07:56:49 CEST permalink

      Attachments


      1. https://pool.jortage.com/tootcat/media_attachments/files/106/777/148/122/610/352/original/6453357b3ac95b41.png
    • dave (dthompson@toot.cat)'s status on Saturday, 21-Aug-2021 07:56:50 CEST dave dave
      in reply to

      wireframe of 2 recursive subdivisions, not yet made spherical.

      In conversation Saturday, 21-Aug-2021 07:56:50 CEST permalink

      Attachments


      1. https://pool.jortage.com/tootcat/media_attachments/files/106/773/600/152/910/404/original/28961327998bb775.png
    • dave (dthompson@toot.cat)'s status on Saturday, 21-Aug-2021 07:56:50 CEST dave dave
      in reply to

      now it's spherical. the trick is that once you subdivide the triangles of the icosahedron, you take the normal of each vertex and scale it by the sphere's radius to get the final position. this sphere is made of 1280 triangles and looks pretty good at this scale.

      In conversation Saturday, 21-Aug-2021 07:56:50 CEST permalink

      Attachments


      1. https://pool.jortage.com/tootcat/media_attachments/files/106/773/989/085/605/930/original/3fe946306d93dd7d.png
    • dave (dthompson@toot.cat)'s status on Saturday, 21-Aug-2021 07:56:51 CEST dave dave
      in reply to

      you can say this is a really low resolution sphere. for my next trick, I will subdivide each of the 20 triangles several times and transform each vertex so that it is the same distance from the origin. this will create a nice approximation of a sphere.

      In conversation Saturday, 21-Aug-2021 07:56:51 CEST permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

tiflolinux.org - GNU Social is a social network, courtesy of tiflolinux.org. It runs on GNU social, version 2.0.1-beta0, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All tiflolinux.org - GNU Social content and data are available under the Creative Commons Attribution 3.0 license.