# MultiTexture node?

**URL:** <https://forum.castle-engine.io/t/multitexture-node/1866>\
**Category:** Uncategorized\
**Created:** [April 15, 2025, 5:00pm UTC](https://forum.castle-engine.io/t/multitexture-node/1866 "2025-04-15T17:00:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![edj](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/edj/32/1701_2.png) [@edj](https://forum.castle-engine.io/u/edj)\
**Post date:** [April 15, 2025, 5:00pm UTC](https://forum.castle-engine.io/t/multitexture-node/1866/1 "2025-04-15T17:00:17Z")

</div>

What is the best way to have multiple textures on a tcastlescene? (ie my terrain indexed triangle sets). I see MultiTexture node? But not any examples that use it. It doesn’t look like this is how you handle the multiple textures used in tcastleterrain. I want to have the grid texture be able to combine with whatever the terrain texture ends up being.

 ![Untitled-1](https://forum.castle-engine.io/uploads/default/original/2X/a/a7e6acc55f8a76dc74105595725b6bdcadb9dbf4.jpeg)  
What would be the recommended way to achieve what I want?

---

<div class="post-metadata">

**Author:** ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)\
**Post date:** [April 15, 2025, 8:46pm UTC](https://forum.castle-engine.io/t/multitexture-node/1866/2 "2025-04-15T20:46:57Z")

</div>

If you want to see (possibly mix) multiple textures when displaying the _single pixel from a single triangle on the screen_, then _multi-texturing_ is the solution. Here by _multi-texturing_ I mean the “capability to pass multiple textures to a single shader on GPU”.

However, it doesn’t mean using necessarily the X3D `TMultiTextureNode`. The `TMultiTextureNode` exposes some ways to combine the textures (and it’s not without flaws, I described them on [X3D MultiTexturing problems | Castle Game Engine](https://castle-engine.io/x3d_multi_texturing.php) ; I described the proposed future [here](https://github.com/michaliskambi/x3d-tests/wiki/Deprecate-some-unused-and-badly-specified-MultiTexturing-specification-pieces)).

But it’s much more flexible to just create your own GLSL shaders,. using our `TEffectNode` (see [Shader Effects (Compositing Shaders) | Castle Game Engine](https://castle-engine.io/compositing_shaders.php) for links to CGE examples). Pass multiple textures as “uniforms” to this shader, and in the shader combine the textures (like grass, rock, snow) using any algorithm you want (e.g. you can look at height, at steepness, and/or you can use another texture called “splatmap” that contains the weights for other textures).

You can take a look how CastleTerrain unit sets up `TEffectNode`, the related shader code in [terrain.fs](https://github.com/castle-engine/castle-engine/blob/master/src/scene/glsl/source/terrain.fs).

Some simple example is also in [demo-models/compositing\_shaders/terrain.x3dv at master · castle-engine/demo-models · GitHub](https://github.com/castle-engine/demo-models/blob/master/compositing_shaders/terrain.x3dv) .
