Is it possible to open a X3D wrl file in view3dscene and then have another program dynamically change the scene? Perhaps X3D wrl support opening a port and allowing a TCP connection to change the scene?
Ideas about the difficulty in doing this?
Bill
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This feature is beyond the purpose of view3dscene. But it is definitely possible to code such application using Castle Game Engine, https://castle-engine.io/ , which lies underneath view3dscene :)
The engine gives you API to load the scene and edit it as you wish. You can of course open a TCP connection and accept instructions from the other end and call appropriate CGE methods in return.
As for the difficulty: This can be a very difficult or a very simple task... it depends on the details :)
If you want to allow editing everyhing, and it can be any scene (not limited to some specific X3D models created by your own software), then your best approach is to create network API that exposes compete X3D graph of the loaded scene (can send it in some form over the network), and then accepts changes to this graph (in the form of "change this field to X", "send an input event to Y"). This is quite some work.
OTOH, if you just want to allow simple operations like moving the named Transform nodes, or changing the named Material nodes, then it's simpler. You still must design some network messages to expose a list of transforms/materials, and accept changes to them.
Take into account security. Changing X3D models can e.g. introduce "Inline" node that loads something from disk; you should not let just anyone on the Internet to send this to you.
Take into account network latency. If you want to send huge things, like new vertex data (because you want to edit mesh), then it's a concern. It would be easier to not allow editing mesh.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2018-07-04
Thanks for the details. Been a long time since pascal / modula2 in college. Perhaps I will install fp and paly with view3dscene.
I don't know if the design of X3D really had dynamic updates in mind when it was written. More reading I guess.
I'd really like a simple high level "language" that describes a 3D scene, a viewer that can display the scene in multiple formats (walk, fly, VR, augmented, ...) and allow dynamic updates to the scene description.
Updates would be authenticated. Perhaps some ssh like solution. view3dscene would be started with a key and told to listen on a port. Other apps could connect if they have the key.
Perhaps even have view3dscene ask the user when a new unkey'd request comes in if they want that connection to be allowed.
This all started with a perl hack nmap3d.wrl which converted a nmap network scan into a static VRML scene. I thought it'd be nice if I could update the scene with other data like node network traffic and do that dynamically.
A simple "3D browser" is what I'm after. Support navigation to other scenes, dynamic updates (ie like server push).
I keep using view3dscene. Keep up the good work.
Bill
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you'd like to play with it, you're very much welcome and I will help of course :) Head to https://castle-engine.io/ , download the engine, go through "getting started" ( https://castle-engine.io/documentation.php ) and read a couple of first manual pages ( https://castle-engine.io/manual_intro.php ). The first 4 chapters (up to and including "Transform, animate, duplicate, build a scene") are enough to understand how to use and modify 3D scene.
The engine includes numerous samples that are a good starting point for a 3D browser, like
The code of these examples should be easy after reading the manual linked earlier :)
(Note: do not read or try to modify the view3dscene source code, it's quite complicated and deals with a lot of UI stuff. It's much better to start with one of the above simple examples, like view_3d_model_basic.lpr.)
As for X3D and dynamic updates: it does support them. There is a concept of events, for example you can send an event "addChildren" to the "Group" node to add more nodes. There is a concept of "inputOutput" fields, that are like simple fields (contain data) and can also receive input event to change them, for example the field "translation" of the "Transform" node. These changes can happen at runtime, and good X3D browser should optimize these events/changes.
This is all possible in Castle Game Engine of course. The above manual and examples show it:) Moreover, in case of CGE, you can actually change any X3D field (even the ones not marked "inputOutput" in X3D standard). Of course not all changes are instant (e.g. changing the topology of a large mesh cannot be instant, it's always an "upload of new data to GPU" so some cost is unavoidable). But many changes are optimized and near-instant (for example changing Transform properties, like translation/rotation, or Material or other Appearance properties).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is it possible to open a X3D wrl file in view3dscene and then have another program dynamically change the scene? Perhaps X3D wrl support opening a port and allowing a TCP connection to change the scene?
Ideas about the difficulty in doing this?
Bill
This feature is beyond the purpose of view3dscene. But it is definitely possible to code such application using Castle Game Engine, https://castle-engine.io/ , which lies underneath view3dscene :)
The engine gives you API to load the scene and edit it as you wish. You can of course open a TCP connection and accept instructions from the other end and call appropriate CGE methods in return.
As for the difficulty: This can be a very difficult or a very simple task... it depends on the details :)
If you want to allow editing everyhing, and it can be any scene (not limited to some specific X3D models created by your own software), then your best approach is to create network API that exposes compete X3D graph of the loaded scene (can send it in some form over the network), and then accepts changes to this graph (in the form of "change this field to X", "send an input event to Y"). This is quite some work.
OTOH, if you just want to allow simple operations like moving the named Transform nodes, or changing the named Material nodes, then it's simpler. You still must design some network messages to expose a list of transforms/materials, and accept changes to them.
Take into account security. Changing X3D models can e.g. introduce "Inline" node that loads something from disk; you should not let just anyone on the Internet to send this to you.
Take into account network latency. If you want to send huge things, like new vertex data (because you want to edit mesh), then it's a concern. It would be easier to not allow editing mesh.
Thanks for the details. Been a long time since pascal / modula2 in college. Perhaps I will install fp and paly with view3dscene.
I don't know if the design of X3D really had dynamic updates in mind when it was written. More reading I guess.
I'd really like a simple high level "language" that describes a 3D scene, a viewer that can display the scene in multiple formats (walk, fly, VR, augmented, ...) and allow dynamic updates to the scene description.
Updates would be authenticated. Perhaps some ssh like solution. view3dscene would be started with a key and told to listen on a port. Other apps could connect if they have the key.
Perhaps even have view3dscene ask the user when a new unkey'd request comes in if they want that connection to be allowed.
This all started with a perl hack nmap3d.wrl which converted a nmap network scan into a static VRML scene. I thought it'd be nice if I could update the scene with other data like node network traffic and do that dynamically.
A simple "3D browser" is what I'm after. Support navigation to other scenes, dynamic updates (ie like server push).
I keep using view3dscene. Keep up the good work.
Bill
If you'd like to play with it, you're very much welcome and I will help of course :) Head to https://castle-engine.io/ , download the engine, go through "getting started" ( https://castle-engine.io/documentation.php ) and read a couple of first manual pages ( https://castle-engine.io/manual_intro.php ). The first 4 chapters (up to and including "Transform, animate, duplicate, build a scene") are enough to understand how to use and modify 3D scene.
The engine includes numerous samples that are a good starting point for a 3D browser, like
https://github.com/castle-engine/castle-engine/blob/master/examples/3d_rendering_processing/view_3d_model_basic.lpr
(showing basic editing of X3D graph) https://github.com/castle-engine/castle-engine/blob/master/examples/3d_rendering_processing/animate_3d_model_by_code.lpr
The code of these examples should be easy after reading the manual linked earlier :)
(Note: do not read or try to modify the view3dscene source code, it's quite complicated and deals with a lot of UI stuff. It's much better to start with one of the above simple examples, like view_3d_model_basic.lpr.)
As for X3D and dynamic updates: it does support them. There is a concept of events, for example you can send an event "addChildren" to the "Group" node to add more nodes. There is a concept of "inputOutput" fields, that are like simple fields (contain data) and can also receive input event to change them, for example the field "translation" of the "Transform" node. These changes can happen at runtime, and good X3D browser should optimize these events/changes.
This is all possible in Castle Game Engine of course. The above manual and examples show it:) Moreover, in case of CGE, you can actually change any X3D field (even the ones not marked "inputOutput" in X3D standard). Of course not all changes are instant (e.g. changing the topology of a large mesh cannot be instant, it's always an "upload of new data to GPU" so some cost is unavoidable). But many changes are optimized and near-instant (for example changing Transform properties, like translation/rotation, or Material or other Appearance properties).