How to render polygons made by Babylonjs in geographical coordinates such as cesium

Hello, babylon community

I’m a novice developer who just started 3D programming.

We are currently working on a project to model ships and render them on a geographical coordinate system in cesium, or unity.

If the ship you’re modeling consists of about five layers, I’d like to see the ship that’s finally done in cesium by rendering these five objects.

My question is, in Babylon, I create polygons with Vector values, how do I render them in numerous coordinate systems? Is it possible?

I would greatly appreciate it if you could answer my question.

My head is burning under stress…

You’re asking multiple, incompatible questions. The coordinates of “polygons in Babylon” will be in X, Y, Z coordinates. As described in Cesium or Unity, the ship objects or layers will still be in a 3d Cartesian coordinate system. However, the placement of those layers will be described in Cesium in a geographic coordinate system according to some transformation you specify for display. In Unity, the coordinate systems are generally compatible with Babylon.

In the scale the size of a ship, you wouldn’t “transform” those polygons into a different coordinate system.

I also wrote this, which addresses a different aspect of the subject you’re asking about. Consider “How do you draw an object specified in a local cooordinate system into a world coordinate system?” The answer is to transform coordinates. Sometimes it’s transforming coordinate systems. Geographic is longitude/latitude/altitude (a kind of spherical coordinate system) whereas Babylon is in X, Y, and Z (a kind of Cartesian coordinate system). To be useful in Babylon, you’ll want to transform into some limited range to maintain precision, but otherwise the conversion between three-dimemsional coordinate systems is fairly straightforward.

Thank you very much for your reply.

First of all, please consider that this is your first time working on coordinate system transformation and 3d work.
There may be a lack of underlying knowledge.
Listening to the answer, I think the coordinate system drawn by Babylon’s vector value is similar to the Cartesian coordinate system.

But for example

new Vector3(-0.5, -0.5, -0.5), // 0
new Vector3( 0.5, -0.5, -0.5), // 1
new Vector3(-0.5, 0.5, -0.5), // 2
new Vector3( 0.5, 0.5, -0.5), // 3

new Vector3(-0.5, -0.5, 0.5), // 4
new Vector3( 0.5, -0.5, 0.5), // 5
new Vector3(-0.5, 0.5, 0.5), // 6
new Vector3( 0.5, 0.5, 0.5), // 7
Let’s say we created a hexahedron with the above eight vertex coordinates.

When you convert to the actual Cartesian coordinate system, the Earth-Centered, Earth-Fixed (ECEF) coordinate system, 0, 0 indicates the center of the Earth.

In this case, you need to find the center coordinates of where you want to render and compute vectors
I think it’s possible, but I don’t know if the exact direction is right.
And I wonder what happens to the process when you use geographical coordinates.

To sum up, the questions are as follows.

Question 1. How to render the above example hexahedron on a Cartesian coordinate system.

Question 2. How to render the above example hexahedron on a geographical coordinate system

I would greatly appreciate your response.

I’m sorry I have a lot of questions
Have a nice day today!

Babylon’s Vector3 is within Babylon’s X, Y, Z Cartesian coordinate system, just like ECEF.

I recommend start playing around with Babylon and see what’s possible.

Try specifying the hexahedron with those exact coordinates (look at the MeshBuilder class) then use hexahedron.position = new BABYLON.Vector3(1,2,3) to move it to that position in Babylon’s coordinate system.

Try reading some of the available documentation and trying it out in the playground!

1 Like