Comments (5)
with the right docs and warnings, having a separate prop might be easier to understand
yeah, agreed if we have both docs and warnings, this should be fine.
- Make a story on the cameraState module that allows passing matrices directly
we'll have to see about this organization, since if the matrices are a separate prop from cameraState it doesn't make as much sense to group them with the cameraState stories...but they are camera-related, so maybe it's fine. You might find some opportunities to clean up the organization while you're there.
Looking forward to your branch!
from webviz.
This definitely seems like a good feature to add. Let's think about the API a bit more — some of the properties in cameraState would be replaced by the view matrix and some by the projection matrix, right?
view
comes from: target, targetOrientation, targetOffset, distance, phi, thetaOffsetprojection
comes from: perspective, distance, fovy, near, far
I was thinking it might be nice to group these properties in with the cameraState, but now I realize if both matrices are specified then there's nothing left in cameraState (except that keyboard/mouse controls depend on the values in cameraState, but you said you'd probably want to disable those). I'd be a bit hesitant to keep adding new props to Worldview since it already has so many, but maybe we can change the type of cameraState to include both alternatives CameraState | CameraMatrices
? Then it's also more clear that you can't specify both the matrices and the other cameraState properties.
Do you think you (or other users) would want to supply one of these matrices but not the other?
As an point of reference, the XRView interface defined in the WebXR spec provides a projectionMatrix
and a transform
(which has a position
+orientation
, and also a combined matrix
property).
cc @brianc @vidaaudrey who worked with raw view/projection matrices for a Worldview VR project :)
from webviz.
Thanks for the feedback! 😸
Just spent some time poking at it this morning and I think I have a plan for moving forward.
I'd be a bit hesitant to keep adding new props to Worldview since it already has so many
I totally see your concern. I think it's a matter of documentation though. There are 3 groups of users who all want a simple explanation (and ideally an example) of the props they need to use.
- Someone who just wants to use worldview's internal camera state. They'll want to know that this is the default option, that they can use the default mouse and keyboard controls, how to customize them if they want to, and how they can provide an initial camera state if they need to.
- Someone who wants control of the camera state, but doesn't want to deal with matrices. They'll want to know about the
cameraState
object and how each parameter works. They'll also want to know that they need to use theonCameraStateChange
callback to update their camera state so they can use the built in camera controls. - Someone who wants to use their own
view
andprojection
matrices. I believe this person will accept that they'll have to provide their own camera controls, though they might be interested in getting the input events and mapping them the same way they would if using the built in camera controls…
Personally I don't need Worldview to manage input events… that's firmly outside of the scope of what I want it to do for me. But it's definitely convenient if we want this to be a one stop shop for building a 3D application. That's a whole other discussion though.
but maybe we can change the type of cameraState to include both alternatives
Turning cameraState
into a union type is definitely one option, but I think with the right docs and warnings, having a separate prop might be easier to understand… implementation-wise it's not a huge difference. My gut reaction is generally to avoid union types where possible.
Do you think you (or other users) would want to supply one of these matrices but not the other?
I think in most cases if someone is using matrices, they'll probably provide both. CameraStore
provides valid defaults for any values missing in the cameraState
object. We could do a similar thing for cameraMatrices
, along with a console warning.
As a point of reference, the XRView interface defined in the WebXR spec provides a projectionMatrix and a transform
Using the name transform
instead of view
makes sense in the context of the XRView interface because it's a transform for the view. But I think this shape works well for our context:
const cameraMatrices = {
view,
projection
};
Dealing with view
and projection
matrices is common in regl
and the greater WebGL ecosystem. People using this advanced feature will know that they map to the projection * view
part of their vertex shader.
Anyway, it seems like we'll be able to reach alignment one way or another and at this point I'll just need to make a branch for more feedback. Here's my current plan:
- Make a story on the
cameraState
module that allows passing matrices directly - Update the
cameraState
documentation to clearly lay out the 3 scenarios described above - Update the
Worldview
component, theCameraStore
class, and the camera selectors to support the new behavior. - Open a PR for further discussion.
We have a sprint coming up where we're focusing on FE infra. I'll plan to tackle this during the week of Dec 9. Open to discussing more here but probably won't be able to do much until then.
Does that sound like a reasonable plan?
from webviz.
Hey there, we haven't forgotten about this. We have a fork over at https://github.com/hoverinc/webviz/
As we continue to integrate Worldview into our apps, we are finding more tweaks we need to make.
I think our plan to merge might have been a bit premature. It's still something we would like to do, but it might make sense to wait until our changes have stabilized a bit more.
from webviz.
Cool, feel free to make a PR if you think it's stable enough now. 😄
from webviz.
Related Issues (20)
- webviz-core add new route failed HOT 1
- Delayed laserscans when clock times are out of sync HOT 1
- Bag not available HOT 2
- How large rosbag can webviz remote load?
- Consume React components directly HOT 3
- Errors when bootstraping the app HOT 1
- Error in fetching topics and datatypes HOT 1
- npm run bootstrap error
- Wrong visulization when coordinate values are large HOT 1
- Please update the invite HOT 1
- Pause button does not work HOT 2
- Why is the setting for transparency not working? HOT 1
- Can this this application be used as a part of custom application
- Can this application be used as a part of custom application? HOT 2
- Which node version should be used under Windows
- Information on the audio panal?
- Wrong Numeric Interpretation: how to fix? HOT 1
- ROS Demo.bag not available HOT 1
- /dist/vendor.js" Error (404): "Not found HOT 1
- root@ build-static-webviz: `lerna run build && rm -rf __static_webviz__ && cp -r docs/public/app __static_webviz__ && rm __static_webviz__/index.html && cp packages/webviz-core/public/index.html __static_webviz__/index.html && sed -i -- 's/\/dist\/webvizCoreBundle.js/webvizCoreBundle.js/' __static_webviz__/index.html && NODE_ENV=production STATIC_WEBVIZ=true webpack`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webviz.