immersive-web / webxr-samples

Samples to demonstrate use of the WebXR Device API
https://immersive-web.github.io/webxr-samples/
MIT License
987 stars 474 forks source link

glTF 2.0 model so dark in viewport #124

Open SmaugArt opened 3 years ago

SmaugArt commented 3 years ago

Hello. I have a little problem. When I export my model from blender to gltf 2.0 and render it to the webxr scene, the model appears so dark, but the samples have normal light. When I tried to re-export any model from "media / gltf" the same problem occurs. What could cause this effect?"

sophie1000 commented 2 years ago

Hi,

I had the same problem. Maybe you've found a solution since you posted this but for the people from the future :

If you go to JS > render > core > renderer.js you will find this line :

const DEF_LIGHT_COLOR = new Float32Array([2, 2, 2]);

I've found that if you increase the value between the [., ., .,] it will add more light in your scene. You can also change the light direction in the line above.

GiovanniTurri commented 2 years ago

Thank you @sophie1000 , I noticed that also in JS > render > materials > pbr.js there are some variables (find 'light' in the file) somewhat changes but I think we need to act also inside *.glb files (using Blender or other tools). Infact, changing materials to textures (starting from sunflower.gltf from examples) in models that have their own light solved almost entirely the problem for me.

From samples, I noticed that light works well on the *.glTF files with

"asset" : {
        "generator" : "Khronos glTF **Blender I/O** v1.0.5",
        "version" : "2.0"

There is https://immersive-web.github.io/webxr-input-profiles/packages/assets/tutorial/ but the profiles directory with profile.json is no more available (maybe was moved).

Don't know if @klausw has some lines of code (maybe in three.js) or some suggestions about lights settings in the model.

Thank you everyone

AdaRoseCannon commented 2 years ago

I had a similar issue in my project which I fixed by using: renderer.outputEncoding = sRGBEncoding;