Select to view content in your preferred language

Reversed Normals When Importing DAE & OBJ from Rhino

Jump to solution
05-05-2015 11:33 AM
New Contributor II

What can I do to make sure that I don't have reversed normals before exporting/importing a bunch of geometry into CityEngine from Rhino? All the surfaces I created were basically done the same way and I'm not sure why they are coming into CityEngine all randomly backwards. Actually, I'm sure it's not random, but it's frustrating and a waste of time and I'd like to understand why this happens and what I can do about it. I've attached the offending files in DAE, OBJ and Rhino format, for your convenience.

0 Kudos
11 Replies
Esri Regular Contributor

chandrasekhar reddy guda wrote:

Matthias Buehler

i am also having the same problem, normals problems getting when importing drawing file, please share a code of .net

Hello Chandra Sekhar Reddy Guda,

There is no need to write .net code, in fact CityEngine does not use .net at all.

Instead you can use CityEngine CGA modelling language to manipulate the imported shapes from a drawing file.

The cga rule snipped above provided by Matthias Buehler can be used to reverse any down facing normals.

Further information can be found in the CityEngine CGA Help:

reverseNormals Operation

As a second option, you can use the CityEngine python scripting interface.

This python script corrects the shapes normals after import:

# checks if the shape point order is clockwise

# note: applies to horizontal plane (x: east, y: up, z: south)

def clockwise(shape):

    shapeVertices = ce.getVertices(shape)

    sum = 0

    for i in xrange(0,len(shapeVertices),3):

        x1 = shapeVertices

        z1 = shapeVertices[i+2]

        x2 = shapeVertices[(i+3)%len(shapeVertices)]

        z2 = shapeVertices[(i+5)%len(shapeVertices)]                

        sum += (x2-x1)*(z2+z1)

    return sum < 0

if __name__ == '__main__':  

    selectedShapes = ce.selection()

    for shape in selectedShapes:

        if ce.isShape(shape):

            # ensure counter-clockwise order of input shapes (normal up)

            if clockwise(shape):


Further information can be found in the CityEngine Python Help:

Python Scripting Interface Reference

0 Kudos
New Contributor III

Thank u Thomas Fuchs, i will try above

0 Kudos