From 9bbf39e73f2803c9890cb4f619eeb4a375a3ef73 Mon Sep 17 00:00:00 2001 From: Alexander Raistrick Date: Sat, 27 Jul 2024 22:09:45 -0400 Subject: [PATCH] Fix missing / malformed copyright headers, remove snow and autoexposure --- README.md | 2 +- infinigen/assets/materials/snow.py | 130 --------------------- infinigen/assets/weather/kole_clouds.py | 6 +- infinigen/assets/weather/wind_effectors.py | 7 ++ infinigen/core/rendering/auto_exposure.py | 66 ----------- infinigen/core/rendering/render.py | 10 -- 6 files changed, 12 insertions(+), 209 deletions(-) delete mode 100644 infinigen/assets/materials/snow.py delete mode 100644 infinigen/core/rendering/auto_exposure.py diff --git a/README.md b/README.md index acc877e87..0e553a487 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ Please post this repository's Github Issues page for help. Please run your comma Infinigen wouldn't be possible without the fantastic work of the [Blender Foundation](https://www.blender.org/) and it's open-source contributors. Infinigen uses many open source projects, with special thanks to [Land-Lab](https://github.com/landlab/landlab), [BlenderProc](https://github.com/DLR-RM/BlenderProc) [Blender-FLIP-Fluids](https://github.com/rlguy/Blender-FLIP-Fluids) and [Blender-Differential-Growth](https://github.com/inca/blender-differential-growth). -We thank [Thomas Kole](https://blenderartists.org/u/ThomasKole) for providing procedural clouds and [Pedro P. Lopes](https://blendswap.com/blend/30728) for the autoexposure nodegraph. +We thank [Thomas Kole](https://blenderartists.org/u/ThomasKole) for providing procedural clouds. We learned tremendously from online tutorials of [Andrew Price](https://www.youtube.com/channel/UCOKHwx1VCdgnxwbjyb9Iu1g), diff --git a/infinigen/assets/materials/snow.py b/infinigen/assets/materials/snow.py deleted file mode 100644 index 49d764aa6..000000000 --- a/infinigen/assets/materials/snow.py +++ /dev/null @@ -1,130 +0,0 @@ -# COPYRIGHT -# adapted from Blender Real Snow add-on https://docs.blender.org/manual/en/latest/addons/object/real_snow.html -# License: GPL - -from infinigen.core import surface -from infinigen.core.nodes.node_wrangler import Nodes -from infinigen.core.util.organization import SurfaceTypes - -type = SurfaceTypes.SDFPerturb -mod_name = "geo_snowtexture" -name = "snow" - - -def shader_snow(nw, subsurface=1.0, **kwargs): - nw.force_input_consistency() - position = nw.new_node("ShaderNodeNewGeometry", []) - combine_xyz = nw.new_node( - Nodes.CombineXYZ, input_kwargs={"X": 0.36, "Y": 0.46, "Z": 0.6} - ) - vector_math = nw.new_node( - Nodes.VectorMath, - input_kwargs={0: combine_xyz, 1: (0.5, 0.5, 0.5)}, - attrs={"operation": "MULTIPLY"}, - ) - mapping = nw.new_node( - Nodes.Mapping, input_kwargs={"Vector": position, "Scale": (12.0, 12.0, 12.0)} - ) - voronoi_texture = nw.new_node( - Nodes.VoronoiTexture, - input_kwargs={"Vector": mapping, "Scale": 30.0}, - attrs={"feature": "N_SPHERE_RADIUS"}, - ) - colorramp = nw.new_node( - Nodes.ColorRamp, input_kwargs={"Fac": voronoi_texture.outputs["Radius"]} - ) - colorramp.color_ramp.elements[0].position = 0.525 - colorramp.color_ramp.elements[0].color = (0.0, 0.0, 0.0, 1.0) - colorramp.color_ramp.elements[1].position = 0.58 - colorramp.color_ramp.elements[1].color = (1.0, 1.0, 1.0, 1.0) - - principled_bsdf = nw.new_node( - Nodes.PrincipledBSDF, - input_kwargs={ - "Base Color": (0.904, 0.904, 0.904, 1.0), - "Subsurface": subsurface, - "Subsurface Radius": vector_math.outputs["Vector"], - "Subsurface Color": (0.904, 0.904, 0.904, 1.0), - "Specular": 0.224, - "Roughness": 0.1, - "Clearcoat": colorramp.outputs["Color"], - "Clearcoat Roughness": 0.1, - }, - attrs={"distribution": "MULTI_GGX"}, - ) - - return principled_bsdf - - -def geo_snowtexture(nw, selection=None, **kwargs): - nw.force_input_consistency() - group_input = nw.new_node(Nodes.GroupInput) - normal_dir = nw.new_node(Nodes.InputNormal) - position0 = nw.new_node(Nodes.InputPosition) - position = nw.multiply(position0, [12] * 3) - - noise_texture = nw.new_node( - Nodes.NoiseTexture, - input_kwargs={"Vector": position, "Scale": 12.0, "Detail": 2}, - ) - - noise_texture_1 = nw.new_node( - Nodes.NoiseTexture, input_kwargs={"Vector": position, "Scale": 2.0, "Detail": 4} - ) - colorramp_1 = nw.new_node( - Nodes.ColorRamp, input_kwargs={"Fac": noise_texture_1.outputs["Fac"]} - ) - colorramp_1.color_ramp.elements[0].position = 0.069 - colorramp_1.color_ramp.elements[0].color = (0.0, 0.0, 0.0, 1.0) - colorramp_1.color_ramp.elements[1].position = 0.757 - colorramp_1.color_ramp.elements[1].color = (1.0, 1.0, 1.0, 1.0) - - noise_texture_2 = nw.new_node( - Nodes.NoiseTexture, input_kwargs={"Vector": position, "Scale": 1.0, "Detail": 4} - ) - colorramp_2 = nw.new_node( - Nodes.ColorRamp, input_kwargs={"Fac": noise_texture_2.outputs["Fac"]} - ) - colorramp_2.color_ramp.elements[0].position = 0.069 - colorramp_2.color_ramp.elements[0].color = (0.0, 0.0, 0.0, 1.0) - colorramp_2.color_ramp.elements[1].position = 0.757 - colorramp_2.color_ramp.elements[1].color = (1.0, 1.0, 1.0, 1.0) - - height = nw.scalar_add( - nw.scalar_multiply(0.6, noise_texture), - nw.scalar_multiply(0.4, colorramp_1), - colorramp_2, - ) - - map_range = nw.new_node( - Nodes.MapRange, - input_kwargs={"Value": height, 1: 0.0, 2: 2.0, 3: -0.03, 4: 0.03}, - ) - - modulation = nw.new_node( - Nodes.NoiseTexture, input_kwargs={"Vector": position0, "Scale": 0.5} - ) - colorramp_3 = nw.new_node(Nodes.ColorRamp, input_kwargs={"Fac": modulation}) - colorramp_3.color_ramp.elements[0].position = 0.25 - colorramp_3.color_ramp.elements[0].color = (0.0, 0.0, 0.0, 1.0) - colorramp_3.color_ramp.elements[1].position = 0.75 - colorramp_3.color_ramp.elements[1].color = (1.0, 1.0, 1.0, 1.0) - - offset = nw.multiply(normal_dir, map_range, colorramp_3) - - if selection is not None: - offset = nw.multiply(offset, surface.eval_argument(nw, selection)) - - set_position = nw.new_node( - Nodes.SetPosition, - input_kwargs={"Geometry": group_input.outputs["Geometry"], "Offset": offset}, - ) - - group_output = nw.new_node( - Nodes.GroupOutput, input_kwargs={"Geometry": set_position} - ) - - -def apply(objs, selection=None, **kwargs): - surface.add_geomod(objs, geo_snowtexture, selection=selection) - surface.add_material(objs, shader_snow, selection=selection, input_kwargs=kwargs) diff --git a/infinigen/assets/weather/kole_clouds.py b/infinigen/assets/weather/kole_clouds.py index 283258956..557f31939 100644 --- a/infinigen/assets/weather/kole_clouds.py +++ b/infinigen/assets/weather/kole_clouds.py @@ -1,5 +1,7 @@ -# Derived from https://blenderartists.org/t/fluffy-mostly-procedural-clouds-for-cycles/1448689 -# Original node-graph created by ThomasKole https://blenderartists.org/u/ThomasKole and licensed CC-0 +# Copyright (C) 2023 + +# Portions of this file were autogenerated based on https://blenderartists.org/t/fluffy-mostly-procedural-clouds-for-cycles/1448689 +# Original node-graph created by ThomasKole https://blenderartists.org/u/ThomasKole and made available under a CC0 license import bpy import gin diff --git a/infinigen/assets/weather/wind_effectors.py b/infinigen/assets/weather/wind_effectors.py index 5b5da035d..cc4f52485 100644 --- a/infinigen/assets/weather/wind_effectors.py +++ b/infinigen/assets/weather/wind_effectors.py @@ -1,3 +1,10 @@ +# Copyright (C) 2023, Princeton University. +# This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree. + +# Authors: +# - Alexander Raistrick + + import bpy import gin import numpy as np diff --git a/infinigen/core/rendering/auto_exposure.py b/infinigen/core/rendering/auto_exposure.py deleted file mode 100644 index 45317d0d3..000000000 --- a/infinigen/core/rendering/auto_exposure.py +++ /dev/null @@ -1,66 +0,0 @@ -# Derived from https://www.blendswap.com/blend/30728 -# Original node-graph created by PedroPLopes https://www.blendswap.com/profile/1609866 and licensed CC-0 - - -from infinigen.core.nodes import node_utils -from infinigen.core.nodes.node_wrangler import Nodes, NodeWrangler - - -@node_utils.to_nodegroup( - "nodegroup_auto_exposure", singleton=False, type="CompositorNodeTree" -) -def nodegroup_auto_exposure(nw: NodeWrangler): - # Code generated using version 2.6.4 of the node_transpiler - - group_input = nw.new_node( - Nodes.GroupInput, - expose_input=[ - ("NodeSocketColor", "Image", (1.0000, 1.0000, 1.0000, 1.0000)), - ("NodeSocketFloat", "EV Compensation", 0.0000), - ("NodeSocketFloat", "Metering Area", 1.0000), - ], - ) - - divide = nw.new_node( - "CompositorNodeMath", - input_kwargs={0: 1.0000, 1: group_input.outputs["Metering Area"]}, - attrs={"operation": "DIVIDE"}, - ) - - scale = nw.new_node( - "CompositorNodeScale", - input_kwargs={"Image": group_input.outputs["Image"], "X": divide, "Y": divide}, - ) - - multiply = nw.new_node( - "CompositorNodeMath", - input_kwargs={0: group_input.outputs["EV Compensation"], 1: -1.0000}, - attrs={"operation": "MULTIPLY"}, - ) - - exposure = nw.new_node( - Nodes.Exposure, input_kwargs={"Image": scale, "Exposure": multiply} - ) - - levels = nw.new_node( - "CompositorNodeLevels", - input_kwargs={"Image": exposure}, - attrs={"channel": "LUMINANCE"}, - ) - - multiply_1 = nw.new_node( - "CompositorNodeMath", - input_kwargs={0: levels.outputs["Mean"], 1: 2.0000}, - attrs={"operation": "MULTIPLY"}, - ) - - rgb_curves = nw.new_node( - "CompositorNodeCurveRGB", - input_kwargs={"Image": group_input.outputs["Image"], "White Level": multiply_1}, - ) - - nw.new_node( - Nodes.GroupOutput, - input_kwargs={"Image": rgb_curves}, - attrs={"is_active_output": True}, - ) diff --git a/infinigen/core/rendering/render.py b/infinigen/core/rendering/render.py index 4f0a1d0ef..2adce25a6 100644 --- a/infinigen/core/rendering/render.py +++ b/infinigen/core/rendering/render.py @@ -37,8 +37,6 @@ from infinigen.tools.datarelease_toolkit import reorganize_old_framesfolder from infinigen.tools.suffixes import get_suffix -from .auto_exposure import nodegroup_auto_exposure - TRANSPARENT_SHADERS = {Nodes.TranslucentBSDF, Nodes.TransparentBSDF} logger = logging.getLogger(__name__) @@ -110,18 +108,10 @@ def compositor_postprocessing( nw, source, show=True, - autoexpose=False, - autoexpose_level=-2, color_correct=True, distort=0, glare=False, ): - if autoexpose: - source = nw.new_node( - nodegroup_auto_exposure().name, - input_kwargs={"Image": source, "EV Comp": autoexpose_level}, - ) - if distort > 0: source = nw.new_node( Nodes.LensDistortion, input_kwargs={"Image": source, "Dispersion": distort}