Creases in x model

I’m exporting from SoftImage Mod Tool 7.5. All looks well in ambient light but if I add a directional or point, I get creases or inconsistent lighting on the triangles? Or something. Here is a pic:

Any idea how to fix this?

There are two ways to solve this:

  • Use per-pixel lighting instead of per-vertex lighting. You can do this by enabling the shader generator (setShaderAuto() in Panda, or press P in pview)
  • Add more vertices where the lighting inconsistencies are.

Hmm. setShaderAuto() doesn’t seem to do anything? Is there anything specific on where to put it?

This is my code:

# Panda Render Window, this is the main thread
class PandaApp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)
        #base.disableMouse()     # turn off internal camera control
        base.setBackgroundColor(0, 0, 0)
        random.seed()

        # set auto shader for pixel based lighting as opposed to vertex lighting
        render.setShaderAuto()

        # start wx control window in it's own thread
        self.wxApplication = wxThread()
        self.wxApplication.start()

        # load dice models
        self.LoadModels()

        # fix the camera here
        self.camera.setPos(0, -8, 1)
        self.camera.setHpr(0, 0, 0)

        # setup a directional light
        dlight0 = DirectionalLight('dlight')
        dlight0.setColor(VBase4(0.8, 0.8, 0.5, 1))
        dlnp0 = render.attachNewNode(dlight0)
        dlnp0.setHpr(0, -60, 0)
        render.setLight(dlnp0)

Also, adding more polygons to the model just makes it worse.

Hmm, that sounds like trouble. I don’t have much experience with this in particular, sorry. Try regenerating the normals using egg-trans or something like that.

I think (I’m really careful saying this, because I have little experience) that it might also depend on the topology of the triangles, that perhaps a triangle fan-like topology would be more likely to cause these issues.

Using flat shading instead of smooth shading is probably the easiest way to solve this, but you might prefer smooth shading in this case. (smooth shading = vertex normals, flat shading = polygon normals.)

This is basically a modeling issue.
There are two ways to fix it:

  • Break the normals around the pits in the dice. You can do this in Softimage by selecting the edge loop around the pit and right clicking in the viewport, then select “Mark Hard Edge/Vertex”.
  • Add a bevel to soften the lighting. Select the edge loop, right click, and pick “Bevel Components”.

THANKS! That fixed it