I’m new to babylon, just creating my first application and I’m facing a problem that can’t resolve for days.
I’m trying to replicate by code the Extended configuration of Babylon Viewer found on github:
BabylonJS/Babylon.js/blob/master/Viewer/src/configuration/types/extended.ts
can’t add more than two links, sorry
I really like the lighting setup. This scene is perfectly suitable for my application.
The extended configuration has a lot of definitions for lights, camera and scene. You will need to apply them all to your scene if you want your model to look exactly like in the right picture. It is not the easiest task (to recreate that in the playground), but is more than possible. Go over each of the definitions (like you did with the lights) and apply them to your scene, lights, camera, model and so on.
This is the exact algorithm I was using:
checking property
googling for documentation
applying
But in the end - too different results.
If a ground plane, the environment is ok - similar, then after applying imageProcessing - my scene is too bright.
Also, I can’t understand at all how to setup point lights: If I set the direction for them as in the config file - my sofa is completely black.
I even added gizmos to setup lights by hand and then copied the transformedDirection values directly into direction during light creation. But what I noticed:
dragging gizmos
getting transformedDirection values
copy-paste them into new BABYLON.SpotLight creation …
launching the scene and what i see - light directed not as I dragged gizmos.
I’m missing something here. Maybe I’m checking the wrong values here:
engine.runRenderLoop(function () {
if (sceneToRender && sceneToRender.activeCamera) {
var light2 = sceneToRender.getLightByName("light2");
console.log("light2"+ light2.transformedDirection);
sceneToRender.render();
}
});
maybe I should check not the transformedDirection, but something else.
I’m out of the clue… stuck… don’t know what to do else…
Also, lights intencity in the viewer is set to 7. In my scene, somehow, even intensity 3 is too bright. Why?
At the first glance it should be pretty straightforward - take config property and write corresponding code. But some settings I was not able to find in the documentation at all.
The biggest struggle is:
how the size of the model in 3dsmax corresponds to the world size inside babylon? If I am placing the model at postion Vector3(0,0,0) and light at position Vector3(1,0,0) - turns out the light is inside the model.
Why, if I’m setting for spotlights direction Vector3(0,0,0) - there the model should be - the model is still not filled with the light…
I am also not sure why you need to apply material to the model after you loaded it. The viewer will not work this way - the material should already be configured in the model file itself.
Thing is - I’m trying to build a furniture configurator, that’s why materials not loaded with the model on purpose, because later I will be changing materials and applying them to the same model. In this case - not really wise to load same mesh after changing material.
Thank you for the source code link - will dig into it
Changing numbers does not affect camera bouncing range at all. Same behavior is in playground (even with empty scene with ground, box, and camera) and on my local machine.
camera.upperBetaLimit / camera.lowerBetaLimit - intention - to limit camera movement under the sofa. No need for a viewer to see bottom of the furniture
By doing so, turns out, it ruined the starting camera position. I would like the starting screen look like this:
Not too far, not too close and under the angle, similar as the image above.
Spent quite some time already and I don’t understand what should I tweak to achieve this
The screenshot was not attached correctly (or - i can’t seem to be able to open this page), so I am not sure how you want it to be oriented.
Setting the camera’s target (after loading the model, for example) will recalculate your alpha/beta/radius values, so you should set them after setting the target. For example:
it is not after adding a mesh, it is after setting the camera’s target
You can see the description in the function’s documentation - ArcRotateCamera | Babylon.js Documentation