Skip to content

Single Default Cube Exported Wrongly under Blender 4.3 #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Richardn2002 opened this issue Mar 13, 2025 · 4 comments
Open

Single Default Cube Exported Wrongly under Blender 4.3 #255

Richardn2002 opened this issue Mar 13, 2025 · 4 comments

Comments

@Richardn2002
Copy link
Contributor

System Information

  • Ogre Version: 14.3.4
  • Operating System / Platform: Arch Linux x86_64, 6.13.5-arch1-1
  • Blender Version: 4.3.2

Detailed description

Image

Above is what ogre-meshviewer shows for the mesh exported from the default Blender project: just a cube. I assume this is not expected?

This looks like some mesh winding order problem to me, and I tried investigating a bit myself:

  • Blender 3 to 4 does have some Python API changes related to meshes (pre 3.5 to 3.5, 3.5 to 3.6, 3.6 to 4.0), but they do not seem related to me. But I am no professional on this.
  • There are 8 vertices in a cube, but in the resulting file there are 24 vertices in total, with each vertex replicating for 3 times. Is this intended?

To replicate, just open Blender, close the startup dialogue, and proceed to export. But anyways here are the mesh and the material:

Mesh:

<?xml version="1.0" encoding="UTF-8"?>
<mesh>
    <sharedgeometry vertexcount="24">
        <vertexbuffer colours_diffuse="False" normals="true" positions="true" tangent_dimensions="0" tangents="False" texture_coords="1">
            <vertex>
                <position x="1.000000" y="1.000000" z="-1.000000"/>
                <normal x="0.000000" y="1.000000" z="-0.000000"/>
                <texcoord u="0.625000" v="0.500000"/>
            </vertex>
            <vertex>
                <position x="-1.000000" y="1.000000" z="1.000000"/>
                <normal x="0.000000" y="1.000000" z="-0.000000"/>
                <texcoord u="0.875000" v="0.250000"/>
            </vertex>
            <vertex>
                <position x="1.000000" y="1.000000" z="1.000000"/>
                <normal x="0.000000" y="1.000000" z="-0.000000"/>
                <texcoord u="0.625000" v="0.250000"/>
            </vertex>
            <vertex>
                <position x="1.000000" y="-1.000000" z="1.000000"/>
                <normal x="0.000000" y="0.000000" z="1.000000"/>
                <texcoord u="0.375000" v="0.250000"/>
            </vertex>
            <vertex>
                <position x="-1.000000" y="1.000000" z="1.000000"/>
                <normal x="0.000000" y="0.000000" z="1.000000"/>
                <texcoord u="0.625000" v="0.000000"/>
            </vertex>
            <vertex>
                <position x="-1.000000" y="-1.000000" z="1.000000"/>
                <normal x="0.000000" y="0.000000" z="1.000000"/>
                <texcoord u="0.375000" v="0.000000"/>
            </vertex>
            <vertex>
                <position x="-1.000000" y="-1.000000" z="1.000000"/>
                <normal x="-1.000000" y="0.000000" z="-0.000000"/>
                <texcoord u="0.375000" v="1.000000"/>
            </vertex>
            <vertex>
                <position x="-1.000000" y="1.000000" z="-1.000000"/>
                <normal x="-1.000000" y="0.000000" z="-0.000000"/>
                <texcoord u="0.625000" v="0.750000"/>
            </vertex>
            <vertex>
                <position x="-1.000000" y="-1.000000" z="-1.000000"/>
                <normal x="-1.000000" y="0.000000" z="-0.000000"/>
                <texcoord u="0.375000" v="0.750000"/>
            </vertex>
            <vertex>
                <position x="-1.000000" y="-1.000000" z="-1.000000"/>
                <normal x="0.000000" y="-1.000000" z="-0.000000"/>
                <texcoord u="0.125000" v="0.500000"/>
            </vertex>
            <vertex>
                <position x="1.000000" y="-1.000000" z="1.000000"/>
                <normal x="0.000000" y="-1.000000" z="-0.000000"/>
                <texcoord u="0.375000" v="0.250000"/>
            </vertex>
            <vertex>
                <position x="-1.000000" y="-1.000000" z="1.000000"/>
                <normal x="0.000000" y="-1.000000" z="-0.000000"/>
                <texcoord u="0.125000" v="0.250000"/>
            </vertex>
            <vertex>
                <position x="1.000000" y="-1.000000" z="-1.000000"/>
                <normal x="1.000000" y="0.000000" z="-0.000000"/>
                <texcoord u="0.375000" v="0.500000"/>
            </vertex>
            <vertex>
                <position x="1.000000" y="1.000000" z="1.000000"/>
                <normal x="1.000000" y="0.000000" z="-0.000000"/>
                <texcoord u="0.625000" v="0.250000"/>
            </vertex>
            <vertex>
                <position x="1.000000" y="-1.000000" z="1.000000"/>
                <normal x="1.000000" y="0.000000" z="-0.000000"/>
                <texcoord u="0.375000" v="0.250000"/>
            </vertex>
            <vertex>
                <position x="-1.000000" y="-1.000000" z="-1.000000"/>
                <normal x="0.000000" y="0.000000" z="-1.000000"/>
                <texcoord u="0.375000" v="0.750000"/>
            </vertex>
            <vertex>
                <position x="1.000000" y="1.000000" z="-1.000000"/>
                <normal x="0.000000" y="0.000000" z="-1.000000"/>
                <texcoord u="0.625000" v="0.500000"/>
            </vertex>
            <vertex>
                <position x="1.000000" y="-1.000000" z="-1.000000"/>
                <normal x="0.000000" y="0.000000" z="-1.000000"/>
                <texcoord u="0.375000" v="0.500000"/>
            </vertex>
            <vertex>
                <position x="-1.000000" y="1.000000" z="-1.000000"/>
                <normal x="0.000000" y="1.000000" z="-0.000000"/>
                <texcoord u="0.875000" v="0.500000"/>
            </vertex>
            <vertex>
                <position x="1.000000" y="1.000000" z="1.000000"/>
                <normal x="0.000000" y="0.000000" z="1.000000"/>
                <texcoord u="0.625000" v="0.250000"/>
            </vertex>
            <vertex>
                <position x="-1.000000" y="1.000000" z="1.000000"/>
                <normal x="-1.000000" y="0.000000" z="-0.000000"/>
                <texcoord u="0.625000" v="1.000000"/>
            </vertex>
            <vertex>
                <position x="1.000000" y="-1.000000" z="-1.000000"/>
                <normal x="0.000000" y="-1.000000" z="-0.000000"/>
                <texcoord u="0.375000" v="0.500000"/>
            </vertex>
            <vertex>
                <position x="1.000000" y="1.000000" z="-1.000000"/>
                <normal x="1.000000" y="0.000000" z="-0.000000"/>
                <texcoord u="0.625000" v="0.500000"/>
            </vertex>
            <vertex>
                <position x="-1.000000" y="1.000000" z="-1.000000"/>
                <normal x="0.000000" y="0.000000" z="-1.000000"/>
                <texcoord u="0.625000" v="0.750000"/>
            </vertex>
        </vertexbuffer>
    </sharedgeometry>
    <submeshes>
        <submesh material="Material" operationtype="triangle_list" use32bitindexes="False" usesharedvertices="true">
            <faces count="12">
                <face v1="0" v2="1" v3="2"/>
                <face v1="3" v2="4" v3="5"/>
                <face v1="6" v2="7" v3="8"/>
                <face v1="9" v2="10" v3="11"/>
                <face v1="12" v2="13" v3="14"/>
                <face v1="15" v2="16" v3="17"/>
                <face v1="0" v2="18" v3="1"/>
                <face v1="3" v2="19" v3="4"/>
                <face v1="6" v2="20" v3="7"/>
                <face v1="9" v2="21" v3="10"/>
                <face v1="12" v2="22" v3="13"/>
                <face v1="15" v2="23" v3="16"/>
            </faces>
        </submesh>
    </submeshes>
    <submeshnames>
        <submesh index="0" name="Material"/>
    </submeshnames>
