Basics of MESH GENERATION in Godot 4 0

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ส.ค. 2024

ความคิดเห็น • 36

  • @Grymyrk
    @Grymyrk 7 หลายเดือนก่อน +8

    I remember I did this exact exercise years ago at university except it was with opengl.

  • @Jim-Works
    @Jim-Works ปีที่แล้ว +15

    Note to future people: if you want correct lighting on the cube, you need to have 4 unique vertices per face, and set the normals to be pointing out of the cube. So the top face would have 4 verts all with (0,1,0) normals, the bottom would have 4 verts with (0,-1,0) normals, etc. If you only use 8 verts for the whole cube, the lighting gets smoothed out over the faces, which you can see at the end of the video

    • @freevbucks8019
      @freevbucks8019 ปีที่แล้ว

      So I'd need 16 vector2? I don't get how I should set it up

    • @thomaseubank1503
      @thomaseubank1503 9 หลายเดือนก่อน

      @@freevbucks8019 Yeah I need more clarification too. I also am not fully sure if I understand how to set up which way the face is.

    • @freevbucks8019
      @freevbucks8019 9 หลายเดือนก่อน

      @@thomaseubank1503 after dicking around too much you need a normal per vertice declared by the triangle. I guess it would be easier to fiddle with OpenGL at this point

    • @HurricaneSA
      @HurricaneSA 6 หลายเดือนก่อน +4

      Or much easier, just add surface_tool.set_smooth_group(-1) right after surface_tool.begin(). It turns smoothing off, so you don't have to manually set normals.

  • @niquedegraaff
    @niquedegraaff 11 หลายเดือนก่อน +17

    Try not to abbreviate variable names. If you teach this yourself, you will write code, that others are having a hard time to read. It's perfectly ok, to name surftool surfaceTool and a_mesh meshArray

  • @MrManGoYou
    @MrManGoYou 10 หลายเดือนก่อน +1

    reload save scene at some point stop working for me and shape remain unchanged

  • @thomaseubank1503
    @thomaseubank1503 9 หลายเดือนก่อน

    I am trying to see if I can make a Doom style level editor in Godot 4. This was super helpful, thanks!

  • @thomasparker7305
    @thomasparker7305 ปีที่แล้ว +3

    Also if I'm not mistaken if someone adds mesh_instance.create_trimesh_collision() it will add a collider. Have to name it the name of the mesh not my mesh_instance have I named mine. Unless Godot 4 changed that

    • @Chevifier
      @Chevifier  ปีที่แล้ว +2

      After you assign the array mesh to the mesh instance just call "create_trimesh_collision()" on the mesh instance it should work fine but for terrain you have a heightmap shape you should use instead IF your planning the generate terrain

    • @Chevifier
      @Chevifier  ปีที่แล้ว

      You can also do it from the editor dropdown as well if you used the generator script as a tool script.

  • @rahultandon9749
    @rahultandon9749 ปีที่แล้ว +2

    Quality/Quantity of Godot videos best in gaming industry, better than that of Unity. I dream of the day when UNREAL decides to document completely. C# could not be as efficient as C++. The entire thing about GODOT is feasibility by the INDE , the other 2: UNITY, UNREAL might not be able to say the same for the INDE nor for the big teams. The open source of GODOT provides a long term dream by itself for the serious developer. Godot makes it possible to plan rather than make something first and then let's see attitude in the other 2.

  • @thomasparker7305
    @thomasparker7305 ปีที่แล้ว +1

    Very helpful thank you. I might have some questions later lol

    • @Chevifier
      @Chevifier  ปีที่แล้ว +1

      Sure, let me know what you need help with.

  • @ParthaSarathylink
    @ParthaSarathylink 3 หลายเดือนก่อน +1

    This is really cool. But I don't understand how UV mapped in godot why blender involved here and how material is applied using UV

    • @Chevifier
      @Chevifier  3 หลายเดือนก่อน

      I was just using blender to demonstrate what i was doing in Godot with the UVs

  • @albegago
    @albegago วันที่ผ่านมา

    In the video the complete code is illegible...
    The code to create the triangle:
    @tool
    extends MeshInstance3D
    @export var update = false
    func _ready():
    gen_mesh()
    func _process(delta:float):
    if update:
    gen_mesh()
    func gen_mesh():
    var a_mesh = ArrayMesh.new()
    var vertices := PackedVector3Array([
    Vector3(0,0,0),
    Vector3(20,0,0),
    Vector3(20,0,20),
    ])
    var indices := PackedInt32Array([0,1,2])
    var array = []
    array.resize(Mesh.ARRAY_MAX)
    array[Mesh.ARRAY_VERTEX] = vertices
    array[Mesh.ARRAY_INDEX] = indices
    a_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES,array)
    mesh = a_mesh
    You have to save the scene, then in the menu choose SCENE > RELOAD SAVED SCENE
    And finally, there is a triangle....

  • @Chareidos
    @Chareidos 7 หลายเดือนก่อน

    Is it possible to create or edit a mesh and adding/removing bones for a 3DSkeleton in Godot in Runtime?
    Like in Spore or with Creature Creator (made in unity), dragging a Node and creating new vertices with a corresponding bone (or any other useful Node)?

  • @sandiguha
    @sandiguha ปีที่แล้ว

    I would like to ask what could be the applications with this? Great tutorial btw.

    • @pixelrogue
      @pixelrogue ปีที่แล้ว

      You could use it to destroy terrains for instance

  • @bioman1hazard607
    @bioman1hazard607 10 หลายเดือนก่อน +1

    can you put the code in the comments for this. i put everything exactly as you typed but it still gives me errors, so i have no idea what im doing

    • @Chevifier
      @Chevifier  10 หลายเดือนก่อน +1

      Ive added the code to the description. But its for infinite terrain.

    • @bioman1hazard607
      @bioman1hazard607 10 หลายเดือนก่อน

      @Chevifier thanks, tho I wish it were the Code for this vid, I'll still see if I can use it to make something

  • @Red_Eagle
    @Red_Eagle ปีที่แล้ว +3

    any source code?

  • @Loethor
    @Loethor ปีที่แล้ว

    any problem if I try to replicate this in godot 3.5.x?

    • @Chevifier
      @Chevifier  ปีที่แล้ว

      Maybe a few function differences but for the most part the process is the same

  • @jethdaflip7741
    @jethdaflip7741 11 หลายเดือนก่อน +1

    Why not use C# instead of gdscript? Isn't performance better with C#?

    • @Chevifier
      @Chevifier  11 หลายเดือนก่อน +1

      It definitely is better. But most users use the Regular Godot Engine and not the DotNet version.

  • @Evgeniy_Sugonyako
    @Evgeniy_Sugonyako ปีที่แล้ว

    You are my God by GODOT ;-)

  • @Ali-bh6be
    @Ali-bh6be ปีที่แล้ว

    promosm 💖

  • @ububox2087
    @ububox2087 11 หลายเดือนก่อน +3

    AHHHHG!!!!! what did you hide at 5:55 ?????
    you move too fast and didn't explain what "and we (pass that array??)" means or show what was typed or what the auto complete was. Also mesh = a_mesh just throws error Parser Error: Identifier "mesh" not declared in the current scope. If I add var mesh in the scope the preceding line then throws error Invalid type in function 'add_surface_from_arrays' in base 'ArrayMesh'. Cannot convert argument 2 from Object to Array.
    Seriously terrible tutorial - rushed, and poorly explained.

    • @Chevifier
      @Chevifier  11 หลายเดือนก่อน +2

      Sorry about that it was:
      a_mesh.add_surface_from_arrays(Mesh.PRIMATIVE_TRIANGLES,array)
      Its the array I assign the vertices and indices to at line 29 to 32.

    • @bioman1hazard607
      @bioman1hazard607 10 หลายเดือนก่อน

      it doesnt work on my end for some reason@@Chevifier

    • @MedioTaffy
      @MedioTaffy 8 หลายเดือนก่อน +2

      For future reference, pause the video and use the buttons to go frame by frame

    • @frogfrogfrogd
      @frogfrogfrogd 7 หลายเดือนก่อน

      @@bioman1hazard607 check if you have PackedFloat32Array instead of PackedInt32Array, it should be PackedInt32Array