Skip to content

Commit

Permalink
Merge pull request #26 from OmooLab/feature/dev
Browse files Browse the repository at this point in the history
feat: dramatic reduction in rendering time 🚀
  • Loading branch information
icrdr authored Jul 9, 2024
2 parents 637fc75 + 99ce5c2 commit 5922269
Show file tree
Hide file tree
Showing 16 changed files with 577 additions and 624 deletions.
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
![GitHub Release](https://img.shields.io/github/v/release/OmooLab/BioxelNodes?style=for-the-badge)
![GitHub Repo stars](https://img.shields.io/github/stars/OmooLab/BioxelNodes?style=for-the-badge)

Bioxel Nodes is a Blender extension for scientific volumetric data visualization. It using Blender's powerful Geometry Nodes and Cycles to process and render volumetric data. You are free to share your blender file to anyone who does not install this extension, since most processes were done by Blender's native nodes.
Bioxel Nodes is a Blender addon for scientific volumetric data visualization. It using Blender's powerful Geometry Nodes and Cycles to process and render volumetric data. You are free to share your blender file to anyone who does not install this extension, since most processes were done by Blender's native nodes.

## About

Before us, there have been many tutorials and extensions for importing volumetric data into Blender. However, we found that there were many scientific issues that were not addressed in place, and the volume render results were not epic. With Bioxel Nodes, you can easily import any format volumetric data into Blender, and more importantly, make a beautiful realistic volume rendering quickly.
Before us, there have been many tutorials and addons for importing volumetric data into Blender. However, we found that there were many scientific issues that were not addressed in place, and the volume render results were not epic. With Bioxel Nodes, you can easily import any format volumetric data into Blender, and more importantly, make a beautiful realistic volume rendering quickly.

Below are some examples with Bioxel Nodes. Thanks to Cycles Render, the volumetric data can be rendered with great detail:

Expand Down Expand Up @@ -41,30 +41,29 @@ So how to use this extension? please check [Getting Started](https://omoolab.git

## Known Limitations

- Cycles CPUs only, Cycles GPUs (Optix), EEVEE (partial support)
- Sections cannot be generated (will be supported soon)
- Time sequence volume not supported (will be supported soon)

## Upgrade from 0.1.x to 0.2.x
## Compatibility to Newer Version

You need to do the following:
Addon are updating, and it is possible that newer versions of the addon will not work on old project files properly. In order to make the old files work, you can do the following:

1. Remove the old version of Bioxel Nodes at Preferences > Add-ons
2. Add the new version and restart Blender.
### For project files that need to be archived

It is not support editing the same blender file across extension versions. In order to make sure that the previous file works properly. You need to save the staged data before upgrading ( read the last section of [Getting Started](https://omoolab.github.io/BioxelNodes/latest/getting-started/#share-your-file) ).
Persistently save the Addon nodes before the addon is updated. This will put the nodes out of sync with the addon functionality, but it will ensure that the entire file can be calculated and rendered correctly, it fit to project files that you need to archive.
Bioxel Nodes > Save All Staged Data

But even then, there is still no guarantee that the new version of the extension will work on the old blender file. Therefore, it is highly recommended to open a new blender file to start the creating, not based on the old one.
### For working project files

Alternatively, objects from the old file that have nothing to do with Bioxel Nodes could be append to the new blender file.
If you've ever done a persistent save of Bioxel Nodes nodes, it's possible that after the addon update, there may be new features of the addon that don't synergize with the saved nodes. In order for the new version to work with the old nodes, you need to relink them.
Bioxel Nodes > Relink Nodes to Addon

## About EEVEE Render

Bioxel Nodes is designed for Cycles Render. However, it does support eevee render partially. "Solid Shader" node and "Volume Shader" node have a toggle called "EEVEE Render". If you want to render Bioxel Component in real-time, turn it on.

Also, there are some limitations:
Bioxel Nodes is designed for Cycles Render. However, it does support eevee render partially.Also, there are some limitations:

1. Only one cutter supported.
2. You cannot use "Color Ramp" over 2 colors.
3. EEVEE Render result is not that great as Cycles does.
2. EEVEE Render result is not that great as Cycles does.

> "Volume Shader" node is not work properly in EEVEE Next since 4.2. It is because EEVEE Next is not support attributes from instances of volume shader by now. But the Blender 4.2 docs still say attributes reading is ok, so I suppose this feature will eventually be implemented.
> Volume Shader is not work properly in EEVEE Next since 4.2. It is because EEVEE Next is not support attributes from instances of volume shader by now. But Blender 4.3 is ok, so I suppose this issue will eventually be fixed.
9 changes: 2 additions & 7 deletions bioxelnodes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"name": "Bioxel Nodes",
"author": "Ma Nan",
"description": "",
"blender": (4, 0, 0),
"version": (0, 2, 4),
"blender": (4, 1, 0),
"version": (0, 2, 5),
"location": "File -> Import",
"warning": "",
"category": "Node"
Expand All @@ -21,11 +21,6 @@
def register():
auto_load.register()
menus.add()
bpy.types.Scene.bioxel_layer_dir = bpy.props.StringProperty(
name="Layer Directory",
subtype='DIR_PATH',
default="//"
)


def unregister():
Expand Down
3 changes: 0 additions & 3 deletions bioxelnodes/assets/Nodes/BioxelNodes_4.0.blend

This file was deleted.

4 changes: 2 additions & 2 deletions bioxelnodes/assets/Nodes/BioxelNodes_4.1.blend
Git LFS file not shown
63 changes: 7 additions & 56 deletions bioxelnodes/customnodes/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,12 @@
from .nodes import AddCustomNode


class SaveAllNodes(bpy.types.Operator):
bl_idname = "customnodes.save_all_nodes"
bl_label = "Save All Nodes"
bl_description = "Save All Custom Nodes to Directory."
bl_options = {'UNDO'}

def execute(self, context):
files = []
for classname in dir(bpy.types):
if "CUSTOMNODES_MT_NODES_" in classname:
cls = getattr(bpy.types, classname)
files.append(cls.nodes_file)
files = list(set(files))

for file in files:
file_name = Path(file).name
# "//"
customnodes_node_dir = bpy.path.abspath(context.scene.customnodes_node_dir)

output_path: Path = Path(customnodes_node_dir, file_name).resolve()
source_path: Path = Path(file).resolve()

if output_path != source_path:
shutil.copy(source_path, output_path)

for lib in bpy.data.libraries:
lib_path = str(Path(bpy.path.abspath(lib.filepath)).resolve())
if lib_path == file:
blend_path = Path(bpy.path.abspath("//")).resolve()
lib.filepath = bpy.path.relpath(
str(output_path), start=str(blend_path))

self.report({"INFO"}, f"Successfully saved to {output_path}")

return {'FINISHED'}


class CUSTOMNODES_PT_CustomNodes(bpy.types.Panel):
bl_idname = "CUSTOMNODES_PT_CustomNodes"
bl_label = "Custom Nodes"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "scene"

def draw(self, context):
layout = self.layout
scene = context.scene
layout.prop(scene, 'customnodes_node_dir')
layout.operator(SaveAllNodes.bl_idname)


class CustomNodes():
def __init__(
self,
menu_items,
nodes_file,
class_prefix="CUSTOMNODES_MT_NODES",
root_label='CustomNodes',
root_icon='NONE'
) -> None:
Expand All @@ -68,9 +18,10 @@ def __init__(

self.menu_items = menu_items
self.nodes_file = str(Path(nodes_file).resolve())

self.class_prefix = class_prefix
self.root_label = root_label
self.root_icon = root_icon
self.class_prefix = class_prefix

menu_classes = []
self._create_menu_class(
Expand All @@ -80,7 +31,7 @@ def __init__(
)
self.menu_classes = menu_classes

idname = f"CUSTOMNODES_MT_NODES_{root_label.replace(' ', '').upper()}"
idname = f"{class_prefix}_{root_label.replace(' ', '').upper()}"

def add_node_menu(self, context):
if ('GeometryNodeTree' == bpy.context.area.spaces[0].tree_type):
Expand All @@ -92,7 +43,7 @@ def add_node_menu(self, context):

def _create_menu_class(self, menu_classes, items, label='CustomNodes', icon=0, idname_namespace=None):
nodes_file = self.nodes_file
idname_namespace = idname_namespace or "CUSTOMNODES_MT_NODES"
idname_namespace = idname_namespace or self.class_prefix
idname = f"{idname_namespace}_{label.replace(' ', '').upper()}"

# create submenu class if item is menu.
Expand Down Expand Up @@ -161,7 +112,7 @@ def find_item(self, node_type: str):
self._find_item(found_items, self.menu_items, node_type)
return found_items[0] if len(found_items) > 0 else None

def add_node(self, node_tree, node_type: str):
def add_node(self, node_group, node_type: str):
item = self.find_item(node_type)
op = AddCustomNode()
op.nodes_file = self.nodes_file
Expand All @@ -174,7 +125,7 @@ def add_node(self, node_tree, node_type: str):
op.node_label = ""
op.node_link = True
op.node_callback = ""
return op.add_node(node_tree)
return op.add_node(node_group)

def register(self):
for cls in self.menu_classes:
Expand Down
9 changes: 7 additions & 2 deletions bioxelnodes/customnodes/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@ def recursive_append_material(self, node_tree):
except:
...

def add_node(self, node_tree):
def add_node(self, node_group):
# Deselect all nodes first
for node in node_group.nodes:
if node.select:
node.select = False

self.get_node_tree(self.node_type, self.node_link)
node = node_tree.new("GeometryNodeGroup")
node = node_group.nodes.new("GeometryNodeGroup")
self.assign_node_tree(node)

return node
Expand Down
Loading

0 comments on commit 5922269

Please sign in to comment.