[mod] Woolen Mesh Creator (not only wool!) [wesh]

User avatar
Phoenixflo44
Member
Posts: 639
Joined: Fri Jul 28, 2017 15:01
In-game: EvilPhoenix
Location: Behind my PC, in Germany

Re: [mod] Woolen Mesh Creator [wesh]

by Phoenixflo44 » Post

The AT-TT.

Image
Image
Attachments
screenshot_20180606_203942.png
screenshot_20180606_203942.png (633.83 KiB) Viewed 684 times
screenshot_20180606_195042.png
screenshot_20180606_195042.png (668.78 KiB) Viewed 684 times
Spoiler
I hate my life

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator [wesh]

by entuland » Post

Great job with the AT-AT, Phoenixflo44!

Did you customize the nodecolors.conf file to ignore the cobblestone in the captures?

User avatar
Phoenixflo44
Member
Posts: 639
Joined: Fri Jul 28, 2017 15:01
In-game: EvilPhoenix
Location: Behind my PC, in Germany

Re: [mod] Woolen Mesh Creator [wesh]

by Phoenixflo44 » Post

In this mod you only use wool blocks. That's why I had to replace all the at-at with wool. Then the mesh loaded and started to puzzle.
Spoiler
I hate my life

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator [wesh]

by entuland » Post

Phoenixflo44 wrote:In this mod you only use wool blocks. That's why I had to replace all the at-at with wool. Then the mesh loaded and started to puzzle.
Oh well, I have noticed in fact that you're using some older version of my mod, I've pushed many new commits in the recent days - one of them is the one that makes it grab most of the default nodes.

I'm sorry that you had to replace all the blocks there - from now on no one should need to do such a large amount of work to capture builds hopefully!

Make sure you download the latest version if you want to tweak the generated files more easily - such as omitting the matrix files or limiting the amount of variants. Players downloading your captures can always add the versions they want by editing the .dat.obj files if needed.

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by entuland » Post

Pushed new commit to https://github.com/entuland/wesh - captures have a capped number of faces and will not crash the game nor produce invisible meshes unless you alter that cap and push the mod's limits.

User avatar
GamingAssociation39
Member
Posts: 858
Joined: Mon Apr 25, 2016 16:09
GitHub: Gerold55
IRC: Gerold55
In-game: Gerold55
Location: Maryland, USA

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by GamingAssociation39 » Post

So I can design furniture and shrink them and make them sittable/usable?
Jesus Is Lord and Savior!!!

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by Lone_Wolf » Post

GamingAssociation39 wrote:So I can design furniture and shrink them and make them sittable/usable?
I would recommend Blender for that. But you probably could
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
GamingAssociation39
Member
Posts: 858
Joined: Mon Apr 25, 2016 16:09
GitHub: Gerold55
IRC: Gerold55
In-game: Gerold55
Location: Maryland, USA

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by GamingAssociation39 » Post

Yeah I know I have many types of furniture done in blender. Most of the overhaul was done in the node editor.
Jesus Is Lord and Savior!!!

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by entuland » Post

GamingAssociation39 wrote:So I can design furniture and shrink them and make them sittable/usable?
You can shrink all kinds of builds which will be converted into meshes with some automatic collision boxes approximating their shapes, yes.

The resulting nodes can't be crafted but become available in the game through the creative inventory or through the "Giveme Meshes" button of the canvas' interface.

All of the static properties that you would set in a register_node() call can be set in the .obj.dat file associated to each mesh, but for anything more complex than that (for example having such nodes interact and execute any kind of code, or to have them craftable with a recipe) the best option would be to copy the .obj file (and eventually the texture) over to a new mod where you have full control.

The meshes generated by this mod are though somewhat heavy even for simple things such as stairs, where a regular stair would use 10 faces, stairs generated with my mod use 22 faces for each node. It may not be a big deal to have, say, an entire roof made out of such "heavier" stairs, but most of the meshes generated by this mod will be _far_ heavier than that, in the order of hundreds or thousands faces each node, which would probably not be good for using in large amounts anywhere.

In other words, the purpose of this mod is mainly creating decorative nodes to be used sparsely.

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by entuland » Post

Update 09/06/2018
Added importing and vacuuming features that allow to import matrix files and use them as temporary / permanent blueprints
Some minor tweaks here and there

https://github.com/entuland/wesh#dealing-with-matrices

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by entuland » Post

Update 10/06/2018
Added transformations to allow canvases to work properly with any rotation (capture your house, place the canvas up in the air, rotate it upside down and reimport the house :P)

Added invert / mononode modes to import matrices (you can rebuild a matrix out of cobblestone, or carve its negative with air inside the ground and so forth)

https://github.com/entuland/wesh#dealing-with-matrices

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by entuland » Post

Improved some screenshots and extended documentation with examples: https://github.com/entuland/wesh/blob/m ... xamples.md

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by entuland » Post

Added support for rebuilding captures with the original nodes, any node gets captured by the matrix and can be rebuilt with the "Import original nodes" option:
Image

