create3000 / x_ite

X_ITE X3D Browser, view and manipulate X3D and VRML scenes in HTML.
https://create3000.github.io/x_ite/
Other
66 stars 13 forks source link

Adding a new node #170

Closed coderextreme closed 1 month ago

coderextreme commented 2 months ago

I am trying to implement a new node, and I got down to the place where the XML parser won’t accept my node, and so the file doesn’t load with an obscure error message. Can you make the error more plain, and suggest a path or checklist for adding extension nodes? I’m trying to add VariationPhysicsModel right now.

Thanks,

John

create3000 commented 2 months ago

It is of course possible to add new node types, but not recommended to do so. In most cases it is sufficient to create a prototype, you should first be familiar with this. Prototypes can be created in the Editor, filled with content and live tested.

coderextreme commented 2 months ago

Sure, I’ve already done prototypes though. I want to do GPU instancing or particle systems where each mesh has a different animated inner and outer radius, plus 4 other different parameters to each instance. Each instance has it’s own 6 animation values that vary over time. Not really related to scale (I have 2 scales with 2 values for each instance, plus 2 rotations in spherical space

I don’t see why I need to bother with scripts and prototypes when I can build a generic physics model which varies the six variables and I can apply different shaders with morphing code as needed.

The new node is generic.

I just want to say numParticles=‘300’ and be done, not create 300 ProtoInstances.

John

On Thu, May 2, 2024 at 3:35 PM Holger Seelig @.***> wrote:

It is of course possible to add new node types, but not recommended. In most cases it is sufficient to create a prototype, you should first be familiar with this. Prototype can be created in the Editor, filled and live tested.

— Reply to this email directly, view it on GitHub https://github.com/create3000/x_ite/issues/170#issuecomment-2091508202, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMJ53JUKZNPML3DMYS6YDZAKPP7AVCNFSM6AAAAABG7RVCKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJRGUYDQMRQGI . You are receiving this because you authored the thread.Message ID: @.***>

coderextreme commented 2 months ago

Suggested enhancement to X3D XML ProtoInstance.

Add a “numInstances” SFInt32 field [1, inf) that shortcuts repeating the ProtoInstance N times.

Thanks.

Say I have 10000 instances.

I’m not saying it’s the best solution.

Yes, I’ve tried to create my own physics model for particle systems. I’d like a physics model with 6 min/max ranges (6 value-variation) to apply to each particle. I’d like the 6 values available to shaders.

For som reason, my new node is getting rejected. I’m unclear as to the reason. My guess is, I may need the Full profile???

Yes, I’ve done an ordinary particle system. Yes, I’ve done regular ProtoInstances.

John

On Thu, May 2, 2024 at 3:35 PM Holger Seelig @.***> wrote:

It is of course possible to add new node types, but not recommended. In most cases it is sufficient to create a prototype, you should first be familiar with this. Prototype can be created in the Editor, filled and live tested.

— Reply to this email directly, view it on GitHub https://github.com/create3000/x_ite/issues/170#issuecomment-2091508202, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMJ53JUKZNPML3DMYS6YDZAKPP7AVCNFSM6AAAAABG7RVCKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJRGUYDQMRQGI . You are receiving this because you authored the thread.Message ID: @.***>

create3000 commented 2 months ago

Adding a field is up to you. You can create a second prototype with the numInstances field.

If you build your own node, the class of the node must be registered in the browser, you can use browser.addConcreteNode (class) to do so.

The class needs some static properties, constructor, and other basics, see WorldInfo https://github.com/create3000/x_ite/blob/main/src/x_ite/Components/Core/WorldInfo.js, which is a very simple class.

Since you will probably give the class a component name, you must also specify this in the file when you use the new node. For testing it is sufficient to use "ParticleSystems" as component name, but it is also possible to create own components.

create3000 commented 2 months ago

Here is an example how to create a new node using addConcreteNode:

https://github.com/create3000/x_ite-tests/blob/main/tests/x_ite/Browser/ConcreteNode.test.js

coderextreme commented 2 months ago

Here's what I'm trying to build:

x_ite/src/x_ite/Components/ParticleSystems/VariationPhysicsModel.js at main · coderextreme/x_ite (github.com) https://github.com/coderextreme/x_ite/blob/main/src/x_ite/Components/ParticleSystems/VariationPhysicsModel.js

I can't seem to build a good x_ite/dist folder, continually having to checkout from github to get back right where i was before.

Here's my webpack log. I've also tried npm run dist

$ webpack s Compressing draco_decoder_gltf.js ... Compressing libktx.js ... Using 8 CPUs to package X_ITE. Bundling Annotation ... Bundling CADGeometry ... Bundling CubeMapTexturing ... Bundling DIS ... Bundling EventUtilities ... Bundling Geometry2D ... [webpack-dev-server] Project is running at: [webpack-dev-server] Loopback: http://localhost:8080/ [webpack-dev-server] On Your Network (IPv4): http://172.24.169.132:8080/ [webpack-dev-server] Content not from webpack is served from '/home/john/x_ite/public' directory [webpack-dev-middleware] wait until bundle finished: / Can't open dist/assets/components/EventUtilities{,.min}.js: No such file or directory. Can't open dist/assets/components/DIS{,.min}.js: No such file or directory. Can't open dist/assets/components/EventUtilities{,.min}.js: No such file or directory. Can't open dist/assets/components/DIS{,.min}.js: No such file or directory. Can't open dist/assets/components/CubeMapTexturing{,.min}.js: No such file or directory. Can't open dist/assets/components/Annotation{,.min}.js: No such file or directory. Can't open dist/assets/components/CADGeometry{,.min}.js: No such file or directory. Can't open dist/assets/components/Geometry2D{,.min}.js: No such file or directory. Can't open dist/assets/components/EventUtilities{,.min}.js: No such file or directory. Can't open dist/assets/components/DIS{,.min}.js: No such file or directory. Can't open dist/assets/components/CubeMapTexturing{,.min}.js: No such file or directory. Can't open dist/assets/components/Annotation{,.min}.js: No such file or directory. Can't open dist/assets/components/CADGeometry{,.min}.js: No such file or directory. Can't open dist/assets/components/Geometry2D{,.min}.js: No such file or directory. Bundling Geospatial ... Bundling HAnim ... Can't open dist/assets/components/CubeMapTexturing{,.min}.js: No such file or directory. Can't open dist/assets/components/Annotation{,.min}.js: No such file or directory. Can't open dist/assets/components/CADGeometry{,.min}.js: No such file or directory. Can't open dist/assets/components/Geometry2D{,.min}.js: No such file or directory. Bundling KeyDeviceSensor ... Bundling Layout ... Bundling NURBS ... Bundling ParticleSystems ... Can't open dist/assets/components/Geospatial{,.min}.js: No such file or directory. Can't open dist/assets/components/KeyDeviceSensor{,.min}.js: No such file or directory. Can't open dist/assets/components/Geospatial{,.min}.js: No such file or directory. Can't open dist/assets/components/KeyDeviceSensor{,.min}.js: No such file or directory. Can't open dist/assets/components/Geospatial{,.min}.js: No such file or directory. Can't open dist/assets/components/KeyDeviceSensor{,.min}.js: No such file or directory. Can't open dist/assets/components/Layout{,.min}.js: No such file or directory. Can't open dist/assets/components/HAnim{,.min}.js: No such file or directory. Can't open dist/assets/components/NURBS{,.min}.js: No such file or directory. Can't open dist/assets/components/ParticleSystems{,.min}.js: No such file or directory. Bundling Picking ... Bundling RigidBodyPhysics ... Can't open dist/assets/components/Layout{,.min}.js: No such file or directory. Can't open dist/assets/components/HAnim{,.min}.js: No such file or directory. Can't open dist/assets/components/NURBS{,.min}.js: No such file or directory. Can't open dist/assets/components/ParticleSystems{,.min}.js: No such file or directory. Can't open dist/assets/components/Layout{,.min}.js: No such file or directory. Can't open dist/assets/components/HAnim{,.min}.js: No such file or directory. Can't open dist/assets/components/NURBS{,.min}.js: No such file or directory. Can't open dist/assets/components/ParticleSystems{,.min}.js: No such file or directory. Bundling Scripting ... Bundling Text ... Bundling TextureProjection ... Bundling Texturing3D ... Can't open dist/assets/components/Picking{,.min}.js: No such file or directory. Can't open dist/assets/components/Scripting{,.min}.js: No such file or directory. Can't open dist/assets/components/TextureProjection{,.min}.js: No such file or directory. Can't open dist/x_ite{,.min}.mjs: No such file or directory. Can't open dist/assets/components/Picking{,.min}.js: No such file or directory. Can't open dist/assets/components/Scripting{,.min}.js: No such file or directory. Can't open dist/assets/components/TextureProjection{,.min}.js: No such file or directory. Can't open dist/x_ite{,.min}.mjs: No such file or directory. Can't open dist/assets/components/Picking{,.min}.js: No such file or directory. Can't open dist/assets/components/Scripting{,.min}.js: No such file or directory. Can't open dist/assets/components/TextureProjection{,.min}.js: No such file or directory. Can't open dist/x_ite{,.min}.mjs: No such file or directory. Bundling VolumeRendering ... Bundling X_ITE ... Can't open dist/assets/components/Text{,.min}.js: No such file or directory. Can't open dist/assets/components/Text{,.min}.js: No such file or directory. Can't open dist/assets/components/Text{,.min}.js: No such file or directory. Can't open dist/x_ite{,.min}.js: No such file or directory. Can't open dist/x_ite{,.min}.js: No such file or directory. Can't open dist/x_ite{,.min}.js: No such file or directory. Can't open dist/assets/components/VolumeRendering{,.min}.js: No such file or directory. Can't open dist/assets/components/X_ITE{,.min}.js: No such file or directory. Can't open dist/assets/components/VolumeRendering{,.min}.js: No such file or directory. Can't open dist/assets/components/X_ITE{,.min}.js: No such file or directory. Can't open dist/assets/components/VolumeRendering{,.min}.js: No such file or directory. Can't open dist/assets/components/X_ITE{,.min}.js: No such file or directory. Can't open dist/assets/components/Texturing3D{,.min}.js: No such file or directory. Can't open dist/assets/components/Texturing3D{,.min}.js: No such file or directory. Can't open dist/assets/components/Texturing3D{,.min}.js: No such file or directory. Can't open dist/assets/components/Texturing3D{,.min}.js: No such file or directory. Can't open dist/assets/components/Texturing3D{,.min}.js: No such file or directory. Can't open dist/assets/components/RigidBodyPhysics{,.min}.js: No such file or directory. Can't open dist/assets/components/RigidBodyPhysics{,.min}.js: No such file or directory. Can't open dist/assets/components/RigidBodyPhysics{,.min}.js: No such file or directory. webpack compiled successfully

On Mon, May 6, 2024 at 11:08 AM Holger Seelig @.***> wrote:

Here is an example how to create a new node using addConcreteNode:

https://github.com/create3000/x_ite-tests/blob/main/tests/x_ite/Browser/ConcreteNode.test.js

— Reply to this email directly, view it on GitHub https://github.com/create3000/x_ite/issues/170#issuecomment-2096406388, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMJ52UVE2KJROMDF3JMZLZA6THRAVCNFSM6AAAAABG7RVCKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJWGQYDMMZYHA . You are receiving this because you authored the thread.Message ID: @.***>

create3000 commented 2 months ago

Maybe it comes from <i> [webpack-dev-server] Project is running at:, I do not have a webpack-dev-server running. I simply use Webpack CLI.

create3000 commented 2 months ago

Instead of creating a new node you also could animate the force field of ForcePhysicsModel node. It is of type SFVec3f, and a TimeSensor and PositionInterpolator can be used for that.

coderextreme commented 2 months ago

Ok, i will try to uninstall. When i start ‘’’webpack s’’’ it normally asks me if I want to install the dev server. I will stop installing it.

On Tue, May 7, 2024 at 2:56 AM Holger Seelig @.***> wrote:

Maybe it comes from [webpack-dev-server] Project is running at:, I do not have a webpack-dev-server running. I simply use Webpack CLI.

— Reply to this email directly, view it on GitHub https://github.com/create3000/x_ite/issues/170#issuecomment-2097679777, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMJ5ZYUFLR4ESNSXB6NITZBCCL7AVCNFSM6AAAAABG7RVCKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJXGY3TSNZXG4 . You are receiving this because you authored the thread.Message ID: @.***>

create3000 commented 2 months ago

Why are you trying to bundle X_ITE. The link above describes how to add a node to X_ITE without bundling, using Browser.addConcreteNode. Link again: https://github.com/create3000/x_ite-tests/blob/main/tests/x_ite/Browser/ConcreteNode.test.js

coderextreme commented 2 months ago

Where would I require or import the new node to link it into X_ITE?

Does it all get combined into x_ite.min.js and x_ite.min.js? What’s the best way to do the combining? I’ve been doing ‘’’npm run dist’’’ and ‘’’webpack s’’’

I’ve just been trying to copy WindPhysicsModel.

What I’ll try to do is build with webpack, then deploy without webpack server.

I don’t know how not to bundle, but I can add a .js file to my html script tag easy enough.

Thanks,

John

On Tue, May 7, 2024 at 11:37 AM Holger Seelig @.***> wrote:

Why are you trying to bundle X_ITE. The link above describes how to add a node to X_ITE without bundling, using Browser.addConcreteNode. Link again: https://github.com/create3000/x_ite-tests/blob/main/tests/x_ite/Browser/ConcreteNode.test.js

— Reply to this email directly, view it on GitHub https://github.com/create3000/x_ite/issues/170#issuecomment-2098870456, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMJ542NLFCYLU42XCWCPTZBD7M3AVCNFSM6AAAAABG7RVCKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJYHA3TANBVGY . You are receiving this because you authored the thread.Message ID: @.***>

create3000 commented 2 months ago

You will use the example page from https://create3000.github.io/x_ite/#embedding-x_ite-within-a-web-page and after the X_ITE script you include your script with part of things from https://github.com/create3000/x_ite-tests/blob/main/tests/x_ite/Browser/ConcreteNode.test.js as mentioned above.

coderextreme commented 2 months ago

Sounds easy enough. I also have new shader variables.

On Tue, May 7, 2024 at 3:12 PM Holger Seelig @.***> wrote:

You will use the example page from https://create3000.github.io/x_ite/#embedding-x_ite-within-a-web-page and after the X_ITE script you include your script with part of things from https://github.com/create3000/x_ite-tests/blob/main/tests/x_ite/Browser/ConcreteNode.test.js as mentioned above.

— Reply to this email directly, view it on GitHub https://github.com/create3000/x_ite/issues/170#issuecomment-2099219764, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMJ527RZKFVKPVBWEKE6LZBEYRJAVCNFSM6AAAAABG7RVCKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJZGIYTSNZWGQ . You are receiving this because you authored the thread.Message ID: @.***>