Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[add-3d-model-babylon.html] set rootMesh.position.y = -35 3D model disappears #4528

Open
Lorenzoarc opened this issue Aug 9, 2024 · 5 comments
Labels
need more info Further information is requested

Comments

@Lorenzoarc
Copy link

Lorenzoarc commented Aug 9, 2024

Hi guys,

maplibre.js version v4.5.2
broswer : edge or chrome

I started with the example maplibre-gl-js/test/examples
/add-3d-model-babylon.html, I modified the line 131 of the code adding rootMesh.position.y = -35 and this is the result:
https://github.com/user-attachments/assets/08607d37-3242-47d8-ab58-92b6500a64b3

The 3d model of the satellite dish goes beyond the map plane and it's not visible from some perspective as you can see from the video.
I have tryed to add at line 206 this line of code:

map.on('load', function () {
    // Iterate over all the layers and remove the background layers
    map.getStyle().layers.forEach(function (layer) {
            console.log(layer.id)
           map.removeLayer(layer.id);
        });
    });

The idea with the code above is cutting all the layers including the map for solving the visualization of the negative y portion of the model, but the problem persist.

My final goal would be to display excavations on the map, so using transparency on the map layer for making visible the part of the excavations which are in the underground.

I don't know if it is a bug or not, but if there is a way to display model also under the map would be awesome.

Any suggestions?
Thank you for the help

Best regards

@HarelM
Copy link
Collaborator

HarelM commented Aug 11, 2024

Please provide a jsbin/codepen/stackbliz and better explain the expected vs actual.
There's a template to opening an issue for a good reason...

@HarelM HarelM added the need more info Further information is requested label Aug 11, 2024
@Lorenzoarc Lorenzoarc changed the title [Add 3D model Babylon]Part of 3D model which is with negative y is not visible [add-3d-model-babylon.html] set rootMesh.position.y = -10 3D model disappears Aug 19, 2024
@Lorenzoarc Lorenzoarc changed the title [add-3d-model-babylon.html] set rootMesh.position.y = -10 3D model disappears [add-3d-model-babylon.html] set rootMesh.position.y = -35 3D model disappears Aug 19, 2024
@Lorenzoarc
Copy link
Author

Lorenzoarc commented Aug 21, 2024

Sorry,
I hope this time the issue is more clear

maplibre.js version** v4.5.2
broswer : edge or chrome

I started with the example maplibre-gl-js/test/examples
/add-3d-model-babylon.html, I modified the line 131 of the code adding rootMesh.position.y = -35 and this is the result:
https://github.com/user-attachments/assets/08607d37-3242-47d8-ab58-92b6500a64b3

The 3d model of the satellite dish goes beyond the map plane and it's not visible from some perspective as you can see from the video.
I have tryed to add at line 206 this line of code:

map.on('load', function () {
    // Iterate over all the layers and remove the background layers
    map.getStyle().layers.forEach(function (layer) {
            console.log(layer.id)
           map.removeLayer(layer.id);
        });
    });

The idea with the code above is cutting all the layers including the map for solving the visualization of the negative y portion of the model, but the problem persist.

My final goal would be to display excavations on the map, so using transparency on the map layer for making visible the part of the excavations which are in the underground.

I don't know if it is a bug or not, but if there is a way to display model also under the map would be awesome.

Any suggestions?
Thank you for the help

Best regards

@HarelM
Copy link
Collaborator

HarelM commented Aug 21, 2024

I think you'll need to tweak the farZ plane.
The current map cuts the 3D scene just behind the map so stuff like what you are trying to do are not supported.
You'll need to dig into the code to solve this basically.
Look at the following code:
https://github.com/maplibre/maplibre-gl-js/blob/f8e9c78f563153711650fc3bafbd9951540483e5/src/geo/transform.ts#L890C15-L890C39

@Lorenzoarc
Copy link
Author

Thank you for the answer, I have successfully solved my problem.
Could it be possible to make the farZ parameter adjustable outside the library?

Thank you for the amazing project,
Best regards,

@HarelM
Copy link
Collaborator

HarelM commented Aug 28, 2024

It's calculated constantly basically, so I'm not sure what would be a good solution to this.
You are welcome to propose a design that would solve your case, and hopefully others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants