Fluid

July 24, 2023 ยท View on GitHub

from tdw.obi_data.fluids.fluid import Fluid

Data for an Obi fluid. For more information, read this.


Fields

  • smoothing A percentage of the particle radius used to define the radius of the zone around each particle when calculating fluid density. Larger values will create smoother fluids, which are also less performant.

  • surface_tension Increasing this value will make the fluid try to minimize its surface area, causing spherical drops to form.

  • viscosity Viscosity smooths out the velocity field generated by fluid particles when moving.

  • vorticity Amount of vorticity confinement, it will contribute to maintain vortical details in the fluid. This value should always be between approximately 0 and 0.5.

  • reflection Amount of reflection.

  • transparency Amount of fluid transparency.

  • refraction Amount of light refraction. This effect is more noticeable in thicker regions of the fluid.

  • buoyancy Controls the relative density between the fluid and the surrounding air.

  • diffusion A diffusion value that will modify diffusion_data. Read this for more information.

  • diffusion_data A dictionary of four floats that can be used arbitrarily, for example to colorize a fluid based on its physical state. Read this for more information.

  • atmospheric_drag The amount of air resistance.

  • atmospheric_pressure The amount of inward pressure applied by air on the surface of the fluid.

  • particle_z_write A shader rendering flag. This should be false for semi-transparent objects and true for opaque objects.

  • thickness_cutoff A threshold for rendering fluid thickness. Regions that are less thick than this are discarded.

  • thickness_downsample Increase this value to use a lower-resolution rendering buffer.

  • blur_radius Amount of depth blurring applied before generating normals. Higher values will result in a smoother surface.

  • surface_downsample Downsampling of the depth/normals buffers. Increase it to use lower-resolution buffers.

  • render_smoothness Surface smoothness of the fluid. High values will result in small specular glints, lower values will result in a rougher-looking surface.

  • metalness Controls reflection metalness: high values will cause reflection/specular to be tinted with the fluid's surface color.

  • ambient_multiplier A parameter that affects the fluid vis a vis the ambient lighting.

  • absorption How much light is absorbed by the fluid, as light travels trough it: higher values will tint the background with the fluid color.

  • refraction_downsample Downsampling of the refraction buffers. Increase it to use a lower-resolution buffer.

  • foam_downsample Downsampling of the foam buffer. Increase it to use a lower-resolution buffer.

  • capacity The maximum amount of emitted particles.

  • resolution The size and amount of particles in 1 cubic meter. A value of 1 will use 1000 particles per cubic meter.

  • color The visual color of the fluid.

  • rest_density The fluid density in kg/m3.

  • radius_scale This scales the size at which particles are drawn.

  • random_velocity Random velocity of emitted particles.


Functions

__init__

Fluid(smoothing, surface_tension, viscosity, vorticity, reflection, transparency, refraction, capacity, resolution, color, rest_density)

Fluid(smoothing, surface_tension, viscosity, vorticity, reflection, transparency, refraction, capacity, resolution, color, rest_density, buoyancy=-1, diffusion=0, diffusion_data=None, atmospheric_drag=0, atmospheric_pressure=0, particle_z_write=False, thickness_cutoff=1.2, thickness_downsample=2, blur_radius=0.02, surface_downsample=1, render_smoothness=0.8, metalness=0, ambient_multiplier=1, absorption=5, refraction_downsample=1, foam_downsample=1, radius_scale=1.7, random_velocity=0)

ParameterTypeDefaultDescription
smoothingfloatA percentage of the particle radius used to define the radius of the zone around each particle when calculating fluid density. Larger values will create smoother fluids, which are also less performant.
surface_tensionfloatIncreasing this value will make the fluid try to minimize its surface area, causing spherical drops to form.
viscosityfloatViscosity smooths out the velocity field generated by fluid particles when moving.
vorticityfloatAmount of vorticity confinement, it will contribute to maintain vortical details in the fluid. This value should always be between approximately 0 and 0.5.
reflectionfloatAmount of reflection.
transparencyfloatAmount of fluid transparency.
refractionfloatAmount of light refraction. This effect is more noticeable in thicker regions of the fluid.
capacityintThe maximum amount of emitted particles.
resolutionfloatThe size and amount of particles in 1 cubic meter. A value of 1 will use 1000 particles per cubic meter.
colorDict[str, float]The visual color of the fluid.
rest_densityfloatThe fluid density in kg/m3.
buoyancyfloat-1Controls the relative density between the fluid and the surrounding air.
diffusionfloat0A diffusion value that will modify diffusion_data. Read this for more information.
diffusion_dataDict[str, float]NoneA dictionary of four floats that can be used arbitrarily, for example to colorize a fluid based on its physical state. Read this for more information.
atmospheric_dragfloat0The amount of air resistance.
atmospheric_pressurefloat0The amount of inward pressure applied by air on the surface of the fluid.
particle_z_writeboolFalseA shader rendering flag. This should be false for semi-transparent objects and true for opaque objects.
thickness_cutofffloat1.2A threshold for rendering fluid thickness. Regions that are less thick than this are discarded.
thickness_downsampleint2Increase this value to use a lower-resolution rendering buffer.
blur_radiusfloat0.02Amount of depth blurring applied before generating normals. Higher values will result in a smoother surface.
surface_downsampleint1Downsampling of the depth/normals buffers. Increase it to use lower-resolution buffers.
render_smoothnessfloat0.8Surface smoothness of the fluid. High values will result in small specular glints, lower values will result in a rougher-looking surface.
metalnessfloat0Controls reflection metalness: high values will cause reflection/specular to be tinted with the fluid's surface color.
ambient_multiplierfloat1A parameter that affects the fluid vis a vis the ambient lighting.
absorptionfloat5How much light is absorbed by the fluid, as light travels trough it: higher values will tint the background with the fluid color.
refraction_downsampleint1Downsampling of the refraction buffers. Increase it to use a lower-resolution buffer.
foam_downsampleint1Downsampling of the foam buffer. Increase it to use a lower-resolution buffer.
radius_scalefloat1.7This scales the size at which particles are drawn.
random_velocityfloat0Random velocity of emitted particles.

to_dict

self.to_dict()

Returns: A JSON dictionary of this object.