</mesh>

Material:

// generated by blender2ogre 0.9.0 on 2025-03-13 12:46:42
material Material {
    receive_shadows off
    technique {
        pass {
            scene_blend alpha_blend
            cull_hardware none
            depth_write off
            diffuse 0.8 0.8 0.8 1.0
            specular 0.5 0.0 0 0 0

            // additional maps - requires RTSS
            rtshader_system {
                lighting_stage metal_roughness
            }
        }
    }
}

blender2ogre.log

2025-03-13 12:46:42 [ INFO] * Target path: <REDACTED>/cube
2025-03-13 12:46:42 [ INFO] * Target file name: blender2ogre.scene
2025-03-13 12:46:42 [ INFO] * Blender version: 4.3.2 (release; Linux)
2025-03-13 12:46:42 [ INFO] * Processing Scene: blender2ogre, path: <REDACTED>/cube
2025-03-13 12:46:42 [ INFO] * Processing Materials
2025-03-13 12:46:42 [WARNING] Roughness input is not connected
2025-03-13 12:46:42 [ INFO] * Exporting root node: Cube 
2025-03-13 12:46:42 [ INFO] * Generating: Cube.mesh.xml
2025-03-13 12:46:42 [ INFO]   - Vertices: 8
2025-03-13 12:46:42 [ INFO]   - Loop triangles: 12
2025-03-13 12:46:42 [ INFO] * Writing shared geometry
2025-03-13 12:46:42 [ INFO] - Done at 0.02 seconds
2025-03-13 12:46:42 [ INFO] * Writing submeshes
2025-03-13 12:46:42 [ INFO] - Done at 0.02 seconds
2025-03-13 12:46:42 [ INFO] - Created Cube.mesh.xml at 0.02 seconds
2025-03-13 12:46:42 [ INFO] - Created Cube.mesh in total time 0.02 seconds
2025-03-13 12:46:42 [ INFO] * Exporting root node: Light 
2025-03-13 12:46:42 [ INFO] * Exporting root node: Camera 
2025-03-13 12:46:42 [ INFO] - Exported Ogre Scene: <REDACTED>/cube/blender2ogre.scene 
2025-03-13 12:46:42 [ INFO] - Done at 0.03 seconds

