WorldWideTelescope / wwt-windows-client

WorldWide Telescope Windows Application
Other
179 stars 55 forks source link

3D Models flipped along one axis (Y?) #169

Open astrodavid10 opened 3 years ago

astrodavid10 commented 3 years ago

3D models are flipped long what appears to be the Y axis in both the Windows and web clients. Compare the attached example of Cassini with what it should look like: https://nasa3d.arc.nasa.gov/detail/jpl-vtad-cassini Cassini.zip

Carifio24 commented 2 years ago

@astrodavid10 Yeah, it looks like the handedness of the models is flipped between the linked image and WWT.

Just curious, how did you make this WWTL file? The Cassini link gives a Blender file in the zip file. Apparently Blender uses a right-handed coordinate system, while DirectX uses a left-handed system, so I'm wondering if this is the cause of the discrepancy here.

There is a FlipHandedness parameter in WWT's Object3d class which might be able to help with this problem. I'm not sure where to import the 3d object file into WWT, though.

Carifio24 commented 2 years ago

Ok, I think I've got a potential solution here, which looks like a combination of the coordinate system handedness issue and a WWT bug.

After loading the layer file you sent and tracking the frame, I see this: image

which has the wrong handedness. If I right-click and select Properties > Right Handed, I see this: image

so the handedness is correct, but the faces didn't seem to get the memo. I think the WWT issue is here. Up to line ordering, both parts of this if-else are doing the same exact thing. If I switch indexiesB and indexiesC in the FlipHandedness block (or do any other odd-parity permutation of the lists), I get

image

which seems like the correct model to me.

According to Wikipedia, .obj files use a right-handed coordinate system to specify vertices. Thus, I would imagine that pretty much any .obj file will need to have this right-handed option selected.

astrodavid10 commented 2 years ago

Hey, awesome! I appreciate it!

pkgw commented 2 years ago

OK, I finally got around to finishing up the test build of this.

If you download this "drop-signed" Zip file and run the installer at drop-signed → Setup1 → Release → WWTSetup.msi, you should be able to test out the latest build that includes this fix.