Jump to content

Import Saved Volumetric Smoke Animation


Recommended Posts

I have a dataset that contains animated volumetric smoke density. The dataset is stored as NPZ files (numpy array save file). How can I load the density of a saved smoke simulation as an animated volume to render it ?

For context about the float data in the volumes. This is what simulation number 70 snapshot 150 looks like in matplotlib with a viridis color map, but the data in each voxel are simple float64 values. The other snapshops and simulations look similar.

      animation.gif

This is how you load a single npz file, if you want to try it with the dataset. It just generates a generic numpy float array. So you could just make a tiny numpy array filled with random data yourself for the purpose of testing like this np.random.rand(3,3,3). 

import numpy as np
def npz_to_nparray(filepath):
    """
    loads npz file from location
    :param filepath: string to file location
    :return: numpy array 
    """
    data = np.load(filepath)
    data = data[data.files[0]]  # normal strange operations to get the the actual array inside
    data = np.transpose(data, (3, 1, 0, 2))  # turning the inner array layer outside and rightside up
    return data[0]

 

I have tried:

-I can load the npz files in python and in Houdini's python shell as a numpy array. I dont know how to put the data into a Houdini volume or which file format Houdini needs to import it.

-I tried to translate the npz files to vdb with the pyopenvdb libary for python. But after multiple days of trying I am unable to import pyopenvdb. I build pyopenvdb library on windows with vcpkg and cmake, but I cannot import the build package. I setup an ubuntu VM and tried importing pyopenvdb there, but I can not import it.

tl;dr: How to import animated smoke voxel data that is currently stored as a 4D python array?

Edited by gehtsiegarnixan
grammar and spelling
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...