Everything gets rotated according to the original direction / rotation and according to how the canvas gets placed on rebuild:
Image

Some things behave funky when rebuilt, such as the obsidian glasses, still need to understand how to fix this:
Image

The error in the above screenshot (an actual crash) is caused by attempting to close a door which got rotated in an unnatural way, that's something I need to fix as well somehow.

Matrix files now get named according to their size and can be shared to let others recreate builds, canvases only list old matrices without the size (which can only be built as wool) and new matrices with a matching size (which can be built as original nodes as well).

Here is the matrix I got when I captured the house depicted above:
mesh_real_house.obj.matrix16.zip
Test matrix
(2.19 KiB) Downloaded 45 times
Just copy the .dat file in the "models" folder and import it in a canvas of size 16 using the "Import original nodes" option.

Changes pushed to https://github.com/entuland/wesh

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by ManElevation » Post

oh wow does this work with anything? no limit?
My Public Mods! Discord: Rottweiler Games#3368

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by entuland » Post

ManElevation wrote:oh wow does this work with anything? no limit?
As far as grabbing / rebuilding with the same nodes goes, it works with anything.

It is enough for the nodes to be registered (they will, if you're seeing them in the world) and the mod will rebuild them (but they must be registered even when you're rebuilding them of course, be it the same world at a later time or a completely different world).

If they use the "facedir" value for "param2type", they will also get properly rotated on rebuild.

Node metadata will be completely ignored, they will behave as freshly placed nodes, so you'll not get back chest contents, sign texts, luacontroller codes and whatnot. All of that stuff will go lost on rebuild.

If instead you want to rebuild them as wool blocks (or if you want to get the one-block-meshes out of the builds) of course that is far more limited, cause nodename => color mappings must be added in the custom nodecolors.conf file, and the meshes themselves will only use the wool colors.

User avatar
LMD
Member
Posts: 1386
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by LMD » Post

