Problem with normals when building my own LDraw interpreter.


RE: Problem with normals when building my own LDraw interpreter.
#3
(2019-03-12, 22:11)Roland Melkert Wrote: Things to check:

Are the type 1 line matrices multiplied correctly?

Not everything is CCW or CW it can differ per .dat, in LDCad I convert everything to CCW (flip tri and quads point order) before using the data.

How do you correct for the neg Y in ldraw? (things seem to be pos Y in your images)

Is unity left or right handed?

Thanks for the quick response Roland!

First of all, I copied the matrix multiplication from the convertor and am using built-in unity classes to translate the vertices. I think that all that should be working correctly, but then again the 2x4 suggests otherwise. I can't run any complicated tests now since I'm in bed on my phone but I will try tomorrow morning.

Secondly, unity uses a left-handed coordinate system with clockwise binding. I have handling for CW and CCW but as far as I'm aware all files in these simple brick tests use CCW winding anyways. I am converting those to CW by changing the vertex order. Also, I would suspect that a mistake in that system would cause more problems than just those few quads; that is unless if I'm wrong about the winding, but again I cannot check that right now.

The Y correction is done as a final step in the conversion process, I go through the already established vertices and invert their Y coordinate. This shouldnt cause any problems since removing this inversion gives the same results, just upsidedown in Unity's Y+ system.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: Problem with normals when building my own LDraw interpreter. - by Lasse Boijens - 2019-03-12, 22:32

Forum Jump:


Users browsing this thread: 1 Guest(s)