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

Position of rendering is different from OpenSCAD #8

Open
stockholmux opened this issue Aug 6, 2023 · 6 comments
Open

Position of rendering is different from OpenSCAD #8

stockholmux opened this issue Aug 6, 2023 · 6 comments

Comments

@stockholmux
Copy link
Contributor

If you run the script playground.scad in OpenSCAD proper, the model is centred on the x/y/z axes.

Example:
Screen Shot 2023-08-06 at 2 18 52 PM

In the playground, it seems to be at the lower left of the bounding box.

Example:
Screen Shot 2023-08-06 at 2 18 46 PM

Someone learning OpenSCAD with the playground will be quite thrown off by this, especially of they are doing 0 centred modelling.

@UBaer21
Copy link

UBaer21 commented Aug 6, 2023

I can understand the confusion as WASM is using an stl viewer without any origin or grid markers.
So you can mistaken the 3D-gizmo as origin. But you will see a similar thing also in the lower left corner of the OpenSCAD view window
image

But the position of the objects is identical - and the exported files also contain the same positions.

@t-paul
Copy link
Member

t-paul commented Aug 6, 2023

Yep, it seems the axis marker is positioned at the bounding box of the model. At first glance, I'm not seeing a property to enable some sort of grid.

@t-paul
Copy link
Member

t-paul commented Aug 6, 2023

Hmm, there's https://github.com/gabotechs/react-stl-viewer/blob/master/src/StlViewer/SceneElements/Floor.tsx which sounds like there's support for some x/y plane thingy.

@stockholmux
Copy link
Contributor Author

Humm. I noticed it when I experimented with positionX and positionY to 0 in StlViewer (file: ViewerPanel.tsx) and it corrected the axes.

Screen Shot 2023-08-06 at 4 13 31 PM

Now, if we want the 3D gizmo @UBaer21 it should probably position it in a fixed position and have rulers.

I'm wrestling with gabotechs/react-stl-viewer currently, there doesn't seem like there are many options, especially regarding the camera. Seems like pmndrs/react-three-fiber has more options but less turnkey.

@UBaer21
Copy link

UBaer21 commented Aug 6, 2023

As you can see it is now the center of the bounding box but not the origin - I would assume this would be even more confusing.
You could add a ruler as an object but as we have no real preview that object would render and need to be removed for the export.
like this

but as we have no colors in the viewer (which could work if 3mf color export would be implemented in openSCAD)
And you see that the axis marking will also influence the camera and bounding box - so i think this is not a solution.

in https://ochafik.com/openscad is just nothing - so i think that bounding box edge gizmo is an improvement - but sure it is not ideal .

@ochafik
Copy link
Collaborator

ochafik commented May 30, 2024

Filed gabotechs/react-stl-viewer#55 for origin-bound axes

Although TBH on the long run I feel like we'd need either OpenGL emscripten support OR... gltf export + some color viewer such as https://modelviewer.dev/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants