Presentation from ITDevCon 2023 (day 2), a follow-up to my presentation from day 1. This time I describe some advanced features of the engines, useful to some game/application projects:
- using engine rendering on VCL / FMX form
- 3D generation using X3D nodes
- writing your own shaders
- customizing the editor (with custom components)
6. Editor or not?
● You can design things in CGE editor. Or not,
create all by code.
● You can use TCastleControl (FMX, VCL, LCL) or
TCastleWindow.
● These are independent decisions.
○ All 4 combinations make sense :)
10. Build or modify worlds
● build (or modify)
● 3D or 2D content
● using Pascal code
● use-cases?
○ visualize some external data (like a real-life 3D machinery
or statistical data)
○ procedurally generate 3D worlds
○ fix / enhance existing 3D models
13. From where, to where?
● You can start from:
○ nothing (just create empty TX3DRootNode)
○ or any imported model (X3D, glTF
, Collada, STL, …)
○ (you can combine multiple models too)
● Do what you want on nodes' graph in memory
○ Build and modify
○ Render
○ Process animations, interactions (touch sensors)
● You can save to:
○ X3D file (perfect representation, no loss!)
○ (Coming soon: also save to glTF)
16. Enhance the look of
● Shapes
● Groups of shapes (maybe whole model from glTF
,
X3D etc.)
● Lights
● Textures (maybe write reusable texture generated
in shader)
● Screen (post-processing effects)
using your own GLSL (OpenGL Shading Language)
code.
17. Examples
● Volumetric fog
● Water
● Screen effects
○ Escape from the Universe, on Nintendo Switch:
https://www.nintendo.com/us/store/products/escape-fro
m-the-universe-switch/
26. Custom components
● Specific to your project
● Reuse some necessary graphical designs and
logic
○ E.g. a button for consistent game UI, with key on PC, with
keypad on consoles
○ E.g. a 3D object, like a machinery part, with configurable
size / layout / attachments etc.
○ Maybe model with a shader effect from previous section
○ Maybe 3D thing procedurally-generated from previous
section
27. Design-time
Special design-time operations:
● Use component editors, as in Delphi (context
menu on component)
● Use property editors, as in Delphi (special
editors for some properties, even with
dedicated forms)
● Override CGE editor special methods to
enable extra design-time in CGE editor, like
mesh editing
34. Delphi versions supported
● All Delphi versions >= 10.2.1
○ These are Windows and (to be confirmed) Linux requirements
○ For mobile, a bit stricter requirements: Delphi >= 10.4
○ Always recommended latest Delphi stable, so 11.3 now
○ Tested with Delphi 12 beta of course :)
● Delphi Community Edition is OK too, we specifically test it
○ Note the need to build from Delphi in this case, F9 from CGE editor cannot
work as Community Edition doesn't have command-line compiler.
● https://castle-engine.io/delphi
35. Engine can optionally scale UI.
● It can follow DPI scaling.
● Or it can follow some hard-coded window size (like 1600x900)
"fit" or "enclose" your screen.
○ This is like Unity UI scaling, easy to use and effective for cross-platform
games (where UI size doesn't have to match other apps).
● To make it work OK, you must use anchors.
● Effectively, you can pretend that you always have the same
window size (like 1600x900), hardcode all the positions and
sizes, set proper anchors, and you're good.
UI Scaling