Giter Club home page Giter Club logo

magicavoxelunity's People

Contributors

barraudf avatar darkfall avatar jonaskivi avatar stefanocecere avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magicavoxelunity's Issues

Error when selecting individual voxels then trying to recombine, no alpha model.

Steps to reproduce:
Get latest unity build.
Install this repo.
Load the knight model, without alpha model.
Select the individual voxel option, reimport.
Select the voxels that form the axe, or another voxel set. Try to merge them.
An error pops up here: alphaMax.voxels is null and you try to access it:

int alpha = alphaMask == null ? (byte)0 : alphaMask.voxels[ x, y, z ];

Fixing it like this:

int alpha = alphaMask == null || alphaMask.voxels == null ? (byte)0 : alphaMask.voxels[ x, y, z ];

Creates this error :S help

NullReferenceException: Object reference not set to an instance of an object
(wrapper managed-to-managed) object:ElementAddr_3_1 (object,int,int,int)
MVImporter.GenerateFaces (.MVVoxelChunk voxelChunk, .MVVoxelChunk alphaMask) (at Assets/MagicaVoxel/Scripts/MVImporter.cs:420)
MVVoxModelVoxelInspector.CombineVoxels (.MVVoxModelVoxel[] voxels) (at Assets/MagicaVoxel/Scripts/Editor/MVVoxModelVoxelInspector.cs:43)
MVVoxModelVoxelInspector.OnInspectorGUI () (at Assets/MagicaVoxel/Scripts/Editor/MVVoxModelVoxelInspector.cs:20)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1240)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Individual voxels

When "Import as Individual Voxels is selected", there is a bug with mesh building : in the following screen, I've imported a model as individual voxels, then used the "Combine Selected" function on the left half of the voxels.

individual-bug

There clearly is a problem with lighting and I believe this is due to incorrect normals. In MVImporter.CubeMeshWithColor(float, Color) only 8 vertices are added to the mesh, one for each "corner". There should 3 for each corner : one for each corner and for each face (normal).

On the other hand models will have 3 times more data...

I'm not concerned about individual voxels (yet), so I just open this ticket so that people knows what's going on with lighting. I don't know if this should be fixed or not.

How To out of date.

Your how to is either out of date or incorrect for MVInport.
Is there any way you could include some demo code?
I can't seem to figure out how to use this after a few hours spent attempting to load a vox model.
When using the MVVoxMOdel script, how do you get the colors used in MagicaVoxel to show in the imported model?

Shader error

I"m using Unity 5.6.1f1
I'm getting this error:
Shader error in 'Hidden/SSAO': Can't find include file frag_ao.cginc at line 59

Suggestions

Hi,

I'm getting back to work on my old voxel project, and first thing to do is to get it up to date with Unity and MagicaVoxel.

I thought I could work on MagicaVoxelUnity on parallel and get it working again.

Here are a few changes that come to my mind :

  • Remove unused/outdated/not working stuff (shaders, SSAO, alphamask - thinking about it, that was a bad idea).
  • I made a new repository to create a generic C# vox file reader (not dependant on Unity3D). I'm going to use it in my own project, and I could integrate it to MagicaVoxel if you are ok with that, so that upcoming vox format changes are dealt once instead of each project. This shouldn't be hard.
  • Add UV data to meshes so that it can work with Unity Standard Shaders (we can still set vertex color so that anyone can use his own shader) and use MagicaVoxel palettes png as textures.
  • maybe a few other changes

What do you think @darkfall ?

error while recombining

Unity 2017.1

when i try to recompine a selection of separated voxels, i get this error:

NullReferenceException: Object reference not set to an instance of an object MVVoxelChunk.get_sizeX () (at Assets/MagicaVoxel/Scripts/MVImporter.cs:28) MVVoxModelVoxelInspector.CombineVoxels (.MVVoxModelVoxel[] voxels) (at Assets/MagicaVoxel/Scripts/Editor/MVVoxModelVoxelInspector.cs:38) MVVoxModelVoxelInspector.OnInspectorGUI () (at Assets/MagicaVoxel/Scripts/Editor/MVVoxModelVoxelInspector.cs:20) UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1240) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Not working in Unity 5.5

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
	}
	}
	}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.