Im on windows i would like to have a .exe file which is a 3d viewer, similar to blender.
Which language do i code it?
Which libraries would i need to use?
Note: when i mean creating my own 3d engine i mean that i would do myself the maths, i dont want a prebuild one Thanks

  • cravl@slrpnk.net
    link
    fedilink
    arrow-up
    8
    ·
    10 months ago

    For a second I read this as “create my own 3D engine in Scratch” and was immediately both amused and horrified. 😆😵‍💫

  • atzanteol@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    7
    ·
    10 months ago

    Whatever language you want, and then math. Lots of matrix math. Get a book on the math behind 3D graphics.

    • breb@piefed.socialOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      10 months ago

      yeah but i need a language and a library to be able create a .exe and be able to set a pixel a color value

      • atzanteol@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        9
        ·
        10 months ago

        I render my former answer. There is no language that can’t.

        It sounds like you have little or no programming experience? You’ll need to start with learning to code. Lots of people recommend Python for beginners, though I’m not a fan personally of the language. That said there are a ton of tutorials for it.

        • SatouKazuma@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          10 months ago

          As a Python user, I’d love to recommend it, but it’s a really bad fit for a game engine. I’d honestly love to see more engines in Rust, since Rust’s control over memory and support for multithreading and parallelism are better than almost every language out there (whether one should use it over C++ is dependent on one’s background).

          • atzanteol@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            3
            ·
            10 months ago

            This fella isn’t creating a serious game engine - sounds like they just want to explore the topic, so python would be fine even if it’s incredibly slow.

            • SatouKazuma@programming.dev
              link
              fedilink
              arrow-up
              1
              ·
              10 months ago

              Fair enough, but I’m a proponent of letting the job dictate the tools, even for newbies. The earlier new devs learn to do that, the easier higher roles become.

  • bitcrafter@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    10 months ago

    There are a couple of approaches you can take, depending on your learning style.

    The first is that you could start really easy by creating a 1d engine, and then once you’ve gotten that mastered keep adding more dimensions until you get to 3d.

    The second is that you could skip all the way to creating a 4d engine, and once you’ve gotten that mastered just chip off one dimension and bam you now have a 3d engine.

  • entwine@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    10 months ago

    https://scratchapixel.com/ for valuable background

    After that, I recommend you learn webGL and write your first project in javascript. It’s not as cool as a native executable in C++, but you will gain a lot of crucial 3D graphics knowledge without getting sidetracked by typical native development woes (which should not be underestimated)

    Once you feel you have a good grasp on the 3D math, working with a graphics API, writing shaders, and the general architecture of a 3D application, THEN you should start looking into native development. Maybe start learning Vulkan as a next step, although that’s a tough one if you don’t already have C or C++ experience (mostly because of memory management concepts). Instead of Vulkan, you could instead go with OpenGL or a high level library like Sokol.

    It should go without saying that this isn’t an easy topic. It’s a deep, deep (but rewarding) rabbit hole. There’s a lot of stuff to learn, and it will take a while. A sense of overwhelming dread, hopelessness, and inadequacy is part of the process.

  • ulterno@programming.dev
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    10 months ago

    If you are using C, you could consider SDL 3 as a base library.

    Not a recommendation though. Just saying you can do so.
    It has all the basic stuff: V-Sync, audio, input device handling etc.

    Almost forgot to add… It also allows you to easily add stuff with Vulkan, OpenGL etc.

  • planish@sh.itjust.works
    link
    fedilink
    arrow-up
    1
    ·
    10 months ago

    I think NeHe might still have tutorials on this, in C/C++. You probably want to be using OpenGL for acceleration and maybe the old fashioned immediate mode/fixed function stuff where you call functions like “We are drawing triangles now” and “here is a vertex” and “that vertex is blue”, and you can put off taking over the pipeline with your own shader code until later.

    You still might be letting the library/gpu do most of “the maths” because I think you mostly hand it transformation matrices and points and it sends them to screen space. If you take over the vertex shader then your shader code does that.

    You want to write a vector and matrix math library with 3-vectors and 4-vectors and 3x3 and 4x4 matrices, and add and multiply operations, and matrix inversion. The 4th dimension lets you make translation in 3D a linear multiply operation because you keep 1 in there and your matrix to represent a translation mixes that 1 into the other position coordinates to translate.

    You also probably want to learn linear algebra enough for that to make sense.

    And then on top of that you want to build a scene graph library where objects have parents they move with. And then your renderer loop will walk the scene graph node tree and push each object’s transformation matrix and draw it and do its children and then pop the transformation matrix off again.