Importing 3D Object Files in GameMaker

Поделиться
HTML-код
  • Опубликовано: 24 янв 2025

Комментарии • 29

  • @gydgeza
    @gydgeza 9 месяцев назад +2

    Hey! This is an amazing update to the older video, and the addition of the triangulation is much appreciated! Regarding that though, I have a question.
    At 30:43 you say you should start the for loop at 2, then set it up with tokens[1], tokens[j-1] and tokens[j].
    Would that not result in the first face being (1, 1, 2), unlike the diagram you showed just before where the first ace should be (1, 2, 3)?
    Should the for loop actually start at 3 or am I not understanding something here?

    • @DragoniteSpam
      @DragoniteSpam  9 месяцев назад

      tokens[0] is the "f" part of the line

    • @gydgeza
      @gydgeza 9 месяцев назад

      @@DragoniteSpam I am aware of that part yes, but to better illustrate my question it's the following that confuses me:
      _v1 = _tokens[1],
      _v2 = _tokens[_j - 1],
      _v3 = _tokens[_j],
      starting at j=2, would that not result in:
      _v1 = _tokens[1],
      _v2 = _tokens[1],
      _v3 = _tokens[2],
      whereas the desired starting point would be
      _v1 = _tokens[1],
      _v2 = _tokens[2],
      _v3 = _tokens[3],

    • @DragoniteSpam
      @DragoniteSpam  9 месяцев назад

      @@gydgeza oh yeah, you'd want to start the loop at 3 then, i should probably update the github

    • @gydgeza
      @gydgeza 9 месяцев назад

      ​@@DragoniteSpam Thanks for clarifying! As an amateur programmer and game dev, I wasn't sure if there was a hidden meaning behind starting at 2 instead, or not.

  • @BenderWaffles
    @BenderWaffles 10 месяцев назад +8

    I remember the wild west of 3D in GameMaker, back during the pre-yoyo days. Working with OBJs was pure wizardry back then...

  • @jackb7647
    @jackb7647 10 месяцев назад

    This video answers a lot of questions, I'm pretty sure we're not too far from fully functional 3d at this point. I'm gonna start tripping one day when you spawn treasure chests and they actually hit the floor and roll off of one another like in Gmod or Skyrim
    Great video as always!

  • @PixelatedPope
    @PixelatedPope 10 месяцев назад +7

    Team Z Up Represent!

  • @MyBedIsInAWall
    @MyBedIsInAWall 26 дней назад

    im not expecting a response, but when you mentioned about the scale issue i used the same line of code but it made the game window way too big to the point where i could only see the top left portion of it
    is there any way to scale up the model without scaling the entire window?
    also theres an issue where some polygons in the model just arent appearing but i cant really get a closer look without the model being larger
    edit: for now to check the issue i just reimported the model at a larger size (but im still curious if theres a way to do it in gms2)
    the issue was with the model itself and not the code, the model had polygons with 4 parts (idk what theyre called off the top of my head lol)
    i just went into blender and added a triangulate modifier to fix it

  • @erinb7630
    @erinb7630 6 месяцев назад

    I'm drawing a cube to the vertex buffer, but i'm getting a bug where some of the faces draw in front of other faces, even when they're supposed to be behind them? Some of the faces just look like weird normals and some look like some 4dimensional shenanigans. It all looks fine in blender though, even checking the normal orientations and it's all blue, made sure to re-map the uv after making sure and it's still all wonky x.x

    • @DragoniteSpam
      @DragoniteSpam  6 месяцев назад

      Make sure z write and test is enabled

    • @erinb7630
      @erinb7630 6 месяцев назад

      @@DragoniteSpam Thank you so much :D I had it enabled, but in the wrong draw event lol

  • @RetroGameMaker.
    @RetroGameMaker. 10 месяцев назад

    Thank you for your videos .. I am tried your script on obj exported from 3ds max 21 but its not work because in "v" case obj file have 2 space after v
    this line correct this if any one need it
    if (tokens[0]="v") {this_line=string_replace_all(this_line," "," "); tokens = string_split(this_line, " ");}

    • @DragoniteSpam
      @DragoniteSpam  10 месяцев назад +1

      you can also use the remove_empty argument in string_split

  • @catwif
    @catwif 9 месяцев назад

    a true pillar of the community.

  • @midnight9251
    @midnight9251 8 месяцев назад

    Hey, where did you explain how the shader works if you did and what code do I need for it? I can’t seem to find it anywhere.

    • @DragoniteSpam
      @DragoniteSpam  8 месяцев назад

      it's just a little directional light:
      ruclips.net/video/mspdUDlVEXI/видео.html

  • @jackb7647
    @jackb7647 10 месяцев назад

    Sorry for the double post, is it wise to convert quads to tris before importing or is there a work around in Gamemaker's engine, and if so, to what extent does the engine work with a mesh?

  • @normanrichwood620
    @normanrichwood620 Месяц назад

    your code has a potential problem that it doesn't consider "local uv".
    Im change this moment in this:
    var texture_uvs = texture_get_uvs(_texture);
    vertex_position_3d(vb, v1_position_x, v1_position_y, v1_position_z);
    vertex_normal(vb, v1_normal_x, v1_normal_y, v1_normal_z);
    vertex_texcoord(vb, lerp(texture_uvs[0], texture_uvs[2], v1_texcoord_x), lerp(texture_uvs[1], texture_uvs[3], v1_texcoord_y));
    vertex_colour(vb, c_white, 1);

    vertex_position_3d(vb, v2_position_x, v2_position_y, v2_position_z);
    vertex_normal(vb, v2_normal_x, v2_normal_y, v2_normal_z);
    vertex_texcoord(vb, lerp(texture_uvs[0], texture_uvs[2], v2_texcoord_x), lerp(texture_uvs[1], texture_uvs[3], v2_texcoord_y));
    vertex_colour(vb, c_white, 1);

    vertex_position_3d(vb, v3_position_x, v3_position_y, v3_position_z);
    vertex_normal(vb, v3_normal_x, v3_normal_y, v3_normal_z);
    vertex_texcoord(vb, lerp(texture_uvs[0], texture_uvs[2], v3_texcoord_x), lerp(texture_uvs[1], texture_uvs[3], v3_texcoord_y));
    vertex_colour(vb, c_white, 1);

    • @DragoniteSpam
      @DragoniteSpam  Месяц назад

      you mean textures that live within a bigger GM texture page? technically true, though i usually recommend people put their 3d textures on their own texture pages for ease of use. the texture packer can pack them differently between builds of the game if it wants to, and if you save the vb to a file the uvs could be in a completely different place

  • @glitchborne
    @glitchborne 10 месяцев назад

    I like game maker , but I don't think it looks reasonable considering that in other game engines it is done in a few clicks

  • @PratibhaIyer-fj6lf
    @PratibhaIyer-fj6lf 9 месяцев назад

    Hello, I am getting an error when I try to run the game, it reads :
    ___________________________________________
    ############################################################################################
    ERROR in
    action number 1
    of Create Event
    for object obj_pov:
    Illegal Buffer Index -1
    at gml_Script_import_obj (line 6) - var content_string = buffer_read(buffer , buffer_text);
    ############################################################################################
    gml_Script_import_obj (line 6)
    gml_Object_obj_pov_Create_0 (line 17) - cube = import_obj("cube.obj", vertex_format);
    What do I do?

    • @fordroberts1409
      @fordroberts1409 9 месяцев назад

      I got this same error, but I think I resolved it. Where are storing your cube object? Try moving the cube object into the Datafiles folder in your project. Don't store it in any subfolder unless you know how to write a path (like "/subfoder/cube.obj" or something).

    • @PratibhaIyer-fj6lf
      @PratibhaIyer-fj6lf 9 месяцев назад

      @@fordroberts1409 Yeah I'm storing the cube in the datafiles section, I've searched online too but not many people have the answers. Thanks for trying.

    • @synthesisgames
      @synthesisgames 9 месяцев назад

      @@PratibhaIyer-fj6lf I am getting:
      ERROR in
      action number 1
      of Draw Event
      for object oCamera:
      vertex_submit: Illegal vertex buffer specified.
      at gml_Object_oCamera_Draw_0 (line 26) - vertex_submit(house1, pr_trianglelist, sprite_get_texture(Skull, 0));
      ############################################################################################
      gml_Object_oCamera_Draw_0 (line 26)

    • @PratibhaIyer-fj6lf
      @PratibhaIyer-fj6lf 8 месяцев назад

      @@synthesisgames looks like we're both getting errors, I don't know what to do. I don't think Dragonite checks for comments on this video anymore, he's probably busy with other projects.

    • @DragoniteSpam
      @DragoniteSpam  8 месяцев назад

      @@synthesisgames whatever's stored in "house1" isn't a vertex buffer