![]() |
![]() |
![]() |
![]() |
We did a few updates to our terrains, set up by the TCastleTerrain component. You can play with them e.g. by exploring the examples/terrain or separate demo test-high-precision-terrains.
- The code is simpler and more efficient by internally using the
TIndexedTriangleSetNodenode for rendering.This means always using 1 draw call to render entire terrain (unlike previous
TIndexedTriangleStripSetNoderendering mode whenTriangulate=truewhere each strip took 1 draw call; we considered using an OpenGL trick to connect multiple strips into one draw call by using degenerate triangles at strip start/end, but theTIndexedTriangleSetNodeseemed more straightforward solution).The
TIndexedTriangleSetNodealso maps directly to GPU (unlikeTIndexedFaceSetNodethat needs triangulation, unlikeTElevationGridNodethat needs a proxy).The code is also simpler: we have just one rendering path. Previously, we had 2 approaches, and deprecated
Triangulatewas choosing which one we use. -
Normals are calculated fast and are good for connected terrain patches.
This was broken previously (in both
Triangulate=trueandTriangulate=falsemodes, although was supposed to work OK inTriangulate=true).Now it’s correct (and it is correct regardless of the deprecated
Triangulate/ newTCastleTerrain.TriangulationIgnoreHeights). Terrain patches will match (regardless ofTCastleTerrain.TriangulationIgnoreHeights, terrains will maych even if theirTCastleTerrain.TriangulationIgnoreHeightsare different).Explore
additional_noise_offset_test.castle-user-interfacein examples/terrain to test this. The screenshot on the side shows 3TCastleTerraininstances, but you see no weird lighting at the point where they connect, their normals match perfectly. -
New
TCastleTerrain.TriangulationIgnoreHeightsproperty. This determines how we split quads into triangles. -
Triangulateis now a deprecated alias toTCastleTerrain.TriangulationIgnoreHeights. If you used this to request consistent ordering — then newTCastleTerrain.TriangulationIgnoreHeightsis just as good. If you usedTriangulatefor anything else — then it is probably not needed anymore, new rendering takes the best from previous 2 algorithms. -
TCastleTerrain.Subdivisionsmeaning changed.They now determine the number of rows in columns in the mesh. E.g. subdivision (4,4) means 16 (4 * 4) quads and 25 (5 * 5) vertexes. This matches the Blender’s “subdivisions” parameter for grids.
Note: This post details changed done last month, even before 7.0-alpha.3 release. Yeah, we have a backlog of announcements 🙂
Next steps in terrains: synchronize, review and merge Base terrain editing tools for Castle Engine Editor pull request from Andrzej Kilijański to introduce a big new feature – terrain editing! Stay tuned and please support us on Patreon!



