Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

ray_ux

Visualising 3D object within Power BI

In this blog, I will go through the experimentation I took to integrate 3D object in Power BI. I believe there are a lot of potential use cases e.g., embedding into VR/AR, hologram dashboard.

  • Draw 3D polygon in Blender.
  • Integrate 3D polygon in Power BI

 

1_20Y4XGmzyfucG8GAM6FZhg.gif

 

A simple 3d object that I’ve created in Blender. Now we need to extract this object into a CSV/excel file to get the xyz (vertices) coordination.

To understand what is exactly going on, we can run a python and see what kind of data the object contains. This will be displayed on the console.

 

Code snippet:

 

 

 

 

// see how console is work
import bpy
obj = bpy.context.object
mesh = obj.data
print("coor: ")
for vert in mesh.vertices:
xyz = vert.co.xyz
print(f"{xyz[0]}, {xyz[1]}, {xyz[2]}")
print("")
print("indices: ")
for face in mesh.polygons:
print(f"{face.vertices[0]}, {face.vertices[1]}, {face.vertices[2]}")
print("")

 

 

 

 

 

1_uD_Obwx2kzEsOAw9_Up7vw.png

For the final step, we can run a script to extract the data into a file.

 

Code snippet:

 

 

 

 

import bpy
import csv

csv_obj = bpy.data.objects['football']

out_list = []
for i, vert in enumerate(csv_obj.data.vertices):
    out_list.append(vert.co)

print(out_list)

file = open('/home/raywu/Documents/football.csv', 'w+', newline='')
with file:
    write = csv.writer(file)
    write.writerows(out_list)

 

 

 

 

 

Make sure the file location is correct as it’s different in Mac/Window.

 

Now we need to import the 3D object CSV/excel format into Power BI, in order to visualise more in-depth detail .

 

Currently, this method can only visualise 3d objects using plotly.js custom visual and selecting a 3d mesh chart type. I have tested using python and other language libraries, but they were not supported.

 

Outcome:

1_qSVSprJLWT7SietbLJtRqA.gif

 

Once the data is imported, we can drag the x,y,z to display the object. And now we can add colours, texture, fill, etc. to make it looks nicer and potentially represent certain data metrics such as speed/velocity/pressure.

 

Final note

I enjoyed experimenting with Blender, and Power BI and I found so much potential in this 3d implementation within a BI tool. Maybe one day we can use a dedicated blender API for Power Platform. As there is so much potential and value in the sports analytics.

Pros:

  • Wearable devices e.g. analysing performance in players and visualising heart rate, etc.
  • Displaying 3d visualisations on a map/football pitch.
  • Blender is also much more efficient, reliable, maintainable than AWS digital twin .

Cons:

  • Limited data points.
  • Require plotly.js custom visual to render 3d polygon.

At the moment, I am developing this proof of concept for sports training and visualizing metrics using wearable devices. Players can also keep track of this data and it’s stored within the power app. 

Example: 
1_DidCwlhJ3R1q9oL5HwDkWw.png

 

This 3d polygon can visualise certain metrics and it's game-changing for all BI tools. 

Software used: Blender, Power BI
Power BI Custom visual: Plotly.js

Comments