How to Import Qubicle Meshes with Unity

 Unity can read .fbx, .dae (Collada) and .obj files exported from Qubicle.

To import your voxel models drag & drop the files on the Assets window. Important: If you are using textures don't forget to copy the materials folder, too. After a successful import you can use the Import Settings Window to tweak minor mesh properties like the scaling of your mesh. Please note that if you exported your mesh with a Unit Scale Factor of 1 you don't need to adjust the Scale Factor inside Unity.



To take advantage of Unity's versatile Cutout shaders, it is necessary to have a UV set without any overlapping shells. In this case it is strongly recommended to select Texture instead of SimpleTex in the Qubicle Exporter Dialogue.

Using Vertex Colors

If you exported your model with vertex colors you won't see anything at first. That's because most built-in shaders don't display vertex colors. You can use a legacy vertex shader or use the very basic one below (flat shading, no shadows).

Shader "Custom/VertexColor" {
	Properties {
	}
	SubShader {
		Pass {
			CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag

			struct vertexInput {
				float4 vertex : POSITION;
				float4 color : COLOR;
			};
			struct vertexOutput {
				float4 pos : SV_POSITION;
				float4 vertCol : COLOR;
			};

			vertexOutput vert(vertexInput v){
				vertexOutput o;
				o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
				o.vertCol = v.color;
				return o;
			}

			float4 frag(vertexOutput i) : COLOR
			{
				return i.vertCol;
			}
			ENDCG
		}
	}
}

 

To use the shader script:

  1. Create a shader with Assets > Create > Shader.
  2. Double click the shader to open MonoDevelop.
  3. Replace the default script with the one above, save and go back to Unity.
  4. Create a mateial with Assets > Create > Material.
  5. Drag the shader on the material.
  6. Finally, drag the material on the mesh you have imported.

Using Textures

If you exported your mesh with a texture, you have to tweak some settings after import. Otherwise the texture will look blurry. Select the texture and in the Inspector set the Filter Mode to Point and the Format to Truecolor to avoid artifacts.

    Attachments
    There are no attachments for this article.