[x3d-public] List of X3D problems or missing features, from the point of view of Michalis and Castle Game Engine

Michalis Kamburelis michalis.kambi at gmail.com
Mon Mar 5 02:41:18 PST 2018


 2018-03-05 11:12 GMT+01:00 Michalis Kamburelis <michalis.kambi at gmail.com>:
> If you want to change the behavior of channels (e.g. to "replace"
> instead of "modulate" on all RGBA channels, or to "replace" only on
> the alpha channel but modulate on RGB) then use the multi-texturing
> nodes with a single texture. MultiTexture.mode field was invented
> exactly to specify such thing, and it should work equally well when
> you just place a single texture inside MultiTexture. Unfortunately,
> the MultiTexture specification is ambiguous... but I propose how to
> fix it, and also extend, on
> https://castle-engine.io/x3d_multi_texturing.php . (My view3dcene and
> Castle Game Engine already implement it, if you want to check.)
>

Maybe some examples will help to convey what I mean in the paragraph above :)

If we would apply X3D specification changes that I propose on
https://github.com/michaliskambi/x3d-tests/wiki/Make-RGB-and-grayscale-textures-treatment-consistent
*and* on https://castle-engine.io/x3d_multi_texturing.php then both of
these behave the same:

1. ImageTexture { url "my_texture.png" }

2. MultiTexture { texture ImageTexture { url "my_texture.png" } }

Both of the above modulate, by default, on all (RGBA) channels. They
are exactly equal for all texture types (RGB or grayscale, with or
without alpha channel). And a texture without alpha is like texture
with alpha = 1, and a grayscale texture is like texture with
red=green=blue.

You can actually test it with view3dscene and Castle Game Engine already.

(If one would instead follow the current X3D specification literally, then
1. would sometimes replace, sometimes modulate, depending on
RGB/grayscale format of the texture.
2. would always modulate (regardless if texture is grayscale or RGB),
at least on RGB channels. The spec is ambiguous what to do with alpha
in this case. See the first point of my page
https://castle-engine.io/x3d_multi_texturing.php#section_problems_solutions
for explanations.)

And if you want to explicitly request some mode, then (after
multi-texturing spec is fixed+extended as I propose on
https://castle-engine.io/x3d_multi_texturing.php ) you can write this:

# replace RGBA
MultiTexture { texture ImageTexture { url "my_texture.png" } mode "REPLACE" }

# modulate RGB, replace alpha
MultiTexture { texture ImageTexture { url "my_texture.png" } mode
"MODULATE / REPLACE" }

# replace RGB, modulate alpha
MultiTexture { texture ImageTexture { url "my_texture.png" } mode
"REPLACE / MODULATE" }

Regards,
Michalis



More information about the x3d-public mailing list