# Mirrored Repeat mode, TextureProperties.BoundaryModeS/T/R support

**URL:** https://forum.castle-engine.io/t/mirrored-repeat-mode-textureproperties-boundarymodes-t-r-support/545
**Category:** News
**Created:** [March 13, 2022, 6:59pm UTC](https://forum.castle-engine.io/t/mirrored-repeat-mode-textureproperties-boundarymodes-t-r-support/545 "2022-03-13T18:59:58Z")
**Posts on this page:** 1
**Page:** 1

<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: [March 13, 2022, 6:59pm UTC](https://forum.castle-engine.io/t/mirrored-repeat-mode-textureproperties-boundarymodes-t-r-support/545/1 "2022-03-13T18:59:58Z")

</div>

| [![TextureProperties on 3D texture](https://castle-engine.io/wp/wp-content/uploads/2022/03/157565041-225bbccd-77cb-4acf-a2d2-7106ebb51452-200x113.png)](https://castle-engine.io/wp/wp-content/uploads/2022/03/157565041-225bbccd-77cb-4acf-a2d2-7106ebb51452.png "TextureProperties on 3D texture") |
| [![TextureProperties - various boundary modes, including mirrored repeat](https://castle-engine.io/wp/wp-content/uploads/2022/03/157565048-a8f5edd6-88b7-42d2-8521-c7f2ff8ebd61-200x113.png)](https://castle-engine.io/wp/wp-content/uploads/2022/03/157565048-a8f5edd6-88b7-42d2-8521-c7f2ff8ebd61.png "TextureProperties - various boundary modes, including mirrored repeat") |

1. Thanks to _Matthias ([Free Pascal meets SDL](https://www.freepascal-meets-sdl.net/))_ we now support “mirrored repeat” mode for textures, for both glTF and X3D models. We also support X3D [TTexturePropertiesNode.BoundaryModeS/T/R](https://castle-engine.io/apidoc-unstable/html/X3DNodes.TTexturePropertiesNode.html#BoundaryModeS) properties, which allow to request a wrapping mode — clamp, repeat, or mirrored repeat. (see [TBoundaryMode](https://castle-engine.io/apidoc-unstable/html/X3DNodes.html#TBoundaryMode))

The way you would request it in Pascal is by creating and adjusting `TTexturePropertiesNode` like this:

```
TextureProperties := TTexturePropertiesNode.Create;
TextureProperties.BoundaryModeS := bmMirroredRepeat;
TextureProperties.BoundaryModeT := bmMirroredRepeat;
MyImageTexture.TextureProperties := TextureProperties;
```

You can experiment with the [example code that builds a mesh using Pascal](https://castle-engine.io/viewport_and_scenes_from_code#_building_a_mesh_using_code) to add there `TextureProperties` as above.

Example X3D file utilizing it is in [demo-models](https://github.com/castle-engine/demo-models/), file [texturing\_advanced/texture\_boundary\_modes.x3dv](https://github.com/castle-engine/demo-models/blob/master/texturing_advanced/texture_boundary_modes.x3dv).

Example glTF file using this is in [Khronos glTF-Sample-Models](https://github.com/KhronosGroup/glTF-Sample-Models/), open glTF or GLB in dir [2.0/TextureSettingsTest](https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/TextureSettingsTest).

2. Another related fix is that we fixed the default values of `TTexturePropertiesNode.MinificationFilter`, `TTexturePropertiesNode.MagnificationFilter`. By default, they now indicate to use minification/magnification specified in `MyScene.RenderOptions`, which means that merely adding a `TTexturePropertiesNode` doesn’t make the filtering uglier. This was fixed in X3D 4.0 some time ago (after my request) and CGE now follows, so we have a saner default.

The [documentation about TextureProperties node](https://castle-engine.io/x3d_implementation_texturing.php) was extended to mention it all.
