Skip to content

Commit

Permalink
[UPDATE] Added an option to *Labs VolumeTexture Export* to export a c…
Browse files Browse the repository at this point in the history
…ustom vector field as a color field/texture to be used as volumetric data in RT engines
  • Loading branch information
d-oglesby committed Mar 21, 2022
1 parent a92de8f commit 9af644f
Show file tree
Hide file tree
Showing 8 changed files with 431 additions and 124 deletions.
10 changes: 9 additions & 1 deletion help/nodes/sop/labs--volume_texture-1.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ NOTE:
#id: mode
Select the mode which should be used for exporting the VolumeTexture.

Density:
Density:
Density will simply export the density values from your volume into a texture. All RGB values will have the same value.
SDF:
SDF will export your SDF as a texture, either raw or remapped to 0-1.
Color:
Color will export a volume named `Cd` to RGB, and optionally the `density` volume to A.
Custom Vector Field:
Custom Vector Field will take the specified vector field and convert it into a color field, which will export a volume named `Cd` to RGB, and optionally the `density` volume to A.

Equalize Range:
#id: equalizedensity
When turned on this will remap the `density` values to exactly 0-1 range.
Expand All @@ -58,6 +61,11 @@ NOTE:
SDF Range:
#id: sdfrange
Set the range from which your SDF should be remapped to 0-1.
Custom Field Name:
#id: customfield
Name of the custom vector field to be converted into a color field named `Cd` for export.


== Sampling ==

Up Axis:
Expand Down
95 changes: 95 additions & 0 deletions help/nodes/sop/labs--volume_texture-1.0.txt.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
= Labs VolumeTexture Export =

#type: node
#context: sop
#internal: labs::volume_texture::1.0
#icon: volume_texture
#tags: sidefxlabs, gamedev, volumes

""" Take a volume as an input and export a texture of the density field. """

The Volume Texture Export is useful for converting volumes into textures that can be used in a realtime engine. Instead of creating a custom 3D texture, this outputs a 2D texture that can be read by all engines and then processed to be used as volumetric data at realtime.

Use the dropdown presets to match UE4's expected volume texture inputs.

Internally the volume is converted to the target output resolution. That means one voxel equals one pixel and the resulting volume is a cube.

NOTE:
When exporting Density, make sure you are using a Fog VDB.

When exporting SDF, make sure you are using a Distance VDB.

When exporting Color, make sure you have a volume named `Cd`.

@parameters

Render:
#id: render
Generate the texture.
Valid Frame Range:
#id: trange
Use the dropdown to render a single frame or a sequence.

Start/End/Inc:
#id: f
Start and End Frame as well as how many increments in between.
Mode:
#id: mode
Select the mode which should be used for exporting the VolumeTexture.

Density:
Density will simply export the density values from your volume into a texture. All RGB values will have the same value.
SDF:
SDF will export your SDF as a texture, either raw or remapped to 0-1.
Color:
Color will export a volume named `Cd` to RGB, and optionally the `density` volume to A.
Custom Vector Field:
Custom Vector Field will take the specified vector field and convert it into a color field, which will export a volume named `Cd` to RGB, and optionally the `density` volume to A.

Equalize Range:
#id: equalizedensity
When turned on this will remap the `density` values to exactly 0-1 range.
Density in Alpha:
#id: densityalpha
When turned on this will export the `density` volume in the A channel when mode is set to Color.
Invert Density:
#id: invertdensity
When turned on this will flip the values used for exporting density.
Remap:
#id: remap
When mode is set to SDF this will enable remapping of values to 0-1. Use the `SDF Range` parameter to set the min and max values for the remap.
SDF Range:
#id: sdfrange
Set the range from which your SDF should be remapped to 0-1.
Custom Field Name:
#id: customfield
Name of the custom field to be converted into a color field named `Cd` for export.


== Sampling ==

Up Axis:
#id: up_axis
By default, the texture is exported with Z up to match UE4.
Frame Frozen:
#id: frozenframe
Optionally lets you export a specific frame in your framerange.
Frame:
#id: frame
Sets the frame that should be exported.
== Slicing ==

Slices:
#id: slices
Sets the total number of slices that should be generated.
Resolution per Slice:
#id: frameresolution
Sets the desired resolution per slice.
== Output ==

Preview:
#id: preview
Generate a preview of the texture in the viewport.
Output Picture:
#id: output_picture
Path of exported image.
2 changes: 1 addition & 1 deletion otls/volume_texture.1.0.hda/INDEX__SECTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ Inputs: 1 to 1
Subnet: true
Python: false
Empty: false
Modified: Fri Feb 18 17:11:31 2022
Modified: Sun Mar 20 22:34:56 2022

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"hdaroot/switchif1.def":1647829339,
"hdaroot/vdbextrapolate1.def":1645198788,
"hdaroot/volumemix6.def":1566597070,
"hdaroot/merge2.def":1644855560,
Expand Down Expand Up @@ -56,6 +57,7 @@
"hdaroot/volumemix1.def":1566597070,
"hdaroot/vdbactivate1.def":1645194239,
"hdaroot/cop2net1/vopcop2filter1.def":1644856208,
"hdaroot/name1.def":1647641156,
"hdaroot/cop2net1/__netbox3.netboxinit":1645014934,
"hdaroot/cop2net1/vopcop2filter2.def":1644856208,
"hdaroot/volumevisualization1.def":1467988806,
Expand All @@ -73,5 +75,5 @@
"hdaroot/__netbox1.netboxinit":1510877625,
"hdaroot/IN.def":1494882769,
"hdaroot/cop2net1/equalize2.def":1510879461,
"hdaroot.def":1645200482
"hdaroot.def":1647588910
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"values":["0.4","19.0.529"
"values":["0.4","19.0.498"
],
"indexes":{
"hdaroot/switchif1.userdata":1,
"hdaroot/name1.userdata":1,
"hdaroot/vdbactivate1.userdata":1,
"hdaroot/box1.userdata":1,
"hdaroot/volumemix6.userdata":1,
Expand Down
Loading

0 comments on commit 9af644f

Please sign in to comment.