Dark side of textured 3D object not black

Hi all ! Just started OF a few weeks ago and for the first time I can’t find a solution to the following problem. I have 2 spheres and a point light. Ambient color of the light and the material both set to black. However, when I use map a texture on the sphere, their dark sides are not totally black (with a solid red sphere, the shading is right, but the sphere appears white). Any pointers on what could be wrong ?

setup:

    fbu.load("JupiterTexture.jpg");
    
    ofEnableDepthTest();
    
    // set light and material for  3D objects------
    
    ofSetVerticalSync(true);
    ofSetSmoothLighting(false);
    light.setPointLight();
    //light.setAttenuation(0);
    light.setAmbientColor(ofColor(0,0,0));
    //light.setDiffuseColor(ofColor(255,255,255));
    //light.setSpecularColor(ofColor(50,50,50));
    light.setPosition(ofVec3f(0,0,height*300));
    //light.lookAt(ofVec3f(0,0,0));
    ofEnableLighting();
    light.enable();
    
    material.setAmbientColor(ofColor(0,0,0));
    material.setDiffuseColor(ofColor(255,255,255));
    material.setSpecularColor(ofColor(0.0,0.0,0.0));
    material.setEmissiveColor(ofColor(0,0,0));
    material.setShininess(120);

draw:

    ofEnableDepthTest();
    
    cam.begin();
    
    light.enable();
    material.begin();
    ofPushMatrix();
    ofRotateYRad(PI);
    fbu.getTexture().bind();
    sphere.draw();
    fbu.getTexture().unbind();
    ofRotateYRad(moonRadPos);
    ofSetColor(255,0,0);
    moonRadPos += 0.01;
    ofTranslate(moonOrbitRad,0,0);
    moon.draw();
    ofPopMatrix();
    material.end();
    
    cam.end();

Is it the global ambient color? Try ofSetGlobalAmbientColor()

Thanks a lot @dizzy ! That was it.

1 Like