[x3d-public] [x3d] Blender support for ImageTexture export

Michalis Kamburelis michalis.kambi at gmail.com
Mon Jan 31 03:37:37 PST 2022


Vince,

This is excellent news, I'm very happy to see activity in
https://github.com/Web3DConsortium/BlenderX3DSupport .

Lack of full-featured Blender->X3D export is one of the things I
consider very important. It's a "practical" thing (i.e. not something
about "this or that 3D format specification being better", just about
having resources to develop tooling around a 3D format). Happy to see
this is going forward.

I'll test it later, for now I read your notes and agree with all you
write, in particular

1. Use the image basename, without directories, as ImageTexture.url in X3D.

    Note: Blender also allows to put relative filenames, they start
with "//" in Blender filenames. Maybe we could use this as alternative
too.

    I'd say to also consider to allow user to specify explicitly a
subdirectory for textures, like glTF exporter does. This makes the
path, like "textures/", explicitly configurable at export dialog
(people who export clearly see/edit such subdirectory) and allows to
organize 3D models + textures freely.

2. Do not copy the texture files themselves to the output directory.
I.e. I agree with your sentence """This export implementation does not
write the image file to the local file system as part of the
export.""". Trying to copy texture files could be more trouble than it
is worth -- it would not work for everyone anyway, people may prefer
their custom workflows.

    E.g. in my use-cases, we often use textures that are shared across
a number of 3D models (e.g. across a number of game levels / assets),
so we prefer to actually arrange the texture files by ourselves in
data directories. So we don't really need/want the Blender exporter to
copy texture files, we want to control this aspect manually.

Regards,
Michalis



niedz., 30 sty 2022 o 03:40 vmarchetti at kshell.com
<vmarchetti at kshell.com> napisał(a):

>
> Summary: This is an announcement of python scripts which restore the export of ImageTexture nodes in the X3D export of Blender models. This export capabilty was reported missing from the Blender 2.80 and later versions of Blender. The python scripts developed here have undergone preliminary testing for Blender 3.0.0; the latest public release. For those who have been missing this capability from Blender, you are invited to read the detailed description below, install the new python scripts in your Blender installation (at v 3.0 and beyond ); and report bugs to the Web3D Consortium Blender project; more generally whether these scripts meet the needs of your workflows in using image textures with X3D models edited in Blender.
>
> -----------------------------------------
>
> Detailed Description
>
> These X3D import/export scripts may be tested by replacing the Python code for the Blender 3.0 installation with the python scripts from Consortium github project. You will first need to location these scripts in your Blender 3.0 installation. Typical locations are:
>
> Windows: C:\Program Files\Blender Foundation\Blender 3.0\3.0\scripts\addons\io_scene_x3d
> MacOS  : /Applications/Blender.app/Contents/Resources/3.0/scripts/addons/io_scene_x3d
> Linux: (consult https://docs.blender.org/manual/en/latest/advanced/blender_directory_layout.html )
>
> This folder should contain 3 Python source code files:
> __init__.py
> import_x3d.py
> export_x3d.py
> This folder may also contain a __pycache__ folder, which should be deleted if you do replace these scripts.
>
> These files need to be replaced with the corresponding files from the image_texture_export branch of the Web3DConsortium/BlenderX3DSupport github project ( https://github.com/Web3DConsortium/BlenderX3DSupport ). The web-page for viewing this branch and directory is https://github.com/Web3DConsortium/BlenderX3DSupport/tree/image_texture_export/io_scene_x3d from which this source may be copied into the Blender installation.
>
> This implementation exports an X3D TextureImage node when an image is defined in the "Base Color" node of a "Principled BSDF" node [see https://docs.blender.org/manual/en/latest/render/shader_nodes/shader/principled.html ] defined in a Blender material. The name of the image referenced in the Base Color node is assumed to represent the name of the image file (including extension) -- specifically the base name of the file, not including names of enclosing directories. When the ImageTexture node is written to the exported X3D file this name of the image will be one of the entries in the url field of the ImageTexture node. The url field will also contain additional entries based on the filesystem path of the image file in the local computer; these urls will not be portable and may represent a security or privacy danger. Using the basename of the image file as the url supports the deployment of the image texture files in the same directory as the X3D file which uses them.
>
> The specification of the image texture in the node-based Blender material is supported by the X3D import script distributed with Blender 3.0 ; the user should be able to do the 'round trip' workflow
>   X3D File A   ---> Blender import-->  [Blender application, editing] ---> Blender export --> X3D File B
> without being concerned with the details of node-based materials.
>
> This export implementation does not write the image file to the local file system as part of the export.
>
> This export implementation does not support exporting a TextureTransform node in the Appearance node.
>
> Potential Tests:
> If you are interested in participating in evaluating this code, the simplest test case will be an X3D file that uses an image texture, both located in the same directory on your local computer. After replacing the 'factory-installed' scripts as described above, import the X3D file; then export the Blender model into the same folder as the original file (which should also contain the image file). The proof in the pudding will be your ability to load the exported X3D file in an X3D browser and see the rendered texture.
>
> A test may be run using the "Hello World" example from the X3D Archives at web3d.org : https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter01TechnicalOverview/HelloWorldIndex.html
>
> An additional test case, with a larger image texture and more complex geometry, can be downloaded from https://spri-open-resources.s3.us-east-2.amazonaws.com/Morse_Vale_Telegraph_Key_X3D.zip
>
>
> Useful additional testing would include:
> -- Examples of X3D files which load multiple image files as textures.
> -- Examples of X3D files which use the TextureTransform node.
> -- Examples of files which repeat a texture in either the S or T axis, or both
>
> Please report results of testing, bugs identified, and concrete proposals for changes in behavior to the issues section of the Web3DConsortium github project : https://github.com/Web3DConsortium/BlenderX3DSupport/issues/2
>
> Vince Marchetti
>
>
> _______________________________________________
> x3d mailing list
> x3d at web3d.org
> http://web3d.org/mailman/listinfo/x3d_web3d.org



More information about the x3d-public mailing list