Turn OFF, Scene Default Light

Dear Reader,

I have a scene with an sphere object, this object has a “new THREE.ShaderMaterial with value: new THREE.TextureLoader().load”

The goal:
Total control over scene lighting through my own light set

Problem:
if i do not add any lights to my scene, still there is a light shining on my object, the light is somewhere on the negative z-axe.

Assumption:
there is somewhere a default scene light active.

Question:
how can i turn all lights OFF, also the default light, so i have total control over the lighting of my scene?

Thank you in advance…

There is no default light in a new THREE.Scene instance. If you’re using THREE.ShaderMaterial, then lighting would not affect it anyway, unless the shader explicitly includes code to compute lighting. It’s very likely that the “light” you see is something specific to the code in your ShaderMaterial, and you’ll need to inspect or replace that material.

‘’’
// vertexShader
varying vec3 normalVertexEarth;

// fragmentShader
void main(){
normalVertexEarth = normal;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}

varying vec3 normalVertexEarth;

void main(){

float intensity = pow(0.8 - dot(normalVertexEarth, vec3(0, 0, 1.0)), 2.0);
gl_FragColor = vec4(0.3, 0.6, 1.0, 1.0) * intensity;

}
‘’’

these are the shaders i use, since i am new to shaders, do you have advise for me.

in Maya i have in the render module “Enable default Light”, when i turn it of, i have to manually link my objects to specific light

do you have an idea where the light comes from, and how to turn it Off?

The code you shared takes the normalVertexEarth vector (angle of the surface at the vertex) and uses it to compute an intensity value multiplied against the output color. There’s no “light” as such, it’s that math and nothing more. For uniform shading, replace intensity with 1.0 so that there’s no dependency on the normal direction of the vertex.

3 Likes

thank you… i tried that… does not bring the desired solution…
maybe i have to use lookAt on the sphere so it looks towards the camera, the aim is a uniform ring glow effect
as if the earth has an atmosphere…

any ideas to achieve this in a different way?

You could use a THREE.Sprite with a texture of a blurry circle. Sprites are quads that always face the camera.

3 Likes

That’s a clever workaround, thank you… awesome suggestion…

1 Like