question

Fiona Kattenstroth avatar image
0 Likes"
Fiona Kattenstroth asked Phil BoBo commented

Problems with the webserver

I tried to use the webserver with the WebGL-mode for multiple things. Thereby some problems occured, which can be seen in the attached model.

1. 2D backgrounds laying in a plane are not displayed

2. The old conveyors aren't shown either

3. CAD layouts in .dwg or .dae format aren't displayed

4. The "Date and Time Display" in a dashboard cannot be displayed the right way

5. Eventhough the run time is selected as Date and Time, as soon as the model runs, the display switches to seconds. The same problem happens with the run speed. If I change it by code, the display won't switch, but the model recognizes the "new speed". This should be a display error.

6. Using a checkbox is critical, because the user cannot see the right state of the box. This should be a display error as well, because the model on the server acts the right way.

7. Moreover it appears that even hidden objects do have an impact on the performance, don't they?

8. Sometimes it's necessary to have text fields in the 3D-model, but they also harm the performance. Is there any way to include them without impairing the performance badly?

Hopefully some of you know the problems and can help. Thank you in advance

20201113_webserver test_2.fsm

FlexSim 20.2.2
flexsim 20.2.2webserverwebkit
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Phil BoBo avatar image
2 Likes"
Phil BoBo answered Phil BoBo commented

When streaming the 3D view using WebGL instead of video, the mesh data of the objects in your model is sent to the client device to be rendered in the browser. Depending on the model’s configuration, certain rendering techniques will either not work correctly in this manner or have serious performance considerations. When building a model to be used with WebGL Streaming, you should take care to optimize how it is configured to minimize the amount of data sent each update frame. If you can send mesh data once and then render it multiple times on the client-side, it will perform better than if you must keep re-sending a large amount of data each update.

When using the Mesh API, the last parameter when initializing a mesh is a set of flags. One of those flags (MESH_DYNAMIC_DRAW), signals a usage hint to the graphics card that the data store contents will be modified repeatedly and used many times. This hint enables the graphics driver to store that data in memory that is optimized for that kind of usage. When using WebGL Streaming with the WebServer, when this flag is used on a mesh, FlexSim will skip that mesh instead of streaming it to the client every frame. This optimization will cause certain meshes to simply not draw instead of making the system unusably slow.

1. The Visual Tool Plane display mode rebuilds its mesh every draw frame, dynamically setting its size and texture coordinates. Because it uses the MESH_DYNAMIC_DRAW flag, it does not stream using WebGL. To render a plane with WebGL, use the Imported Shape visual display mode with the included shape FlexSim\fs3d\General\Plane.3ds. Because Visual Tool Planes are used so commonly, perhaps we should update how it is rendered to not be so dynamic. I’ll add a case to the dev list.

2. The Legacy Conveyors are deprecated and no longer actively supported. They use old rendering techniques that rebuild their meshes every draw frame and are purposefully not streamed using WebGL.

3. The DWG renderer is a custom third-party renderer that controls its own view frustum and occlusion clipping planes using deprecated OpenGL functions. Consequently, DWG files do not work with WebGL Streaming. They also don’t work with a Core Profile OpenGL Context, stereoscopic 3D, VR, or RTX Mode.

4. The Date and Time Display looks like a bug. I’ll add a case to the dev list to look into this.

5. The display switching back to seconds also looks like a bug. I’ll add a case to the dev list.

As for programmatically changing the run speed on the server using FlexScript without explicitly updating that slider widget on the client browser, I’m not surprised that it doesn’t update. Unless something on that web page is querying the server to get the model runspeed and set the state of the slider, it isn’t going to update. I’m not sure whether the default page of the WebServer even tries to do that, but I’ll add a note to the dev list to look into it.

6. This checkbox appears to be linked correctly, so I’m not sure why its state isn’t updated by the dashboard. You can see the queries on the webserver output window that are used to update the dashboard data, so this is probably designed to work. I’ll add a case to the dev list to look into it.

7. That depends on what you mean by “hidden objects” and “performance.” The rendering pipeline is a complex system with many interacting variables. Depending on your configuration and where the system is being constrained, different things may be causing bottlenecks and performance issues. Without specifics, this question can’t be answered specifically one way or the other.

8. 3D Text is displayed with cached meshes for each character. If you are not modifying the text often, then those meshes should stream just fine and then be rendered fine on the client browser. If the text is constantly changing, then it will need to constantly re-stream that data, and adversely affect the performance. I wouldn’t suggest using dynamically changing 3D text with WebGL Streaming.

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Fiona Kattenstroth avatar image Fiona Kattenstroth commented ·

@Phil BoBo Thanks for your comprehensive answer! It also raised some further questions:
First of all I couldn't find the place where I can set the flag MESH_DYNAMIC_DRAW. Could you please show an example for this? Referring to point 8: Does the text know that it won't change or do I have to set the flag for dynamic draw as well?
According to 7th I created multiple items in the 3D-model of whom I switched the shape to hide. In another case I used planes to attach additional dynamic data to some objects. For obvious reasons the model didn't run fluently on the server, so I hid the planes in the 3D-model. The performance didn't improve significantly, so that I assume that even if an object is hidden it effects the computing power. Is that correct?

0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ Fiona Kattenstroth commented ·

The flag MESH_DYNAMIC_DRAW is set as part of the Mesh API. Everything drawn in FlexSim (other than the DWG renderer) uses the Mesh API. That flag is set in the init() function on a mesh using the C++ API or the mesh() command using the FlexScript API.

You, as a modeler, only set that flag if you are building and drawing your own custom meshes with the Mesh API. That flag is set by the developer of the mesh. For example, the Visual Tool is defined in the Library and sets that flag in MAIN:/project/library/VisualTool>behaviour/cppfunctions/buildMesh()

The 3D text renderer is defined in the Engine and doesn't use that flag. Thus, if you have dynamically changing text, it is going to keep trying to stream those changes. If you are building your model to run with WebGL streaming, don't use dynamically changing 3D text. The text doesn't know whether it won't change or not. It just tries to stream its meshes. It's up to you to not change those meshes all the time, otherwise, it will be really slow.

I don't follow your explanation about the hidden objects. "For obvious reasons the model didn't run fluently on the server." Nothing about your explanation seems "obvious" to me. If the performance didn't improve, then rendering the shapes that you hid is probably not the bottleneck in the rendering pipeline. Your assumption doesn't make sense to me. I would need to actually replicate the situation to explain the rendering performance.

As an analogy, your explanation is like saying that using a larger engine on a car doesn't make it go faster than a small engine because you tested it with two cars on bricks without wheels touching the road. In both cases, the car didn't move anywhere so you make the false assumption that the engine size doesn't matter. In this analogy, the engine size isn't changing the outcome because without wheels on the road, the car can't move at all. In your example, if something else is causing the performance issue, then your test is causing you to make false assumptions.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.