[x3d-public] Support for specular maps (and more) in view3dscene, and Blender exporter to CommonSurfaceShader

Michalis Kamburelis michalis.kambi at gmail.com
Sun Apr 30 10:25:56 PDT 2017


2017-04-30 4:29 GMT+02:00 Andreas Plesch <andreasplesch at gmail.com>:
> Is there anything in the x3d standard which somehow makes assumptions about
> textures, eg. would conflict with floating point textures ? I do not really
> think so.

Neither do I. X3D specification is not concerned with how the colors
are encoded in the texture (besides how many RGBA channels has the
texture), there's nothing that affects floating-point textures I
think:)

>
> If you put an x3dom version on github, it makes it easy to collaborate.
>

Done -- inside https://github.com/castle-engine/demo-models/tree/master/common_surface_shader/x3dom
.

Note that I moved the examples, from
bump_mapping/common_surface_shader/ to just common_surface_shader/ .
The links everywhere should be updated now.

Various options seem unsupported by the X3DOM, I placed some comments
in the X3D code inside.

As for the displacement:

- I see that I misjudged the meaning of displacementFactor in X3DOM.
By default it really makes a large 255 displacement. (In my
implementation, I initially assumed it should be divided by / 255.0.)

- As you wrote, the X3DOM indeed actually displaces the vertexes,
along the normals, and the "displacementAxis" seems ignored for this.

- I decided that trying to "reuse" the "displacementFactor" field for
my parallax effect could be more confusing than helpful for users.
What I'm doing ("parallax bump mapping effect") is visually different
than what X3DOM is doing ("actually displace vertexes"). Trying to
control it with the same parameter like "displacementFactor" was not
so helpful as I initially imagined, because for the parallax bump
mapping, the sensible values are around 0.01 - 0.1 (larger things
quickly look weird).

  Especially since for now Castle Game Engine expects to find the
height map in the alpha channel of normal map, so we ignore the
"displacementMap"...

  So, I changed my implementation, to not look at the displacementFactor at all.

  I will use "displacementMap" and "displacementFactor" only when I
will *actually* use them for displacement of vertexes, compatible with
X3DOM. For the current effect, I added my own field
"normalTextureParallaxHeight" (default 0). When
normalMapParallaxHeight <> 0, then CGE will look for a height map
inside normalTexture alpha channel, and use it for parallax.

  Blender exporter was updated to write both "displacementFactor"
(helpful for X3DOM users) and "normalTextureParallaxHeight" (helpful
for CGE users).

Best regards,
Michalis



More information about the x3d-public mailing list