How do I make a file/mesh in Blender to export it as .fbx and import it in UnrealEngine4, to Subtract UE4's geometry from it? - blender

I have exported a .fbx mesh from Blender to UE4 and I need to subtract a part of it in UE4, but the subtraction with geometry doesn't seem to work. What do I change in the original .blend file to make it compatible with the UE4 geometry subtraction?

AFAIK static geometry can't be used to substraction of bsp:
https://answers.unrealengine.com/questions/62484/view.html
Sean L ♦♦ STAFF Jul 19 '16 at 9:27 PM
Keep in mind that this will only work with BSPs, which are placed in the Geometry section of the Modes tab. If you are using a static mesh, this will not work.
and you can't export/convert static geometry to bsp:
https://www.epicgames.com/unrealtournament/forums/unreal-tournament-development/ut-development-level-design/13535-converting-static-meshes-to-bsp

Related

Exporting OBJ file from Blender, why are normals for each face vertex the same?

For example I created a sphere in blender, and exported the obj file. I was noticing some issues in my shader, because all the vertex normals for a face are the same. And can see it directly in the .obj file itself, such as portion below, see that for the first face, all the verticies are using normal index 1. I would expect they should all be different since it is a sphere, and are curving. Thanks, also this is in Blender 3.1
f 10/10/1 9/9/1 22/22/1 23/23/1
f 6/6/2 5/5/2 15/15/2 16/16/2
f 480/526/3 10/10/3 23/23/3 24/24/3
f 7/7/4 6/6/4 16/16/4 17/17/4
f 481/527/5 480/526/5 24/24/5 25/25/5
I found the issue, and I needed to add shading to the object in blender. Edit Mode->Select all vertices, and select smooth shading.

Output exact depth map in Blender

How can I output the depth information of each frame in blender to a .txt file?
I can generate a depth-map as gray-scale image with values in [0,1] but I want the values in units I use in Blender (meter in my case).
The solution turned out to be very easy. Just link the Z buffer in the Node Editor with the output. Also make sure to turn he Z buffer on.

VTK / ITK Dice Similarity Coefficient on Meshes

I am new to VTK and am trying to compute the Dice Similarity Coefficient (DSC), starting from 2 meshes.
DSC can be computed as 2 Vab / (Va + Vb), where Vab is the overlapping volume among mesh A and mesh B.
To read a mesh (i.e. an organ contour exported in .vtk format using 3D Slicer, https://www.slicer.org) I use the following snippet:
string inputFilename1 = "organ1.vtk";
// Get all data from the file
vtkSmartPointer<vtkGenericDataObjectReader> reader1 = vtkSmartPointer<vtkGenericDataObjectReader>::New();
reader1->SetFileName(inputFilename1.c_str());
reader1->Update();
vtkSmartPointer<vtkPolyData> struct1 = reader1->GetPolyDataOutput();
I can compute the volume of the two meshes using vtkMassProperties (although I observed some differences between the ones computed with VTK and the ones computed with 3D Slicer).
To then intersect 2 meshses, I am trying to use vtkIntersectionPolyDataFilter. The output of this filter, however, is a set of lines that marks the intersection of the input vtkPolyData objects, and NOT a closed surface. I therefore need to somehow generate a mesh from these lines and compute its volume.
Do you know which can be a good, accurate way to generete such a mesh and how to do it?
Alternatively, I tried to use ITK as well. I found a package that is supposed to handle this problem (http://www.insight-journal.org/browse/publication/762, dated 2010) but I am not able to compile it against the latest version of ITK. It says that ITK must be compiled with the (now deprecated) ITK_USE_REVIEW flag ON. Needless to say, I compiled it with the new Module_ITKReview set to ON and also with backward compatibility but had no luck.
Finally, if you have any other alternative (scriptable) software/library to solve this problem, please let me know. I need to perform these computation automatically.
You could try vtkBooleanOperationPolyDataFilter
http://www.vtk.org/doc/nightly/html/classvtkBooleanOperationPolyDataFilter.html
filter->SetOperationToIntersection();
if your data is smooth and well-behaved, this filter works pretty good. However, sharp structures, e.g. the ones originating from binary image marching cubes algorithm can make a problem for it. That said, vtkPolyDataToImageStencil doesn't necessarily perform any better on this regard.
I had once impression that the boolean operation on polygons is not really ideal for "organs" of size 100k polygons and more. Depends.
If you want to compute a Dice Similarity Coefficient, I suggest you first generate volumes (rasterize) from the meshes by use of vtkPolyDataToImageStencil.
Then it's easy to compute the DSC.
Good luck :)

Output vertex stream with Blender

I'm looking to output a stream of the vertices, UVs and normals of an animated object (with clothing/softbody physics) to a file.
Is this possible with Blender? If not, is there another modelling application which can do that?
If it is possible, what such exporting of vertices called?
You can try to write a script with the Python Blender API: https://www.blender.org/api/blender_python_api_2_76_2/ This requires a lot of time to do.
If you want to use a common format, you could export your mesh with the export scripts in blender (to .obj, to .md5 etc...).
How you export will depend mostly on where you want the data to go.
.obj is a simple mesh object file while .mdd can contain an animated mesh - basically exports the mesh for each frame.
If you need to export in a custom format it isn't hard to get the mesh data to export. The obj.to_mesh() provides a copy of the mesh data with all modifiers and simulations applied.
import bpy, bmesh
scn = bpy.context.scene
obj = bpy.context.active_object
me = obj.to_mesh(scn, True, 'RENDER')
print('Vertices--')
for v in me.vertices:
print(v.index,':',end=' ')
for l in v.co:
print(l,end=',')
print()
print('Edges--')
for e in me.edges:
print(e.index,':',end=' ')
for v in e.vertices:
print(v,end=',')
print()
print('Faces--')
for f in me.polygons:
print(f.index,':',end=' ')
for v in f.vertices:
print(v,end=',')
print()
del me
You can get blender specific help with python scripts at blender.stackexchange.

project data defined on a sphere

I have some data defined on a sphere (a sphere not the earth): is it possible with Python 2.6 and matplotlib to draw them on map (of the type of Mercator map) "automatically" or do I have to project the data?
Edit: All of my data are lat-long.
It really depends on what you have and what you want: x-y and/or lat-lon? It looks like your question is similar to a problem I had and more-or-less answered:
matplotlib and apect ratio of geographical-data plots
Consider using set_aspect(), using the reciprocal of the mean latitude of your data.
See matplotlib and apect ratio of geographical-data plots for a working example.