Visualizing the results on Blender

Back to Index

Building the files

Now, we will redo the cover video, as the maual says.

Got to the Deep Fluid net directory and type the below to create the simulation files (the particles), if you haven't already:

  • cd scenes
  • python3 ../scripts/run_network.py --weights ../scripts/pretrained_model_weights.pt --scene canyon_scene.json  --output canyon_out --num_steps 1500 ../scripts/train_network_torch.py
And create the fluid surface (just like the Bake Mesh button in Blender), that will take long time:
  • python3 ../scripts/create_surface_meshes.py --input_glob "canyon_out/fluid*.npz" --outdir canyon_out

If the Boost lib can't be found, execute the "export" command used when installing OpenVDB.


Note: If you get the error "free(): invalid pointer", it means you imported Scipy before OpenVDB. Set it as:

  • import pyopenvdb as vdb; from scipy.spatial import cKDTree


Meanwhile, if you don't have Blender, install it through the official site, not the Microsoft Store, just to simplify some paths we will need. My current version is 2.92.

Then, open the Canyon blender file in "scenes" and type this in the interactive Python terminal:

  • import sys; sys.exec_prefix

Copy that path, and go to it in Windows Terminal or PowerShell and install and update pip:

  • cd 'F:\Blender Foundation\Blender 2.92\2.92\python\bin'
  • .\python.exe -m ensurepip
  • .\python.exe -m pip install --upgrade pip
Install the PLY package in Windows Terminal to run the script in Blender:
  • .\python.exe -m pip install plyfile

Rendering

After that, run the script already loaded in Blender file for the canyon scene (blender_external_mesh). Nothing will happen, but that's ok. In this version, you don't have the "Register" button as the manual says, but you can move forward and go to the Layout workspace, as shown in the image below.


First, you click on the button almost in the center of the image to play the simulation. The particles must appear and move from frame 30. So, select a frame in the box highlighted on the right, marking the start frame. Then, you can Render Image, on the menu on the top left corner. 

If you want to see the water rendering, disable the photographic camera icon of "FluidParticles" and enable the one on "FluidSurface", then Render Image again.

If you think the water in the original rendering is quite transparent, you can change its color. Go to Shading workspace and select the base color as shown in the figure below.


Also, you can create an AVI video instead of a collection of PNG images. Go to "Output" (the printer icon on the right) and set the file format.

<- Back

Next ->


No comments:

Post a Comment

Global Game Jam 2024

Wow, what a weekend. The Global Game Jam is intense. But I and 3 other members manage to build a game for the theme "Make me laugh&quo...