This is really good. So I was thinking how you could improve it even farther : Maybe use Java for actual mesh creation and saving process ? (a) Unlike LUA, Java supports multithreading(really useful) so you neednt block entire LUA stuff for some time. (b) Java is just faster (c) I think Java IO may be faster, too : In LUA, there isn't such a thing as "BufferedReader", which is 5x faster than normal "FileReader", guess how it behaves with Writer :)
Great idea ! Sadly, for me LUA isnt my favorite language, but Java :(
My stuff: Projects - Mods - Website

User avatar
LMD
Member
Posts: 1386
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by LMD » Post

You know what that was :
Image
Have you read paramat's post : It was called like "To those of you using glass nodes as liquid tanks". If you don't specify param2type, MT may assume it is the forgotten feature of "liquidlevel" in glass nodes.
My stuff: Projects - Mods - Website

User avatar
LMD
Member
Posts: 1386
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by LMD » Post

Suggestion v2 : I saw MT offers the possibility of altering bones in meshes. I know obj hasnt got bones, but if you'd use a format with bones, you could transform it dynamically in-game.
Maybe you could get some inspiration of my Mesh class used in ModelCreator; it offers an "optimize" function for optimizing nodeboxes & vertices/normals/texcoords; however, some bugs are still successfully hiding from me :(
https://github.com/appgurueu/Model-Crea ... /Mesh.java
Also, could you help me fix it ? The normals are somehow strange...
My stuff: Projects - Mods - Website

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by entuland » Post

LMD wrote:This is really good. So I was thinking how you could improve it even farther : Maybe use Java for actual mesh creation and saving process ? (a) Unlike LUA, Java supports multithreading(really useful) so you neednt block entire LUA stuff for some time. (b) Java is just faster (c) I think Java IO may be faster, too : In LUA, there isn't such a thing as "BufferedReader", which is 5x faster than normal "FileReader", guess how it behaves with Writer :)
Great idea ! Sadly, for me LUA isnt my favorite language, but Java :(
Eh, if I wanted to use Java I would have coded mods for Minecraft instead :)

No, it's not a joke, I'm a PHP / JS guy mainly, and if I were to pick a performant, statically-typed language, I would use C++.

As for the actual need to improve this mod's performance, a simple test increasing the node limit in the capture interface shows that reading the world data and doing all the computations for the final .obj file took about 2.5 seconds to scan 50K nodes and create a mesh with 13K faces, which is pretty much beyond the current rendering limits of MT 0.4.16. String manipulation and actual file saving took 1.1 seconds, for a total of 3.6 seconds in an extreme case like this on my machine (which, I admit, isn't a bad machine, someone with weaker gear would surely get higher figures to do the same).

Using smaller canvases the code works way faster than the above, but of course I'm all for improving the performance whenever I can, so I'll make sure I'll keep an eye on the numbers and I'll do my best to have it work faster.

I'm not even sure I could do anything at all with another language considering that most of the time of my code is spent calling minetest functions to read world data and the alike... oh well, the ability to tweak the code and run it immediately is priceless in any case to do such kind of modding, so I would stick to Lua even if I could offload everything to C++.

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by entuland » Post

LMD wrote:You know what that was : [... image depicting misbehaving obsidian glass stripped ...]
Have you read paramat's post : It was called like "To those of you using glass nodes as liquid tanks". If you don't specify param2type, MT may assume it is the forgotten feature of "liquidlevel" in glass nodes.
No, I didn't read that, but the problem was that I was failing to properly check the paramtype2 of each node before messing with their param2 - that is somewhat fixed now, but the mod still fails to properly handle all rotations for various other nodes. I'm working on it, I'll make [wesh] depend on the [matrix] mod and I'll use what I've learnt coding the [rhotator] screwdriver to properly handle those rotations.

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by entuland » Post

LMD wrote:Suggestion v2 : I saw MT offers the possibility of altering bones in meshes. I know obj hasnt got bones, but if you'd use a format with bones, you could transform it dynamically in-game.
Maybe you could get some inspiration of my Mesh class used in ModelCreator; it offers an "optimize" function for optimizing nodeboxes & vertices/normals/texcoords; however, some bugs are still successfully hiding from me :(
https://github.com/appgurueu/Model-Crea ... /Mesh.java
Also, could you help me fix it ? The normals are somehow strange...
The idea of creating meshes with bones directly in Minetest just like [wesh] allows to create static meshes would be good, but probably overkill.

Collision boxes work good enough in [wesh] (after all, I create 8 collision boxes max, and far less in most of the cases) so there really isn't room for improvement there.

For vertices, normals and textcoords, as far as I can tell, I'm already doing the best I can considering the purpose of [wesh] - there are no vertex dupes or the alike, and I cannot merge faces cause I need to continue supporting well defined textures for each face of the minivoxels (such as when using the wool variants).

As for your issue with normals there are two things you need to watch out mainly:
- each vertex has a normal, and that normal affects the way the texturing gets applied; those normals should run parallel to each face's normal
- faces' normal are defined by the rotation you define when picking up vertices
To troubleshoot all of that, import your meshes in a 3D editor and have it display both face normals and vertex normals, verify if they're parallel where they should and that they properly point outwards. If you have faces' normals flipped, just reverse the order to pick vertices out.

Despite the name I used here...
https://github.com/entuland/wesh/blob/m ... t.lua#L121
... wesh.face_normals actually end up defining vertex normals here...
https://github.com/entuland/wesh/blob/m ... 1484-L1490
(cause the normals specified in each "f..." line of the object file define the normal for each vertex, not the normal of the face).

The above reference to my code is there to say: just define normals for your faces and use it as the normal for each of its vertices.

I'm not sure I could help much more there cause your code is in Java.

User avatar
LMD
Member
Posts: 1386
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by LMD » Post

I mean, I am merging faces to bigger ones(sub-optimal rectangle algo). This works fine as I'm using images mapped flat on the models. You, however, would have to create textures. But in one-color models that wouldnt be required. So, for colorized-models you could merge faces of similar blocks, as it won't affect the result.
BTW, really astonished : 3.6 secs OMG !
My stuff: Projects - Mods - Website

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by entuland » Post

LMD wrote:I mean, I am merging faces to bigger ones(sub-optimal rectangle algo). This works fine as I'm using images mapped flat on the models. You, however, would have to create textures. But in one-color models that wouldnt be required. So, for colorized-models you could merge faces of similar blocks, as it won't affect the result.
BTW, really astonished : 3.6 secs OMG !
The way I have implemented all of that makes it possible to assign any custom texture to meshes and they will always work properly (assuming the texture itself if appropriate). Handling plaincolor ones to optimize the amount of faces would make it trickier and messier (two meshes would need to be saved instead of one, all the code handling automatic registration of nodes out of the .obj.dat data would need to map those two meshes to different textures and so forth).

Considering that there are many custom nodes out there with pretty heavy meshes made in Blender and the alike, I believe such face-merging optimization to be a very minor gain overall, in particular cause complex meshes would be used sparsely in any case, whereas meshes to be used in large amounts for building would hopefully be really simple (made with the 2x2 or with the 4x4 canvases or the alike).

Out of curiosity, how long does it take for your Java implementation to generate a mesh with similar numbers, say, around 10K faces?

User avatar
LMD
Member
Posts: 1386
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by LMD » Post

ummm..................................................................................................(still waiting)
no, just a joke - it takes 1-2secs or so(estimated) for 2k faces. However, that's due to optimization, I suppose.
My stuff: Projects - Mods - Website

entuland
Member
Posts: 123
Joined: Wed May 09, 2018 15:47
GitHub: entuland
IRC: entuland
In-game: entuland

Re: [mod] Woolen Mesh Creator (not only wool!) [wesh]

by entuland » Post

LMD wrote:ummm..................................................................................................(still waiting)
no, just a joke - it takes 1-2secs or so(estimated) for 2k faces. However, that's due to optimization, I suppose.
Eh yes, optimizations aren't bad. [wesh] used to hang and crash just because I was repeatedly doing string concatenation instead of stashing lines in a table and the concatenating them all at once.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 18 guests