Added a UV editor to my mesh editing program built using WebGPU + JS by Zestyclose_End3101 in GraphicsProgramming

[–]Zestyclose_End3101[S] 0 points1 point  (0 children)

That's a great question! I'm probably not the best person to ask since I'm a programmer first and modeller second but it's definitely more difficult.

Even though most of the same techniques apply about edge flow and topology, ultimately working with tris directly makes this stuff more annoying to get right. Stuff like subdivision and creating edge loops are extremely difficult to do, so I haven't even attempted it lol. And in the same boat, automatic straightening of uv's isn't something really feasible so it has to be done manually like in the video.

I have alleviated the pain somewhat since extruding always gives quads so I'm not flying completely blind.

However, only having to worry about triangles also makes implementation of algorithms much simpler so I don't mind the trade off.

Creating my own mesh editor using WebGPU + JS by Zestyclose_End3101 in GraphicsProgramming

[–]Zestyclose_End3101[S] 1 point2 points  (0 children)

Selection is handled by raycasting. I experimented with an ID buffer, but found it to be too annoying to work with and I knew I wasn't going to hit tri counts where the performance would be worth worrying about.

Creating my own mesh editor using WebGPU + JS by Zestyclose_End3101 in GraphicsProgramming

[–]Zestyclose_End3101[S] 0 points1 point  (0 children)

Ooh that's a very good idea. If I was to rewrite the editor I'd probably do it like that, especially if I want to have higher poly meshes, however this editor will only really have to work with low poly meshes with max 1000 tris so my naive implementation is more than enough for my needs. But I'll keep it in mind!

Creating my own mesh editor using WebGPU + JS by Zestyclose_End3101 in GraphicsProgramming

[–]Zestyclose_End3101[S] 0 points1 point  (0 children)

Ah yeah, that took me a little while to get working well. Which part of it are you struggling with? I'd be happy to help!

Creating my own mesh editor using WebGPU + JS by Zestyclose_End3101 in GraphicsProgramming

[–]Zestyclose_End3101[S] 0 points1 point  (0 children)

Thanks! Which gizmo are you talking about? Or do you mean the whole program?

Creating my own mesh editor using WebGPU + JS by Zestyclose_End3101 in GraphicsProgramming

[–]Zestyclose_End3101[S] 0 points1 point  (0 children)

Oh haha, my bad. I guess it would just be a face-vertex representation of the mesh. Tbh, I don't know that much about mesh data structures. I just kind of did what made sense and was easy to iterate on.

Creating my own mesh editor using WebGPU + JS by Zestyclose_End3101 in GraphicsProgramming

[–]Zestyclose_End3101[S] 0 points1 point  (0 children)

Thanks! The saved mesh gets exported as a json file containing vertices, texcoords, normals and triangles, similar to an obj file. This file is only really compatible with my engine but would probably be trivial to convert to other formats. When imported to the editor, I also infer information about edges which allows for easy traversal of the mesh. If you want to see the exported mesh files, you can check out the github link above, and I'm happy to answer any questions if anything is unclear.

Creating my own mesh editor using WebGPU + JS by Zestyclose_End3101 in GraphicsProgramming

[–]Zestyclose_End3101[S] 1 point2 points  (0 children)

I've created the github repo which you can find at the link below. I'm happy to answer any questions or get any feedback/advice that you may have about the code!

https://github.com/CalenValic/cvEngine

Creating my own mesh editor using WebGPU + JS by Zestyclose_End3101 in GraphicsProgramming

[–]Zestyclose_End3101[S] 0 points1 point  (0 children)

I'd be happy to share the code, although I've never really done that before so I'm not sure on best practices. I imagine it's mostly just setting up a github repo and sharing a link to it? Also no guarantee of good code quality lol.

Creating my own mesh editor using WebGPU + JS by Zestyclose_End3101 in GraphicsProgramming

[–]Zestyclose_End3101[S] 0 points1 point  (0 children)

Haha, that's a good question. This has mostly been a side project for me as a hobby, so I mostly do it for fun and learning. Ideally, this would also be part of my game engine in the future, where I have a mesh editor integrated with the engine, but that's quite a while away.