taichi-dev / taichi_blend

Taichi Blender intergration for physics simulation and animation
156 stars 13 forks source link

Create a node system #3

Open PavelBlend opened 3 years ago

PavelBlend commented 3 years ago

I can help create a node system for taichi_blend. @archibate can you tell which nodes are needed? I need a list of nodes and a list of their sockets.

archibate commented 3 years ago

Thank for your help! Here's the possibilities I've thought for taichi field operations:

Socket types

Field

Field storage (ti.field, ti.Vector.field, ti.Matrix.field). Can write or read.

Sampler

Like field, but read-only, can't be write. Field sockets can be treated as sampler too.

Note: Field/sampler sockets with different shapes should not be connected directly.

Value

Non-field values, can be scalar / vector / matrix.

Note: scalars / vectors / matrices with different dimensions should not be connected directly.

Nodes

Categories: Input, Output, Storage, Sampler, Gather, Scatter, Physics.

FieldStorage

Declares a field for storage. Category: Storage Inputs: N/A Options: field shape, sparse layouts, data type (float, int, ...), matrix dimension (n and m) Outputs: the field

SceneInputs

Get the informations of current scene. Category: Input Inputs: N/A Outputs: current frame number, etc.

StoreSamples

Sample a sampler, store it into a r/w field storage of same shape (for buffering purpose). Category: Storage Inputs: the sampler Outputs: the field

ConstantSampler

A sampler that always return the constant. Category: Sampler Inputs: the constant value Options: sampler shape, data type (float, int, ...), matrix dimension (n and m) Output: a sampler

IndexSampler

A sampler that always return the acquired index. Category: Sampler Inputs: the constant value Options: sampler shape Output: a sampler

FieldwiseOp

Category: Sampler Inputs: lhs sampler, rhs sampler Options: operation type (add, sub, mul...) Outputs: result sampler

GaussianBlur

Category: Gather Inputs: a 2D or 3D sampler, the blur radius value Outputs: result field storage

BilerpSampler

Category: Gather A sampler that bilerps / trilerps the input 2D / 3D sampler, to a different shape Inputs: the input sampler Options: output sampler shape Output: a sampler with the new shape

SamplerMapIndices

Category: Sampler A sampler that revamps the index into a specific sampler Inputs: the input sampler, the index sampler Output: the indiced result sampler

FieldUpdate

Category: Storage Update the sampler result to field storage on each substep. Inputs: a sampler, a field storage Outputs: still the field storage (for convinence of appending more nodes to it)

ParticleForwardEuler

Category: Physics Integrate particles using the forward-euler explicit method. Inputs: particle position sampler, particle velocity sampler Outputs: the particle position sampler.

GridProjection

Category: Physics Project grid velocity field to be zero-diversity eulerian fluid. Inputs: gravity sampler Outputs: the particle position sampler.

ParticlesToGrid

Category: Scatter Scatter particles attributes (like pos, vel, mass) to a destination field (p2g in taichi_elements). Inputs: particle attribute sampler, grid field storage Options: stencil type (B-spline, etc.) Outputs: the grid field storage

GridToParticles

Category: Gather Gather particles attributes (like pos, vel, mass) from a destination field (g2p in taichi_elements). Inputs: grid sampler, particle attribute field storage Options: stencil type (B-spline, etc.) Outputs: the grid field storage

VoxelizeParticles

Category: Scatter Inputs: particle position sampler, weight per particle scalar Options: stencil type (gaussian, etc.) Outputs: the voxel field storage

MarchingCube

Category: Mesh Marching voxels into mesh of iso faces. Inputs: voxel sampler, mesh verts field storage, faces field storage Outputs: mesh verts field storage, faces field storage

MeshVisualize

Category: Output Visualize a mesh in Blender viewport Inputs: mesh verts sampler, faces sampler Options: output mesh sequence to which Blender object Outputs: N/A

PointCloudVisualize

Category: Output Visualize a point cloud in Blender viewport Inputs: particle position sampler Options: output mesh sequence to which Blender object Outputs: N/A

archibate commented 3 years ago

Btw, I also want to intergrate my renderer taichi_three, which already have a node-alike system for materials and post-processing, see examples/hdr_blooming.py for example. blooming

PavelBlend commented 3 years ago

@archibate Can you still tell me which categories to create for the nodes? categories What categories should I put the nodes into?

archibate commented 3 years ago

Oh I see! Sorry for my ignorance, just added Category: for each node in the previous comment.

PavelBlend commented 3 years ago

@archibate I made ui nodes. Can you check it for correctness? If you need to change something, then say I will. ebf86c067626dc4b7444ecd53011000cb4c650b4

tomorrow I will write the code that is responsible for collecting information from the node tree.

archibate commented 3 years ago

Thank for the amazing speed! Some questions: image

The Field Shape here shouldn't be a single value, but a tuple instead. For example: (), (42, ), (23, 45), (77, 88, 99). The same to Matrix Dimension. Is this possible for the blender UI? Thank in advance!

melMass commented 2 years ago

Is there a reason why this was removed? I can't find references to it but the video tutorials make use of it. thanks

Calsia commented 2 years ago

Is there a reason why this was removed? I can't find references to it but the video tutorials make use of it. thanks

maybe you should select it. hope it's not too late,

image

melMass commented 2 years ago

maybe you should select it. hope it's not too late,

It's not thanks a lot!!