Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working in Unity 5.5 #6

Open
baturinsky opened this issue Mar 24, 2017 · 2 comments
Open

Not working in Unity 5.5 #6

baturinsky opened this issue Mar 24, 2017 · 2 comments

Comments

@baturinsky
Copy link

baturinsky commented Mar 24, 2017

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
	}
	}
	}
}
@barraudf
Copy link
Contributor

Hey!

I haven't work on Unity for a good amount of time, I didn't notice this project was not wokring on newer version of Unity anymore.

If I had to do it again, I'd pick UV mapping over Vertex Color too, simply because using it is working with Unity default standard shader (unlike vertex color)

@barraudf
Copy link
Contributor

Hey!

I don't know if you are still using this project, but it has been updated to work with newer versions of Unity (tested on Unity 2017.2) and is working with standard shader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants