Skip to content

Commit

Permalink
Update to 3.6, fix installation, fix all existing asset code
Browse files Browse the repository at this point in the history
    * working install.sh

    * assorted 3.6 compatibility fixes

    * fixed transfer attribute and added kernerlizer nodes.mix code

    * group input value fixes + index -> name specifiy

    * rename asset_grid and fixed blender path

    * bird fixes + revert geometrynodes.py transfer_attr

    * tiger, snake, transfer_attr compatibility fixes

    * chameleon and sculpt transfer attribute updates

    * Coconut Tree Fixes

    * Tree Fix

    * Assorted Fixes

    * Fish, Bird, Flowering plant fixes

    * Dragonfly, Chameleon fixes + making more assetfactories discoverable

    * Ivy, Lichen, Treeflower Fixes
  • Loading branch information
David-Yan1 authored and pvl-bot committed Oct 4, 2023
1 parent 1100f52 commit 3c76764
Show file tree
Hide file tree
Showing 41 changed files with 197 additions and 123 deletions.
14 changes: 9 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ REQUIREMENTS_PATH='./requirements.txt'
PYTHON_WGET_LINK='https://www.python.org/ftp/python/3.10.9/Python-3.10.9.tgz'
PYTHON_WGET_FILE='Python-3.10.9.tgz'
PYTHON_DIR='Python-3.10.9'
NURBS_SCRIPT="setup_linux.py"

git submodule init
git submodule update
Expand All @@ -23,7 +24,12 @@ if [ "${OS}" = "Darwin" ]; then
arch -arm64 brew install llvm open-mpi libomp glm glew
fi

bash worldgen/tools/install/install_bnurbs.sh
#bash worldgen/tools/install/install_bnurbs.sh
cd ./worldgen/assets/creatures/geometry/cpp_utils
rm -f *.so
rm -rf build
python "${NURBS_SCRIPT}" build_ext --inplace
cd -

# Build terrain
rm -rf *.egg-info
Expand All @@ -36,6 +42,7 @@ python setup.py build_ext --inplace --force
cd -

# Compile process_mesh (i.e. OpenGL-based ground truth)
<<<<<<< HEAD
cd ./process_mesh
/usr/bin/cmake -S . -Bbuild -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_BUILD_TYPE=Release
/usr/bin/cmake --build build --target all
Expand All @@ -59,10 +66,7 @@ if [ "$1" = "opengl" ]; then
bash ./worldgen/tools/install/compile_opengl.sh
fi


# Build Flip Fluids addon
if [ "$1" = "flip_fluids" ] || [ "$2" = "flip_fluids" ]; then
bash ./worldgen/tools/install/compile_flip_fluids.sh
fi
=======
>>>>>>> 84118268d (Initial buggy 3.5 fixes)
fi
2 changes: 1 addition & 1 deletion worldgen/assets/blender_rock.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class BlenderRockFactory(AssetFactory):

def __init__(self, factory_seed, detail):
def __init__(self, factory_seed, detail=3):
super(BlenderRockFactory, self).__init__(factory_seed)
self.detail = detail

Expand Down
3 changes: 2 additions & 1 deletion worldgen/assets/creatures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
from .genomes.fish import FishFactory, FishSchoolFactory
from .genomes.herbivore import HerbivoreFactory
from .genomes.crustacean import CrustaceanFactory, CrabFactory, LobsterFactory, SpinyLobsterFactory
from .genomes.reptile import FrogFactory, LizardFactory, SnakeFactory
from .genomes.reptile import FrogFactory, LizardFactory, SnakeFactory, ChameleonFactory
from .genomes.beetle import BeetleFactory, AntSwarmFactory
2 changes: 1 addition & 1 deletion worldgen/assets/creatures/genomes/fish.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def fish_school_params(self):
boids_settings=boids_settings
)

def __init__(self, factory_seed, bvh, coarse=False):
def __init__(self, factory_seed, bvh=None, coarse=False):
with FixedSeed(factory_seed):
settings = self.fish_school_params()
col = make_asset_collection(FishFactory(factory_seed=randint(1e7), animation_mode='idle'), n=3)
Expand Down
2 changes: 1 addition & 1 deletion worldgen/assets/creatures/hair.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def nodegroup_hair_grooming(nw: NodeWrangler):
input_kwargs={'Value': spline_parameter.outputs["Factor"], 3: group_input.outputs["Root Radius"], 4: 0.0})

set_curve_radius = nw.new_node(Nodes.SetCurveRadius,
input_kwargs={'Curves': snaprootstosurface, 'Radius': map_range.outputs["Result"]})
input_kwargs={'Curve': snaprootstosurface, 'Radius': map_range.outputs["Result"]})

group_output = nw.new_node(Nodes.GroupOutput,
input_kwargs={'Geometry': set_curve_radius})
Expand Down
2 changes: 1 addition & 1 deletion worldgen/assets/creatures/nodegroups/hair.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def nodegroup_comb_direction(nw: NodeWrangler):
group_output = nw.new_node(Nodes.GroupOutput,
input_kwargs={
'Combing Direction': normalize_1.outputs["Vector"],
'Surface Normal': surface_normal.outputs["Attribute"],
'Surface Normal': (surface_normal, "Value"),
'Skeleton Tangent': skeleton_tangent
})

Expand Down
12 changes: 6 additions & 6 deletions worldgen/assets/creatures/nodegroups/sculpt_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def nodegroup_bilinear_interp_index_transfer(nw: NodeWrangler):

transfer_attribute_1 = nw.new_node(Nodes.TransferAttribute,
input_kwargs={'Source': group_input, 1: group_input.outputs["Attribute"], 'Index': floor_floor},
attrs={'data_type': 'FLOAT_VECTOR'})
attrs={'data_type': 'FLOAT_VECTOR', 'mapping': 'INDEX'})

ceil_floor = nw.new_node(Nodes.Math,
input_kwargs={0: uvparamtovertidxs_1.outputs["Ceil"], 1: group_input.outputs["SizeV"], 2: uvparamtovertidxs.outputs["Floor"]},
Expand All @@ -76,7 +76,7 @@ def nodegroup_bilinear_interp_index_transfer(nw: NodeWrangler):

transfer_attribute_2 = nw.new_node(Nodes.TransferAttribute,
input_kwargs={'Source': group_input, 1: group_input.outputs["Attribute"], 'Index': ceil_floor},
attrs={'data_type': 'FLOAT_VECTOR'})
attrs={'data_type': 'FLOAT_VECTOR', 'mapping': 'INDEX'})

map_range = nw.new_node(Nodes.MapRange,
input_kwargs={'Vector': uvparamtovertidxs_1.outputs["Remainder"], 9: transfer_attribute_1.outputs["Attribute"], 10: transfer_attribute_2.outputs["Attribute"]},
Expand All @@ -89,7 +89,7 @@ def nodegroup_bilinear_interp_index_transfer(nw: NodeWrangler):

transfer_attribute_3 = nw.new_node(Nodes.TransferAttribute,
input_kwargs={'Source': group_input, 1: group_input.outputs["Attribute"], 'Index': floor_ceil},
attrs={'data_type': 'FLOAT_VECTOR'})
attrs={'data_type': 'FLOAT_VECTOR', 'mapping': 'INDEX'})

ceil_ceil = nw.new_node(Nodes.Math,
input_kwargs={0: uvparamtovertidxs_1.outputs["Ceil"], 1: group_input.outputs["SizeV"], 2: uvparamtovertidxs.outputs["Ceil"]},
Expand All @@ -98,7 +98,7 @@ def nodegroup_bilinear_interp_index_transfer(nw: NodeWrangler):

transfer_attribute_4 = nw.new_node(Nodes.TransferAttribute,
input_kwargs={'Source': group_input, 1: group_input.outputs["Attribute"], 'Index': ceil_ceil},
attrs={'data_type': 'FLOAT_VECTOR'})
attrs={'data_type': 'FLOAT_VECTOR', 'mapping': 'INDEX'})

map_range_1 = nw.new_node(Nodes.MapRange,
input_kwargs={'Vector': uvparamtovertidxs_1.outputs["Remainder"], 9: transfer_attribute_3.outputs["Attribute"], 10: transfer_attribute_4.outputs["Attribute"]},
Expand Down Expand Up @@ -136,7 +136,7 @@ def nodegroup_curve_parameter_curve(nw: NodeWrangler):

transfer_attribute = nw.new_node(Nodes.TransferAttribute,
input_kwargs={'Source': group_input.outputs["Surface"], 1: normal, 'Source Position': bilinearinterpindextransfer},
attrs={'data_type': 'FLOAT_VECTOR'})
attrs={'data_type': 'FLOAT_VECTOR', 'mapping': 'NEAREST_FACE_INTERPOLATED'})

multiply_add = nw.new_node(Nodes.VectorMath,
input_kwargs={0: transfer_attribute.outputs["Attribute"], 1: separate_xyz.outputs["Z"], 2: bilinearinterpindextransfer},
Expand Down Expand Up @@ -188,7 +188,7 @@ def nodegroup_curve_sculpt(nw: NodeWrangler):

transfer_attribute = nw.new_node(Nodes.TransferAttribute,
input_kwargs={'Source': curve_to_mesh_1, 1: position, 'Index': index},
attrs={'data_type': 'FLOAT_VECTOR'})
attrs={'data_type': 'FLOAT_VECTOR', 'mapping': 'INDEX'})

separate_xyz = nw.new_node(Nodes.SeparateXYZ, input_kwargs={'Vector': transfer_attribute.outputs["Attribute"]})

Expand Down
46 changes: 23 additions & 23 deletions worldgen/assets/creatures/parts/chameleon.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def nodegroup_chameleon_toe(nw: NodeWrangler):
input_kwargs={'Curve': capture_attribute.outputs["Geometry"], 'Profile Curve': curve_circle.outputs["Curve"]})

store_named_attribute = nw.new_node(Nodes.StoreNamedAttribute,
input_kwargs={'Geometry': curve_to_mesh, 'Name': 'Ridge', 3: capture_attribute.outputs[2]},
input_kwargs={'Geometry': curve_to_mesh, 'Name': 'Ridge', 'Value': capture_attribute.outputs[2]},
attrs={'data_type': 'FLOAT', 'domain': 'POINT'})

sample_curve = nw.new_node(Nodes.SampleCurve, input_kwargs={'Curve': set_curve_radius}, attrs={'mode': 'FACTOR'})
Expand Down Expand Up @@ -233,43 +233,43 @@ def nodegroup_bilinear_interp_index_transfer(nw: NodeWrangler):
label='FloorFloor',
attrs={'operation': 'MULTIPLY_ADD'})

transfer_attribute = nw.new_node(Nodes.TransferAttribute,
input_kwargs={'Source': group_input, 1: group_input.outputs["Attribute"], 'Index': floor_floor},
attrs={'data_type': 'FLOAT_VECTOR', 'mapping': 'INDEX'})
transfer_attribute = nw.new_node(Nodes.SampleIndex,
input_kwargs={'Geometry': group_input, 'Value': group_input.outputs["Attribute"], 'Index': floor_floor},
attrs={'data_type': 'FLOAT_VECTOR'})

ceil_floor = nw.new_node(Nodes.Math,
input_kwargs={0: uvparamtovertidxs_1.outputs["Ceil"], 1: group_input.outputs["SizeV"], 2: uvparamtovertidxs.outputs["Floor"]},
label='CeilFloor',
attrs={'operation': 'MULTIPLY_ADD'})

transfer_attribute_1 = nw.new_node(Nodes.TransferAttribute,
input_kwargs={'Source': group_input, 1: group_input.outputs["Attribute"], 'Index': ceil_floor},
attrs={'data_type': 'FLOAT_VECTOR', 'mapping': 'INDEX'})
transfer_attribute_1 = nw.new_node(Nodes.SampleIndex,
input_kwargs={'Geometry': group_input, 'Value': group_input.outputs["Attribute"], 'Index': ceil_floor},
attrs={'data_type': 'FLOAT_VECTOR'})

map_range = nw.new_node(Nodes.MapRange,
input_kwargs={'Vector': uvparamtovertidxs_1.outputs["Remainder"], 9: transfer_attribute.outputs["Attribute"], 10: transfer_attribute_1.outputs["Attribute"]},
input_kwargs={'Vector': uvparamtovertidxs_1.outputs["Remainder"], 9: (transfer_attribute, 'Value'), 10: (transfer_attribute_1, 'Value')},
attrs={'data_type': 'FLOAT_VECTOR'})

floor_ceil = nw.new_node(Nodes.Math,
input_kwargs={0: uvparamtovertidxs_1.outputs["Floor"], 1: group_input.outputs["SizeV"], 2: uvparamtovertidxs.outputs["Ceil"]},
label='FloorCeil',
attrs={'operation': 'MULTIPLY_ADD'})

transfer_attribute_2 = nw.new_node(Nodes.TransferAttribute,
input_kwargs={'Source': group_input, 1: group_input.outputs["Attribute"], 'Index': floor_ceil},
attrs={'data_type': 'FLOAT_VECTOR', 'mapping': 'INDEX'})
transfer_attribute_2 = nw.new_node(Nodes.SampleIndex,
input_kwargs={'Geometry': group_input, 'Value': group_input.outputs["Attribute"], 'Index': floor_ceil},
attrs={'data_type': 'FLOAT_VECTOR'})

ceil_ceil = nw.new_node(Nodes.Math,
input_kwargs={0: uvparamtovertidxs_1.outputs["Ceil"], 1: group_input.outputs["SizeV"], 2: uvparamtovertidxs.outputs["Ceil"]},
label='CeilCeil',
attrs={'operation': 'MULTIPLY_ADD'})

transfer_attribute_3 = nw.new_node(Nodes.TransferAttribute,
input_kwargs={'Source': group_input, 1: group_input.outputs["Attribute"], 'Index': ceil_ceil},
attrs={'data_type': 'FLOAT_VECTOR', 'mapping': 'INDEX'})
transfer_attribute_3 = nw.new_node(Nodes.SampleIndex,
input_kwargs={'Geometry': group_input, 'Value': group_input.outputs["Attribute"], 'Index': ceil_ceil},
attrs={'data_type': 'FLOAT_VECTOR'})

map_range_1 = nw.new_node(Nodes.MapRange,
input_kwargs={'Vector': uvparamtovertidxs_1.outputs["Remainder"], 9: transfer_attribute_2.outputs["Attribute"], 10: transfer_attribute_3.outputs["Attribute"]},
input_kwargs={'Vector': uvparamtovertidxs_1.outputs["Remainder"], 9: (transfer_attribute_2, 'Value'), 10: (transfer_attribute_3, 'Value')},
attrs={'data_type': 'FLOAT_VECTOR'})

map_range_2 = nw.new_node(Nodes.MapRange,
Expand Down Expand Up @@ -519,7 +519,7 @@ def nodegroup_chameleon_leg_raw_shape(nw: NodeWrangler):
input_kwargs={'Geometry': simpletube_1.outputs["Curve"], 'Rotation': scale_1.outputs["Vector"], 'Scale': (1.0000, 0.6500, 1.0000)})

sample_curve = nw.new_node(Nodes.SampleCurve,
input_kwargs={'Curve': transform_geometry_2, 'Factor': 0.8500, 'Length': 1.0000},
input_kwargs={'Curve': transform_geometry_2, 'Factor': 0.8500},
attrs={'mode': 'FACTOR'})

set_position = nw.new_node(Nodes.SetPosition,
Expand Down Expand Up @@ -736,12 +736,12 @@ def nodegroup_curve_parameter_curve(nw: NodeWrangler):
bilinearinterpindextransfer = nw.new_node(nodegroup_bilinear_interp_index_transfer().name,
input_kwargs={'Source': group_input.outputs["Surface"], 'U': separate_xyz.outputs["X"], 'V': separate_xyz.outputs["Y"], 'Attribute': position_1, 'SizeU': group_input.outputs["CtrlptsU"], 'SizeV': group_input.outputs["CtrlptsW"], 'CyclicV': True})

transfer_attribute = nw.new_node(Nodes.TransferAttribute,
input_kwargs={'Source': group_input.outputs["Surface"], 1: normal, 'Source Position': bilinearinterpindextransfer},
transfer_attribute = nw.new_node(Nodes.SampleNearestSurface,
input_kwargs={'Mesh': group_input.outputs["Surface"], 'Value': normal, 'Sample Position': bilinearinterpindextransfer},
attrs={'data_type': 'FLOAT_VECTOR'})

multiply_add = nw.new_node(Nodes.VectorMath,
input_kwargs={0: transfer_attribute.outputs["Attribute"], 1: separate_xyz.outputs["Z"], 2: bilinearinterpindextransfer},
input_kwargs={0: (transfer_attribute, 'Value'), 1: separate_xyz.outputs["Z"], 2: bilinearinterpindextransfer},
attrs={'operation': 'MULTIPLY_ADD'})

set_position = nw.new_node(Nodes.SetPosition,
Expand Down Expand Up @@ -896,11 +896,11 @@ def nodegroup_curve_sculpt(nw: NodeWrangler):

index = nw.new_node(Nodes.Index)

transfer_attribute = nw.new_node(Nodes.TransferAttribute,
input_kwargs={'Source': curve_to_mesh_1, 1: position, 'Index': index},
transfer_attribute = nw.new_node(Nodes.SampleIndex,
input_kwargs={'Geometry': curve_to_mesh_1, 'Value': position, 'Index': index},
attrs={'data_type': 'FLOAT_VECTOR'})

separate_xyz = nw.new_node(Nodes.SeparateXYZ, input_kwargs={'Vector': transfer_attribute.outputs["Attribute"]})
separate_xyz = nw.new_node(Nodes.SeparateXYZ, input_kwargs={'Vector': (transfer_attribute, 'Value')})

add = nw.new_node(Nodes.Math, input_kwargs={0: group_input_1.outputs["Base Radius"], 1: separate_xyz.outputs["X"]})

Expand Down Expand Up @@ -932,7 +932,7 @@ def nodegroup_curve_sculpt(nw: NodeWrangler):
attrs={'use_clamp': True, 'operation': 'MAXIMUM'})

store_named_attribute = nw.new_node(Nodes.StoreNamedAttribute,
input_kwargs={'Geometry': set_position, 'Name': group_input_1.outputs["Name"], 3: maximum},
input_kwargs={'Geometry': set_position, 'Name': group_input_1.outputs["Name"], 'Value': maximum},
attrs={'data_type': 'FLOAT', 'domain': 'POINT'})

switch_3 = nw.new_node(Nodes.Switch,
Expand Down
21 changes: 13 additions & 8 deletions worldgen/assets/creatures/parts/wings.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,12 @@ def nodegroup_bird_wing(nw: NodeWrangler):
map_range_1 = nw.new_node(Nodes.MapRange,
input_kwargs={'Value': index, 1: attribute_statistic.outputs["Min"], 2: attribute_statistic.outputs["Max"]})

transfer_attribute = nw.new_node(Nodes.SampleNearestSurface,
input_kwargs={'Source': curve_to_mesh, 2: map_range_1.outputs["Result"]},
attrs={'mapping': 'NEAREST'})

transfer_attribute_index = nw.new_node(Nodes.SampleNearest,
input_kwargs={'Geometry': curve_to_mesh, 'Sample Position': map_range_1.outputs["Result"]})

transfer_attribute = nw.new_node(Nodes.SampleIndex,
input_kwargs={'Geometry': curve_to_mesh, 'Index': transfer_attribute_index})

float_curve = nw.new_node(Nodes.FloatCurve,
input_kwargs={'Factor': group_input.outputs["Wing Shape Sculpting"], 'Value': (transfer_attribute, 'Value')})
node_utils.assign_curve(float_curve.mapping.curves[0], [(0.0, 0.0), (0.5164, 0.245), (0.7564, 0.625), (1.0, 1.0)])
Expand All @@ -223,7 +225,7 @@ def nodegroup_bird_wing(nw: NodeWrangler):
input_kwargs={'Deg': add.outputs["Vector"]})

vector_curves = nw.new_node(Nodes.VectorCurve,
input_kwargs={'Fac': group_input.outputs["Wing Shape Sculpting"], 'Vector': transfer_attribute.outputs[1]})
input_kwargs={'Fac': group_input.outputs["Wing Shape Sculpting"], 'Vector': transfer_attribute})
node_utils.assign_curve(vector_curves.mapping.curves[0], [(-1.0, -0.0), (0.0036, 0.0), (0.0473, 0.6), (0.3527, 0.54), (0.6, 0.9), (0.8836, 0.92), (1.0, 0.58)], handles=['AUTO', 'VECTOR', 'AUTO', 'AUTO', 'VECTOR', 'AUTO', 'AUTO'])
node_utils.assign_curve(vector_curves.mapping.curves[1], [(-1.0, 1.0), (1.0, 1.0)])
node_utils.assign_curve(vector_curves.mapping.curves[2], [(-1.0, 1.0), (1.0, 1.0)])
Expand Down Expand Up @@ -548,9 +550,12 @@ def nodegroup_flying_bird_wing(nw: NodeWrangler):
map_range_1 = nw.new_node(Nodes.MapRange,
input_kwargs={'Value': index, 1: attribute_statistic.outputs["Min"],
2: attribute_statistic.outputs["Max"]})

transfer_attribute_index = nw.new_node(Nodes.SampleNearest,
input_kwargs={'Geometry': curve_to_mesh, 'Sample Position': map_range_1.outputs["Result"]})

transfer_attribute = nw.new_node(Nodes.SampleNearestSurface,
input_kwargs={'Source': curve_to_mesh, 'Value': map_range_1.outputs["Result"]})
transfer_attribute = nw.new_node(Nodes.SampleIndex,
input_kwargs={'Geometry': curve_to_mesh, 'Index': transfer_attribute_index})

map_range_2 = nw.new_node(Nodes.MapRange,
input_kwargs={'Value': group_input.outputs["Extension"], 3: 115.6500, 4: 0.0000})
Expand All @@ -563,7 +568,7 @@ def nodegroup_flying_bird_wing(nw: NodeWrangler):
for i in range(3):
float_curve = nw.new_node(Nodes.FloatCurve,
input_kwargs={'Factor': group_input.outputs["Wing Shape Sculpting"],
'Value': transfer_attribute.outputs[1]})
'Value': (transfer_attribute, 'Value')})
node_utils.assign_curve(float_curve.mapping.curves[0],
[(0.0000, 0.0000), (0.25, 0.2), (0.50, 0.4),
(0.75, 0.6), (1.0000, 0.8 - i * 0.02 + N(0., 0.02))])
Expand Down
2 changes: 1 addition & 1 deletion worldgen/assets/flower.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def nodegroup_follow_curve(nw):
attrs={'operation': 'MULTIPLY'})

sample_curve = nw.new_node(Nodes.SampleCurve,
input_kwargs={'Curves': group_input.outputs["Curve"], 'Length': multiply})
input_kwargs={'Curves': group_input.outputs["Curve"], 'Length': multiply}, attrs={'mode': 'LENGTH'})

cross_product = nw.new_node(Nodes.VectorMath,
input_kwargs={0: sample_curve.outputs["Tangent"], 1: sample_curve.outputs["Normal"]},
Expand Down
3 changes: 2 additions & 1 deletion worldgen/assets/grassland/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@


from .dandelion import DandelionFactory, DandelionSeedFactory
from .flowerplant import FlowerPlantFactory
from .flowerplant import FlowerPlantFactory
from .grass_tuft import GrassTuftFactory
Loading

0 comments on commit 3c76764

Please sign in to comment.