Skip to content

Not working in Unity 5.5 #6

@baturinsky

Description

@baturinsky

Probably, because of shaders. FlatColor shader looks like solid black, when I change to StandardVertexTransp it looks similar to normal, but looks like it have z-order of faces wrong

http://i.imgur.com/oWkxVLC.png

Suggested fixes:

use tex coords instead of color:

//in cycle
var texCoords = new Vector2(cidx / 255f, 0.5f);

uv.Add(texCoords);
uv.Add(texCoords);
uv.Add(texCoords);
uv.Add(texCoords);

...

uv.Add(texCoords);

And use standard shader and a palette png that MagicaVoxel generates when exports obj.

  1. Fix StandartVertexTransp shader by changing

void vert (inout appdata_full v, out Input o)

to

void vert (inout appdata_full v, out v2f o)

(i.e. do not lose vertex position along the way)

Result is still looks pretty meh, because unshaded

I have also found this shaders that seems to do the trick

Shader "Vertex Color Lit" {
	Properties{
		_MainTex("Base (RGB)", 2D) = "white" {}
	}
		SubShader{
		Pass{
		Lighting On
		ColorMaterial AmbientAndDiffuse
		SetTexture[_MainTex]{
		combine texture * primary DOUBLE
	}
	}
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions