Primitive ID, not unique if the same mesh is used more than once - blender

I working on a thermal tool using OptiX.
I started with the "meshviewer" example which uses syoyo's tinygltf loader.
Basically I want to import a file, get the number of primitives and then add up the intersections.
Now I imported a file containing two cubes, which should consist of 12 triangles each, so 24 in total. When I start my program the loader only recognizes 12 triangles, but it renders 2 seperate cubes. The primitive IDs seem to be identical for both cubes.
Is there a workaround when I export from blender? If I understood the documentation directly the separate cubes are treated as two "identical" instances of the same mesh and thus share the primitive IDs.
I am using the v2.81 of Blender with the gltf exporter.
Do I understand the problem correctly? And is there an easy workaround? If not it seems I will have to modify the tinygltf loader.
Thank you for help in advance!

It's possible the two cubes share the same mesh. In the screenshot below, there are two Blender "objects", Left-Cube and Right-Cube. Both objects use the same Blender mesh, called Shared-Cube-Mesh.
The glTF exporter recognizes this pattern and mirrors it in the glTF file. There will be two glTF nodes, corresponding to the two Blender objects that use the mesh. But there will only be a single glTF mesh, with a single cube.
You can click the "number of users" button, shown below with a white arrow pointing to it, to make the second object use its own unique mesh. But be warned, this doubles the amount of mesh data being exported to glTF in this simple example. A complete copy of the mesh would be made in both Blender and the glTF binary payload.

Related

GMSH extrusion with dilation

I want to create a structured mesh with boundary layers over an rather complex geometry in GMSH. For this reason I need to seperate my geometry to smaller portions, one of them is pictured:
Since structured meshes can only be created by extrusion, i would like to know wether it is possible to extrude a rectangle with a dilation, or if there is any other workaround known to generate a similar shape with a structured mesh.
In gmsh structured meshs can also be generated with the 'transfinite' commands.
See examples/simple_geo/hex.geo in the gmsh installation directory for an example.

Blender to Unreal Engine 4: How do i export my building from blender to unreal engine with the right collison?

I have made a house (without roof yet) with some rooms in blender 2.9 and exported it to unreal engine 4. But in Unreal engine i can't move in it with the 3d standard third person character. I can only walk on it as it would be a closed cube or something.
What do i have to do, to be able to walk in it around?
UE is automatically generating a convex (i.e. with no holes, caves, dents, openings, etc.) collision mesh that essentially wraps the whole model. Possibly just a cube. There are a couple of things you can do.
Open the mesh in UE and set the collision complexity to 'use complex as simple'. This isn't advisable unless the mesh is very simple as it uses every polygon in the mesh to query collisions against.
or
Create a set of collision meshes - one for each element of the house (walls, floor, etc.) - and bring them in with the model. These must be convex in shape. See here: Static Mesh FBX Import. You must follow the correct naming convention for the FBX import to recognise them as collision meshes.
If your house model has low enough a polygon count that you would end up with as many polygons in your collection of collision meshes, number 1 saves you the trouble of number 2 (and might even save some memory).
Don't forget everything needs to be triangulated.

Triangulated Surface Mesh Skeletonization Package - How to keep the skeleton inside the surface mesh?

I tried executing the example in http://doc.cgal.org/latest/Surface_mesh_skeletonization/index.html to get the skeleton of a surface mesh.
I tried using a mesh model of blood vessels with thin structures. However, no matter how refined my meshes are, parts of the skeletons seems to always be outside the mesh models.
In the sample code, there seems to be no parameters which I am able to play around with, so I am asking if there is anything i can do to make sure the skeleton stays within the mesh model.
I have tried to refined the meshes, till the program crashes. Thanks for any help provided. thanks!
I guess you have used the free function setting all parameters to their default. In case you want to tune the parameters you need to use the class Mean_curvature_flow_skeletonization.
It has 3 parameters that need to be fine tuned so that your skeleton lies within the mesh:
quality_speed_tradeoff
medially_centered_speed_tradeoff
is_medially_centered
Note that the polyhedron demo includes a plugin where you can try the effect of the different parameters.
If you can share the mesh with me, I can also have a look.

Displaying large VRML file

I've VRML file that is 4.2GB big (!) and consists of 10 different shapes.
This is cloud of points (no edges or triangles).
How can I display such a big object? Everything I've tried just freezes.
Is there any tool I can use for point optimization in stream-like fashion?
Without loading the whole file?
We have developed our own tool for polygon reduction and some other optimizations. But if you say you have cloud of points and no triangles and edges, it is a difficult case.
I would try to make a separate VRML file from each shape of yours, and combine them with Inline in a big container VRML file. You may not see the whole scene, but you can possibly see the separate shapes. You can find tutorials for Inline if you google it. Hope this helps.

How to create a .mesh file with OGRE?

I'm relatively new to OGRE graphics engine, so my question may seem too obvious, but searching for relevant information was not successful.
Given:
I have an OGRE application with a scene created of some meshes, lights, cameras and textures. It is rather simple, I think. That all is represented by a tree of scene nodes(internal object).
The goal:
To save the full tree of scene nodes or, preferably, an indicated branch of nodes of the tree to a ".mesh" file. To be able load it later as any other mesh. The ".mesh.xml" format is also fine. How it could be done?
If not:
If the desired thing is not possible, what is normal way to create those ".mesh" files? And where I could find some guides for it?
I think you're a bit confused: OGRE mesh file is a file that stores only geometric data of a given 3D model like positions, normals, texture coordinates, tangents, binormals, bone index, bone weights and so on. It also can store a subdivision of a single mesh in submeshes (generally based on the material), and each of them can have a reference to the proper material. In essence a mesh file only contains data on the models you would like to load on your game, nothing about the scene structure.
If you want to save (serialize) your scene, you have two choice:
Write your own scene serializer.
Using some library already provided by the OGRE community: for example DotScene format.
There are Ogre .mesh exporters for programs like Blender. A quick google for Ogre .mesh exporters should help you.