Mar 1, 2011 at 1:29 AM

I believe I have found a problem with the TextureConverter class. It seems to fail to find objects reliably.

Above is a small example. The sonic sprites are all one texture and I am trying to find all the individual bounding boxes.

Anyway just wanted to make the community aware of the problem, I don't have time to track it down so I'm just switching to my Marching Squares implementation.

Mar 4, 2011 at 8:59 PM

Is this with FPE 3.2 or 3.3 (in the source control)? I will send this discussion to David and hear what he thinks.

Mar 4, 2011 at 10:02 PM

I can't test this without having the texture. I tested my code with far, far more complex textures then this one Oo ...

Mar 4, 2011 at 10:07 PM

I've send an email to Matthew in case he is not subscribed to posts in the discussion.

Mar 4, 2011 at 10:11 PM

I always work with the latest source control version. Also, hopefully I will have time to finish up integrating Marching Squares into Farseer.

Mar 4, 2011 at 10:13 PM

Could you upload the texture you used somewhere for David to take a look at it?

Mar 4, 2011 at 10:15 PM

David - It seems to be doing this on almost any texture I use. Here is the sonic texture -

Mar 4, 2011 at 10:30 PM

Well, it shouldn't be every texture you use oO.

I've found the bug: The algorithm quits when it finds an illegal polygon, one with only one vertex for example.


The texture you are using contains single pixel "objects" and therefore the alg. quits at some point. Check your texture at X:313; Y:4.

I'll remove the bug and work on the missing features tomorrow. I promise.


It's half past midnight here in germany and I've had a few beers an hour ago - so, sorry when I go to bed now :).

Mar 5, 2011 at 12:19 PM

@David: Nicely done. I've had a couple of people complain about the TTV algorithm not working and after getting my hands on their texture, I found out it was due to an artifact in the image. Would it be possible to locate artifacts and tell the user? I don't expect the artifact-finder to be run in release mode.

@Matthew: I've quickly fixed up the demo you made in the Testbed and it looks awesome. It is really dynamic and seems to have pretty decent performance. There seem to be a bug somewhere tho in the left side of the "terrain area". I can't fill out the whole area with terrain as it fails on the left side. Could you take a look at it?

Mar 5, 2011 at 11:03 PM
Edited Mar 5, 2011 at 11:03 PM

You know guys, I had to go to work today -.- ... it's saturday. Saturday! There was a small big bug and I had to fix it ... (I forgot to add CultureInfo.InvariantCulture to a convert method and small values with many decimal places became very large numbers xD. Our client wasn't amused -.- ...)

However, I fixed the "quit on single pixel" - bug and I've added a function to the CDTDecomposer to create polygons with holes :).

Mar 5, 2011 at 11:37 PM

It was Saturday David. You were supposed to sit in front of your computer and do geek stuff - not work. :)

Great to hear you fixed the bug. Does the provided texture give the correct results now?

Having a look at your changes as soon as I'm done with some arc shape stuff.

Mar 6, 2011 at 3:12 PM

Does the provided texture give the correct results now?

Yes and no :).

Yes: TTV works.

No: ... the CDTDecomposer works but with lower detail "only" and I think I know the reason for that ...but I'm not sure. I'll work on it tomorrow. I've had enough for today :).

Mar 6, 2011 at 4:04 PM

@Ian: Cool, I will work on the higher level Terrain class a little today. The problem is with the method in which I clip the data in the point cloud. I'll use AABB's to provide a more elegant solution, but there is nothing wrong with the actual generation of the terrain.

@Everyone: Can everyone play with the Marching Squares demo and basically stress test it out. I did my best, but there are always bugs and I'd like to have the base implementation as bullet proof as possible. If you get any exceptions just post up the data here please.

@David: Thanks, for fixing that for me. Decomposition is a tricky bitch ;)