Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aiekick/vdbwriter
A one header file OpenVDB dependencies free Writer with multi layers and frames support
https://github.com/aiekick/vdbwriter
animation dependencies-free fast frame header-only light multilayer one openvdb writer
Last synced: 21 days ago
JSON representation
A one header file OpenVDB dependencies free Writer with multi layers and frames support
- Host: GitHub
- URL: https://github.com/aiekick/vdbwriter
- Owner: aiekick
- License: mit
- Created: 2024-02-25T06:58:08.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-03-04T22:59:19.000Z (9 months ago)
- Last Synced: 2024-03-04T23:43:46.551Z (9 months ago)
- Topics: animation, dependencies-free, fast, frame, header-only, light, multilayer, one, openvdb, writer
- Language: C++
- Homepage:
- Size: 1.75 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Windows](https://github.com/aiekick/VdbWriter/actions/workflows/Win.yml/badge.svg)](https://github.com/aiekick/VdbWriter/actions/workflows/Win.yml)
[![Linux](https://github.com/aiekick/VdbWriter/actions/workflows/Linux.yml/badge.svg)](https://github.com/aiekick/VdbWriter/actions/workflows/Linux.yml)
[![Macos](https://github.com/aiekick/VdbWriter/actions/workflows/Osx.yml/badge.svg)](https://github.com/aiekick/VdbWriter/actions/workflows/Osx.yml)# VdbWriter
VdbWriter is a specific and limited writer for openvdb.
He is based on https://github.com/jangafx/simple-vdb-writer
## Features :
* cross platform : Win / Linux / Macos
* cpp11 minimal support
* one header file only
* dependency free (no openvdb dependencies)
* can write multi layers format :
* float
* double
* vec3s
* vec3d
* vec3i
* vec3ui
* other format can be used by his template, but not sure if softwares can open it
* can set the current frame for animation recording +> will save in many files
## Appthe main.cpp file show you how to generate a quick file :
```cpp
#include "VdbWriter.h"
int main() {
const int32_t SIZE = 150;
const double D_SIZE = (double)SIZE;
const int32_t OFFSET = SIZE;
const float Z_SCALE = 0.5f;
const int32_t FRAMES = 10;
const float len_ratio = 1.0f / (SIZE * SIZE);
vdb::VdbWriter vdb;
float r, g, b;
float time = 0.0f;
for (int32_t f = 0; f < FRAMES; ++f) {
vdb.setKeyFrame(f);
auto* floatLayerPtr = vdb.getFloatLayer(0, "density");
auto* vec3sLayerPtr = vdb.getVec3sLayer(1, "color");
for (int32_t i = -SIZE; i < SIZE; ++i) {
for (int32_t j = -SIZE; j < SIZE; ++j) {
float len = (i * i + j * j) * len_ratio;
int32_t pz = (int32_t)((std::sin(len * 10.0 + time) * 0.5 + 0.5) * (std::abs(50.0f - 25.0f * len)) * Z_SCALE);
int32_t cube_color = (int32_t)(len * 100.0) % 255 + 1;
auto px = i + SIZE;
auto py = j + SIZE;
floatLayerPtr->addVoxel(px, py, pz, 1.0f);
r = sin(len * 10.0f) * 0.5f + 0.5f;
g = sin(len * 7.0f) * 0.5f + 0.5f;
b = sin(len * 5.0f) * 0.5f + 0.5f;
vec3sLayerPtr->addVoxel(px, py, pz, r, g, b);
}
}
time += 0.5f;
}
vdb.saveToFile("wave.vdb");
}
```### Output in blender3D :
![alt](https://github.com/aiekick/VdbWriter/blob/master/doc/wave_blender.jpg)
### Another Output in blender3D with my julia revolute
![alt](https://github.com/aiekick/VdbWriter/blob/master/doc/julia_revolute_blender.jpg)