OgreXMLConverter.log

12:46:42: XMLMeshSerializer reading mesh data from <REDACTED>/cube/Cube.mesh.xml...
12:46:42: Reading geometry...
12:46:42: Geometry done...
12:46:42: Reading submeshes...
12:46:42: Submeshes done.
12:46:42: Reading mesh names...
12:46:42: Mesh names done.
12:46:42: XMLMeshSerializer import successful.
12:46:42: MeshSerializer writing mesh data to stream <REDACTED>/cube/Cube.mesh...
12:46:42: File header written.
12:46:42: Writing mesh data...
12:46:42: Writing submesh...
12:46:42: Submesh exported.
12:46:42: Exporting bounds information....
12:46:42: Bounds information exported.
12:46:42: Exporting submesh name table...
12:46:42: Submesh name table exported.
12:46:42: Mesh data exported.
12:46:42: MeshSerializer export successful.
@Richardn2002
Copy link
Contributor Author

Richardn2002 commented Mar 14, 2025

Ah, removing cull_hardware none solves the issue. Now investigating how this line gets into the final outputs.

Update: is about io_ogre/ogre/material.py#L194 this line and deprecation of Material.blend_method

@paroj
Copy link
Member

paroj commented Mar 21, 2025

exporting the default cube with blender 4.3 does not write any transparency for me

@paroj
Copy link
Member

paroj commented Mar 21, 2025

There are 8 vertices in a cube, but in the resulting file there are 24 vertices in total, with each vertex replicating for 3 times. Is this intended?

this is correct, see:
https://paroj.github.io/gltut/Illumination/Tut09%20Mesh%20Topology.html

@Richardn2002
Copy link
Contributor Author

The PR I sent fixes the transparency problem for me (by not writing cull_hardware none to the .material file(s)). Probably we are bumping into some kind of "undefined behavior" of Blender by depending on a deprecated variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants