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

Posted on

TextureProperties on 3D texture
TextureProperties - various boundary modes, including mirrored repeat
  1. Thanks to Matthias (Free Pascal meets SDL) we now support “mirrored repeat” mode for textures, for both glTF and X3D models. We also support X3D TTexturePropertiesNode.BoundaryModeS/T/R properties, which allow to request a wrapping mode — clamp, repeat, or mirrored repeat. (see 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 to add there TextureProperties as above.

    Example X3D file utilizing it is in demo-models, file texturing_advanced/texture_boundary_modes.x3dv.

    Example glTF file using this is in Khronos glTF-Sample-Models, open glTF or GLB in dir 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 was extended to mention it all.

Start the discussion at Castle Game Engine Forum