Everything is white on my model

Hi guys,

I would like your help to solve a problem with my model (an humanoid robot): it has colored materials but it appears white on a game. It hasn’t textures only materials. In Pview it also appears white except when I turn on the lights (and everything is ok). I put an ambient light on my world and the problem continued. If put a green ambient light only to the model, it become green as whole, not shaded gray and black as it should be.

I’m using Cinema4D for modelling. I export the model to .fbx or .dae format, import it from Blender, and then export to .egg format. However I also tried export directly to .X file but the problem persists.

Thanks in advance,
David

PS: My preference is use .X format in order to avoid Blender as intermediate software. But C4D merge all geometries into a single one. I need keep geometries as are, in order to create a rigid body to each one because I will use Bullet joints to control the body parties.

As a heads up, the EGG format does not support lights, so you may be missing a light in your scene. You could try importing fbx or dae into Panda with assimp or fcollada, respectively. I believe the official builds build with both of these libraries.

Thanks for this! Less 1 problem (use Blender as helper)… Now I’m using Assimp to directly read the FBX file!

Anyway I tried create a simple box on C4D with blue material and same problem.Here is the code:

from math import pi, sin, cos

from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from panda3d.core import AmbientLight, VBase4


class MyApp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)

        # Load the environment model.
        self.scene = self.loader.loadModel("models/environment")
        # Reparent the model to render.
        self.scene.reparentTo(self.render)
        # Apply scale and position transforms on the model.
        self.scene.setScale(0.25, 0.25, 0.25)
        self.scene.setPos(-8, 42, 0)

        # Add the spinCameraTask procedure to the task manager.
        self.taskMgr.add(self.spinCameraTask, "SpinCameraTask")

        alight = AmbientLight('alight')
        alight.setColor(VBase4(255, 255, 255, 1))
        alnp = self.render.attachNewNode(alight)
        self.render.setLight(alnp)

        self.box = self.loader.loadModel("box.egg")
        self.box.reparentTo(self.render)

    # Define a procedure to move the camera.
    def spinCameraTask(self, task):
        angleDegrees = task.time * 6.0
        angleRadians = angleDegrees * (pi / 180.0)
        self.camera.setPos(20 * sin(angleRadians), -20.0 * cos(angleRadians), 3)
        self.camera.setHpr(angleDegrees, 0, 0)
        return Task.cont


app = MyApp()
app.run()

In pview the box appears “blue” but in the game remains white. Note that there’s a ambient light.

Does enabling the autoshader help?

self.render.set_shader_auto()

No effects…

I figure out that directional light does the trick… But I really would like use an ambient light… I say this because it’s being tricky adjust the directional light HPR to leave the environment less dark…I’d like something like the sun light… Some example?

Let me note that an ambient light alone is unlikely to resemble sunlight: it has no directionality at all, just applying a uniform lightness to every part of a scene, regardless of orientation. Instead, what I might suggest is a directional light, to provide the directional component of sunlight, with an ambient light to brighten the shadows. In addition, that setup should make material colours visible, if I’m not much mistaken.

Thanks everyone… I decided use only directional light to get the work done…