Certain shapes crash CityEngine when generating models

3193
5
Jump to solution
07-15-2015 08:07 PM
NathanStocker
New Contributor III

Hi,


I'm having some issues with aligned shapes in CityEngine 2015.1.

Everything generally works fine, but when I try to generate models using my rule on certain aligned shapes it crashes CityEngine instantly. This is only on a handful of shapes out of 55,000, so finding the actual shapes which are causing the crashes is like finding a needle in a haystack! I've found them, but there's nothing really special about them - but they often have an astray vertex or two, which can be deleted to fix the shapes. However, the issue keeps popping up for new shape layers and I don't want to have to find and fix the shapes every time.


I've tried to pinpoint the cause and discovered that it only happens if the shapes have been aligned to the terrain - if they're flat at y=0, then they generate fine. They also generate fine with other rules applied. However, my rule is pretty long and complicated, so it's hard to pinpoint what in the rule could be causing the issue.

I'm wondering if it's a bug in 2015.1 around aligning the shapes. Does anybody have any thoughts about what could be causing the crashes?

I've attached the error log in case anybody can make more sense of them than I can

0 Kudos
1 Solution

Accepted Solutions
ChrisWilkins
Regular Contributor

Awesome bug reproduction! Thanks!

What is happening is that some of your shapes have coincident vertices (more than one vertex in the same location in space), and the envelope function doesn't like it. The fix is to use cleanupGeometry to remove the redundant vertices.

Here is a modification that fixes it, along with two print statements that show the change produced by cleanupGeometry (open the Console window to see print output).

EnvelopeCreation -->

  print("Before Cleanup: " + geometry.nVertices)

  cleanupGeometry(vertices, 0.1)

  print("After Cleanup: " + geometry.nVertices)

  envelope(world.up, 10, 2.5, 45, 2.5, 45, 2.5, 45, 2.5, 45)

  alignScopeToGeometry(yUp, any, longest)

  color(0.2,0.2,1)

  X.

You will see on that shape, that it had 6 vertices, and after cleanup, just 4. Now it doesn't crash the envelope. You may need to fine tune the tolerance on cleanupGeometry if other shapes still crash it.

I'll pass this on to development so they can look into the immediate crash situation.

Thanks!

Chris

View solution in original post

5 Replies
NathanStocker
New Contributor III

As a follow-up to this (in case anyone's interested) - it turned out to be an envelope operation that was crashing CE for particular aligned shapes. No idea why that's the case, but I've taken it out of the rule and now everything seems fine.

The strange this is, there's another envelope function at another place in the rule that works fine!

All's well that ends well I guess

ChrisWilkins
Regular Contributor

Nathan,

Is it possible for you to recreate the error on demand? I mean, can you save your project in the state where the error can be recreated using instructions? If so, I would try to reproduce your error on my machine, and if I can make the error happen again, I will forward it to the developers.

Thanks,

Chris Wilkins

NathanStocker
New Contributor III

Hi Chris,


Thanks for taking an interest in this.

I've created a simplified project with a couple dozen shapes, one of which causes the crash (Shape 55402). I also simplified the rule to remove extraneous parts. I've included two different DEMs, although neither of them avoids the issue.

The project's saved here: https://www.dropbox.com/s/ifzf5ixoq7k8qpc/CrashTest.zip?dl=0​.

Unfortunately I don't have anybody to test it on their computer, so let me know if something doesn't work with the project. It also means I can't test the issue on another computer, so it could easily just be my PC rather than CityEngine!

Thanks again

Nathan

0 Kudos
ChrisWilkins
Regular Contributor

Awesome bug reproduction! Thanks!

What is happening is that some of your shapes have coincident vertices (more than one vertex in the same location in space), and the envelope function doesn't like it. The fix is to use cleanupGeometry to remove the redundant vertices.

Here is a modification that fixes it, along with two print statements that show the change produced by cleanupGeometry (open the Console window to see print output).

EnvelopeCreation -->

  print("Before Cleanup: " + geometry.nVertices)

  cleanupGeometry(vertices, 0.1)

  print("After Cleanup: " + geometry.nVertices)

  envelope(world.up, 10, 2.5, 45, 2.5, 45, 2.5, 45, 2.5, 45)

  alignScopeToGeometry(yUp, any, longest)

  color(0.2,0.2,1)

  X.

You will see on that shape, that it had 6 vertices, and after cleanup, just 4. Now it doesn't crash the envelope. You may need to fine tune the tolerance on cleanupGeometry if other shapes still crash it.

I'll pass this on to development so they can look into the immediate crash situation.

Thanks!

Chris

View solution in original post

NathanStocker
New Contributor III

No worries, happy to help

I had included a cleanupGeometry in my rule, which worked 99% of the time but not quite all of time (even turned all the way up to 1). In any case, it wasn't too big of a deal to remove the envelope operation - so it's all fine now.

Thanks for the help!

Nathan

0 Kudos