My data consists of at least 30k points each one of which I want to be visualized as a sphere, so I would see thousands of spheres forming a shape. I tried using VRML, because it looks very simple, but the file gets way too big because it consist of repetitions of the text bellow, one for each point:
# 'X_32228'
Transform {
translation 96.0 85.0 76.0
children [
Shape {
appearance Appearance { material Material {} }
geometry Sphere { radius 1 }
}
]
}
How can I create one sphere and replicate it on the different points? or more in general, how can I reduce the size of the output file? even if it's on a different format (like X3D).
You can achieve what you want by using the PROTO mechanism.
The above code basically creates a PROTO (something like a class in Object Oriented Programming) from your Transform where the translation is variable. Then, you have to create instances of it as follows:
... as many as you want, where the translation is the parameter that you change from one instance to another. If you need some other fields to be changed with the instance you just have to follow the above example. For example of you want the radius of the sphere to be variable you would have to create your PROTO as follows:
Please note that SmallSphere_translation and SmallSphere_radius are names chosen by me. You can name these fields as you want.