Skip to content

Commit

Permalink
revert some
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Jun 12, 2024
1 parent 6c5af5a commit d33178d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 33 deletions.
18 changes: 9 additions & 9 deletions infinigen/assets/materials/aluminumdisp2tut.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import os, sys
import numpy as np
import math as ma
# Copyright (c) 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: Mingzhe Wang
# Acknowledgment: This file draws inspiration from https://www.youtube.com/watch?v=FY0lR96Mwas by Sam Bowman


import os
import bpy
import mathutils
from numpy.random import uniform, normal, randint

from infinigen.assets.materials.utils.surface_utils import clip, sample_range, sample_ratio, sample_color, geo_voronoi_noise
from infinigen.assets.materials.utils.surface_utils import sample_range, sample_ratio, sample_color
from infinigen.core.nodes.node_wrangler import Nodes, NodeWrangler
from infinigen.core.nodes import node_utils
from infinigen.core.util.color import color_category

from infinigen.core import surface

def shader_aluminumdisp2tut(nw: NodeWrangler, rand=False, **input_kwargs):
Expand Down
13 changes: 11 additions & 2 deletions infinigen/assets/materials/face_size_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@

# Authors: Alexander Raistrick


import bpy
import mathutils
from numpy.random import uniform, normal, randint
from infinigen.core.nodes.node_wrangler import Nodes, NodeWrangler
from infinigen.core.nodes import node_utils
from infinigen.core.util.color import color_category
from infinigen.core import surface

def shader_material(nw: NodeWrangler):
Expand All @@ -21,18 +27,21 @@ def shader_material(nw: NodeWrangler):
def geo_face_colors(nw: NodeWrangler):
# Code generated using version 2.4.3 of the node_transpiler

group_input = nw.expose_input('Geometry', dtype='NodeSocketGeometry')
group_input = nw.new_node(Nodes.GroupInput,
expose_input=[('NodeSocketGeometry', 'Geometry', None)])

random_value = nw.new_node(Nodes.RandomValue,
attrs={'data_type': 'FLOAT_VECTOR'})

store_named_attribute = nw.new_node(Nodes.StoreNamedAttribute,
input_kwargs={'Geometry': group_input, 'Name': 'col', "Value": random_value.outputs["Value"]},
input_kwargs={'Geometry': group_input.outputs["Geometry"], 'Name': 'col', "Value": random_value.outputs["Value"]},
attrs={'data_type': 'FLOAT_VECTOR', 'domain': 'FACE'})

group_output = nw.new_node(Nodes.GroupOutput,
input_kwargs={'Geometry': store_named_attribute})



def apply(obj, selection=None, **kwargs):
surface.add_geomod(obj, geo_face_colors, selection=selection, attributes=[])
surface.add_material(obj, shader_material, selection=selection)
25 changes: 3 additions & 22 deletions infinigen/assets/materials/water.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
# START RUN
# pathspec = 'infinigen.assets.materials.water', kwargs = {}, asset = bpy.data.objects['Icosphere']
# mat = <module 'infinigen.assets.materials.water' from '/Users/shawwalters/infinigen/infinigen/assets/materials/water.py'>

# @pytest.mark.ci
# @pytest.mark.parametrize('pathspec', load_txt_list('test_materials_basic.txt'))
# def test_material_runs(pathspec, **kwargs):

# butil.clear_scene()
# bpy.ops.mesh.primitive_ico_sphere_add(radius=.8, subdivisions=5)
# asset = bpy.context.active_object

# mat = import_item(pathspec)
# > mat.apply(asset)

# tests/test_materials_basic.py:27:
# END RUN


# Copyright (c) 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.

Expand Down Expand Up @@ -85,7 +66,7 @@ def geo_water(
if with_ripples:
water_height_node.outputs[0].default_value *= 0.1
ripple_height_node.outputs[0].default_value = water_height
water_height_node = nw.scalar_multiply(water_height_node, nw.scalar_add(0.5, nw.new_node(Nodes.MusgraveTexture, input_kwargs={"Scale": rg(height_modulation_scale)})))
water_height_node = nw.scalar_multiply(water_height_node, nw.scalar_add(0.5, nw.new_node("ShaderNodeTexMusgrave", input_kwargs={"Scale": rg(height_modulation_scale)})))
water_dimension_node = nw.new_node(Nodes.Value, label=f"water_dimension")
water_dimension_node.outputs[0].default_value = rg(water_dimension)
water_lacunarity_node = nw.new_node(Nodes.Value, label=f"water_lacunarity")
Expand All @@ -99,7 +80,7 @@ def geo_water(
if waves_animation_speed is not None:
drive_param(animated_position.inputs[0], rg(waves_animation_speed), offset=uniform(0, 10), index=1)

wave0 = nw.new_node(Nodes.MusgraveTexture, [
wave0 = nw.new_node("ShaderNodeTexMusgrave", [
animated_position, None,
water_scale_node,
water_detail_node,
Expand Down Expand Up @@ -157,7 +138,7 @@ def geo_water(
weight1 = nw.scalar_multiply(1 / np.pi, nw.scalar_sub(np.pi / 2, nw.new_node(Nodes.Math, [nw.scalar_multiply(0.1, nw.scalar_add(30, X))], attrs={'operation': 'ARCTANGENT'})))
weight2 = nw.scalar_add(0.5, nw.scalar_multiply(1 / np.pi, nw.new_node(Nodes.Math, [nw.scalar_multiply(0.1, nw.scalar_add(60, X))], attrs={'operation': 'ARCTANGENT'})))
offset = nw.multiply(offset, nw.scalar_multiply(weight1, weight2))
offset = nw.add(offset, nw.multiply(nw.new_node(Nodes.MusgraveTexture, input_kwargs={"Scale": 1}), [0, 0, 0.03]))
offset = nw.add(offset, nw.multiply(nw.new_node("ShaderNodeTexMusgrave", input_kwargs={"Scale": 1}), [0, 0, 0.03]))
foam = nw.multiply(foam, weight2)

group_input = nw.new_node(
Expand Down

0 comments on commit d33178d

Please sign in to comment.