VoxelShop (Voxel-Editor)

Immortius

Lead Software Architect
Contributor
Architecture
GUI
What do you guys think about importing a voxel format into your game instead of using dae or md5? I could give you code that converts from voxel to 3D mesh on the fly. I'm a bit unsure how one would best support animation in that case, but that's something we could figure out. Upside is that if you wanted to support voxel editing in-game, you'd be much closer already!
Definitely not instead of using dae or md5. In addition to, certainly.

Supporting a voxel format for static or skeletal mesh is doable - we'ld need to work out how to convert skeletal voxel into our internal representation, but that should not be a huge issue - probably helps that you generally link a given voxel part to a single bone. Having a runtime voxel api for the production of mesh is also reasonable (and is what the voxel format loader can be build off of).

Talked to Cervator on skype and I think the first thing I'll add is an exporter for the *.shape format. Seems easy enough and should really help the artists.

The format is documented here btw:
https://github.com/MovingBlocks/Terasology/wiki/Shape-Architecture
https://github.com/MovingBlocks/Terasology/wiki/Block-architecture
That would be nice, thanks. Note that I'll be adding a displayName field to the Shape format shortly.

Not sure why you're linking us to our own shape format documents though. :p
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Probably because I totally forgot about it (that we had wiki) and had him searching the forum for documentation, haha
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps

Mike Kienenberger

Active Member
Contributor
Architecture
GUI
flux,

I have preliminary support for using collada as a source of static mesh data.

https://github.com/mkienenb/Terasology/tree/collada-support

However, I think we currently only support triangulated mesh data in Terasology. I might eventually look into doing triangulation as part of loading the model, but it's very low on my list of things to do, and my time is limited.

Since you are exporting everything as quads currently, maybe you could add an option to also triangulate everything while exporting? I know that blender also lets the exporter do this. I would also love to see animation support in your collada exports, but I have no idea how far along you are on that.

My next major task will be parsing the joint/bone animation data out of library_controllers in collada.
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
Our existing obj format support handles polygon mesh data, by automatically turning the polygon into a triangle fan. You might want to copy that.
 

Mike Kienenberger

Active Member
Contributor
Architecture
GUI
Hmm. I must have missed that. I'll go back and look for it again.

UPDATE: Immortius showed me the 6 (really 5) lines of code that triangulate while loading data. Wow. So I'll add this to the Collada importer when I get a chance and test it against my VoxelShop model.
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
Interesting article, I look forward to the next two parts.

At the moment in Terasology we don't do any vertex reduction during world tessellation - our reasons may or may not be useful in you final part, but in brief:
* Non-cubic shapes are first class citizens in Terasology. This doesn't preclude these sort of algorithms, but adds an extra consideration. I think there is a tendency to rush into optimising for cubes too quickly, before considering the existence of other shapes, or other techniques like Marching Cubes.
* Makes texturing with a texture atlas harder, particularly while supporting non-cubic elements. (Texture arrays would help here a lot)
* Performance issues have generally been elsewhere or there have been other things to pursue.

These articles will be useful for when we look into this though.
 

flux

New Member

Mike Kienenberger

Active Member
Contributor
Architecture
GUI
I have added non-triangle polylist Collada support for our importer (not yet committed yet as I've had very little Terasology time in the last couple of weeks), and it will import a Voxelshop model in Collada format. However, to do so, I had to fabricate texture coordinates (I set each pair to 0,0) and assign an arbitrary texture image. So for static voxelshop model support, we are waiting on you to export texture coordinates.

If I had a lot of time (which I don't), I would have considered constructing a texture based on the color values in the materials automatically. Not likely to happen any time soon, though.
 

flux

New Member
I have another project to finish for the end of this month, but my next thing for the VoxelShop is the COLLADA exporter. So this should be soon now!
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
Terasology's internal mesh don't require texture coordinates, and do have support for vertex color values, so the Collada mesh importer should be able to handle that - does mean the mesh would have to be rendered with a shader that uses vertex color. This is a use case that hasn't been exercised much (obj mesh can't have vertex colors and thus have to have texture coords to be useful), so there may be a little work around have this behave correctly.
 

Mike Kienenberger

Active Member
Contributor
Architecture
GUI
Since you had said that obj meshes had to have texture coordinates, I assumed it would also apply to Collada imports. I will look into populating meshData.getColors() when I build the MeshData, although I probably will not attempt to do anything with shaders as that's outside of my abilities at present. Thanks for keeping me on the right track!
 

Mike Kienenberger

Active Member
Contributor
Architecture
GUI
I finally got all of this committed in an acceptable format and it's now in the develop branch.

VoxelShop collada imports can be used directly as static meshes. Just drop a dot dae file in the mesh directory, and make sure to use the colored-vertex material ( material : "engine:vertexColored" ) in your prefab's Mesh component. Thankfully, Immortius stepped me through the process of setting up the shader.

UPDATE: wiki documentation available here: https://github.com/MovingBlocks/Terasology/wiki/Collada-Models

At some point, we need to address scaling so that the scale value in the collada file is converted into the Terasology standard of 1-unit = 1-meter scale, but I am going to hold off on doing that until the skeletal mesh stuff is finished as I don't need any additional coordinate transforms to confuse me -- I'm already plenty confused enough.

UPDATE: I went ahead and made the adjustment to convert collada unit scale into 1-meter units for static meshes. This change is now in the develop branch.

I think in an ideal case, we would have a scale adjustment set in our prefab files as part of the mesh definition rather than expecting the collada scale to be exactly what we want. I can imagine that we might want to use the same mesh at multiple scales.
 

flux

New Member
That is really, really awesome @ Mike and Immortius! I'll try it out on Sunday!

I have started working on the VoxelShop again and just trying to make sure my time is spend worthwhile. Could you please let me know what changes I should make for the format to be more Terasology friendly? I will add the texture export next (i.e. mesh optimized COLLADA export that uses textures instead of vertex colors), but if there is anything else I'd be happy to implement it!

From what I understand it would also be useful to have an export option for COLLADA that allows the user to set the scale. Anything else?

And yes, animation is still on my list as well!

PS: Sorry for the late reply. I was away for the last two weeks, so I had very little internet time.
 

Mike Kienenberger

Active Member
Contributor
Architecture
GUI
I have started working on the VoxelShop again and just trying to make sure my time is spend worthwhile. Could you please let me know what changes I should make for the format to be more Terasology friendly? I will add the texture export next (i.e. mesh optimized COLLADA export that uses textures instead of vertex colors), but if there is anything else I'd be happy to implement it!

From what I understand it would also be useful to have an export option for COLLADA that allows the user to set the scale. Anything else?

And yes, animation is still on my list as well!
I think the scale setting is probably the only thing that requires someone to edit an exported VoxelShop collada file. Texture support might be nice, but not required now that we can do vertex colors.

My "dog" model seemed to have some weird "edges" in the middle of a model, and I don't know if that was due to a flaw in how I create triangles out of polygons or whether it was a flaw in the model. It'd be nice if someone else tried a model or two and reported whether everything looked good.

All-in-all, I'm pretty happy with how things are right now, and am looking forward to animation. I still need to do more work on collada animation support -- I've been putting off trying to do animation in blender, but it's on my list.
 

flux

New Member
Just a quick update that I'm still around and making great progress on the meshing! Should hopefully release a new version soon!


(click to enlarge)
 
Top