GameEngineExportWB – FreeCAD to X3D and Castle Model Viewer

Hi everyone,

I would like to share GameEngineExportWB, an open-source Workbench I have been developing for FreeCAD.

The project started from a very practical need: I wanted to walk through the models I create in FreeCAD in first person and see them in a more interactive environment. While looking for a solution, ChatGPT suggested Castle Model Viewer. I tried it, liked the results, and gradually started building a workflow around it.

The basic idea is simple:

FreeCAD → GameEngineExportWB → X3D → Castle Model Viewer

The Workbench exports FreeCAD CAD/BIM scenes to X3D and provides tools for launching and testing them in Castle Model Viewer. At the moment it includes X3D export, first-person starting positions, lighting, materials and textures, visual profiles, quick example scenes, X3D analysis and some Castle diagnostics.

I am a maintenance engineer, not a professional software developer. I can read and write code and have created small tools for my work for many years, but these projects are developed mainly in my spare time and usually grow from real engineering needs.

AI, especially ChatGPT, has helped me turn many ideas that previously stayed in Excel or were never developed into working FreeCAD tools. I am also trying to follow an important recommendation Michalis gave me: to make sure that using AI does not mean losing understanding of the code and of the X3D that the Workbench generates.

The current public version is 0.2.1, developed and tested with FreeCAD 1.1.3.

GitHub:
https://github.com/MVM444/GameEngineExportWB

The repository includes installation instructions. It can be installed as a custom FreeCAD Addon.

I think this connection between FreeCAD, X3D and Castle could also be useful to other people in either community. Feedback, testing, ideas and contributions are very welcome.

Here is one example of a FreeCAD model exported and viewed in Castle Model Viewer::

[Screenshot 1]

Thanks to Michalis for Castle Game Engine, Castle Model Viewer, and for encouraging me to share the project here.

Best regards,
Marco

3 Likes

Thank you very much for developing this and sharing! As I mentioned in our email conversation, I have never seen something made in FreeCAD exported to X3D looking so good :slight_smile: I’m making a news post on engine news and will mention this.

Hi everyone,

I would like to share some recent progress on GameEngineExportWB, now updated to version 0.3.0.

The Workbench has undergone several improvements, including a cleaner interface, a redesigned Quick Example dialog and a migration to the modern FreeCAD Addon structure following recommendations from the FreeCAD community.

The most interesting new feature is an experiment with solar visualization.

A colleague recently asked me about solar studies for architectural projects. This led me to discover the Solar Workbench for FreeCAD. After exploring its capabilities, I decided to try connecting it with GameEngineExportWB and Castle Model Viewer.

Instead of implementing another solar calculation system, GameEngineExportWB reads the results from Solar and uses them to prepare the X3D scene.

The exported scene can now include sunlight controlled by solar position, an interactive solar diagram, a compass and a bilingual information display showing the date, time, altitude and azimuth.

It is also possible to change the simulated date and time directly inside Castle Model Viewer, allowing the sunlight to change without returning to FreeCAD.

I have also improved the Quick Example interface, making it easier to create test models and experiment with the export process.

The new version was tested with FreeCAD 1.1.4 and Castle Model Viewer 5.2.0.

GitHub: https://github.com/MVM444/GameEngineExportWB

This is still a visualization tool, not a replacement for a complete solar irradiation analysis. I would particularly appreciate feedback on the interactive X3D solar controls and the rendering of sunlight and shadows in Castle.

Many thanks to Michalis and the Castle community for their work and support.

Best regards,

Marco

3 Likes