[x3d-public] Blender X3D exporter: what to do, how to do it

Michalis Kamburelis michalis.kambi at gmail.com
Fri Jul 2 03:41:33 PDT 2021


(sorry for delay in answering -- I was on short vacation)

John -- to get the image (texture for the "base" material property) in
new Blender, you need to get the texture from the PBR nodes.

You can see e.g. how glTF exporter gets the texture (source code
https://github.com/KhronosGroup/glTF-Blender-IO , user docs
https://docs.blender.org/manual/en/dev/addons/import_export/scene_gltf2.html
). Basically you have to access the "node tree" of Blender material
like "material.node_tree.nodes["Principled BSDF"].inputs[0]" and find
the node with type "ShaderNodeTexImage" that is connected to it. This
will have an "image" field that contains the Blender image.

You can/should read Blender API docs in
https://docs.blender.org/api/current/  to know the necessary API. The
names are also visible as Blender hints (on mouse over) and can be
even copied using context menu. Be sure to enable "Developer Extras"
and "Python Tooltips" in Blender preferences, see screenshots.

Regards,
Michalis

czw., 24 cze 2021 o 23:15 John Carlson <yottzumm at gmail.com> napisał(a):
>
> More info, feel free to append to Blender ticket as you see fit. I clicked on "Image" between the 2 main panels, and set the image to "tuna.png"  it looked like the image was applied (yay), but tuna.png did not appear in the .x3d, and the output was still "Image None" at line 654. And output x3d did not show the texture in FreeWRL or view3dscene.
>
> An investigation of the Blender file:
>
> $ strings x3d_texture_2.83.blend|grep png
> Untitled.png
> //tuna.png
> Desktop/Untitled.png
>
> So there's still some places to cover.  I do not yet know how to make image non-None. I did some settings in base color to tuna (not tuna.png).  It will take some time to figure out all the windows/panels.  There are a lot of choices in Blender.   It would probably be worth it to take some classes!
>
> Note: This is the only place in the export code that <Appearance> appears, so this pretty much has to be the code, and we just need to figure out how to set image variable properly in the preceding code.
>
> If a python programmer could translate this line (614? of /usr/share/blender/scripts/addons/io_scene_x3d/export_x3d.py ) to English, it would help!
>
> for (material_index, image), polygons_group in polygons_groups.items():
>
> I think this is where the image variable comes from.
>
> John
>
> On 6/24/21 3:08 PM, John Carlson wrote:
>
> I added these lines to the Blender X3D exporter, at line 654
>
>                    print("Image", image)
>                     print("Use H3D", use_h3d)
>
>
> Here is the output:
>
> Image None
> Use H3D False
>
> So...the image is not set?  Let's do some snooping:
>
> coderextreme at coderextreme-Kubuntu20:~/Downloads$ strings x3d_texture_2.82.blend |grep png
> Untitled.png
> //Untitled.png
> Desktop/Untitled.png
> coderextreme at coderextreme-Kubuntu20:~/Downloads$ strings x3d_texture_2.79.blend |grep png
> Untitled.png
> //Untitled.png
> Desktop/Untitled.png
>
> I don't have these pngs.
>
> I will look and see how to set the png for the texture, meanwhile, I don't think that the png exists, therefore, image is None, and the ImageTexture and TextureTransform don't print!
>
> I'll get back to you!
>
> John
>
> On 6/24/21 1:34 PM, John Carlson wrote:
>
> Note:
>
> https://developer.blender.org/T66534
>
> Has some sample files to start with.
>
> On 6/22/21 7:48 AM, Michalis Kamburelis wrote:
>
> I wrote a document outlining my Blender->X3D exporter wishlist, and
> how to submit patches to Blender:
>
> https://docs.google.com/document/d/1ad5XsU43gQGxqC7ehSBr21mdX2dQjKZCSXUQtvRwTHw/edit?usp=sharing
>
> Please feel free to distribute it to whoever is interested. Comments welcome :)
>
> Regards,
> Michalis
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Zrzut ekranu z 2021-07-02 12-37-06.png
Type: image/png
Size: 94335 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210702/5edf5d7d/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: b.png
Type: image/png
Size: 113768 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210702/5edf5d7d/attachment-0003.png>


More information about the x3d-public mailing list