Skip to content

Commit

Permalink
Fix black renders from non-hidden cube particle emitter
Browse files Browse the repository at this point in the history
  • Loading branch information
araistrick authored and pvl-bot committed Jul 12, 2024
1 parent b5d4628 commit 5d431f9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions infinigen/assets/weather/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
marine_snow_param_distribution,
rain_param_distribution,
snow_param_distribution,
spawn_emitter,
)
from .wind_effectors import TurbulenceEffector, WindEffector
21 changes: 21 additions & 0 deletions infinigen/assets/weather/particles.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,27 @@
logger = logging.getLogger(__name__)


def spawn_emitter(follow_cam, mesh_type, size, offset, name=None):
match mesh_type:
case "plane":
emitter = butil.spawn_plane(location=offset, size=size)
case "cube":
emitter = butil.spawn_cube(location=offset, size=size)
case _:
raise ValueError(f"Unknown mesh type {mesh_type}")

butil.constrain_object(emitter, "COPY_LOCATION", use_offset=True, target=follow_cam)

if name is None:
name = follow_cam.name
emitter.name = f"emitter({name=}, {mesh_type=})"

emitter.hide_viewport = True
emitter.hide_render = True

return emitter


def rain_param_distribution():
drops_per_sec_m2 = uniform(0.05, 1)
velocity = uniform(9, 20)
Expand Down
13 changes: 7 additions & 6 deletions infinigen_examples/generate_nature.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,15 +642,16 @@ def add_corals(target):
),
)

p.run_stage("wind", lambda: weather.WindEffector(np.randint(1e7))(0))
p.run_stage("turbulence", lambda: weather.TurbulenceEffector(np.randint(1e7))(0))
p.run_stage("wind", lambda: weather.WindEffector(randint(1e7))(0))
p.run_stage("turbulence", lambda: weather.TurbulenceEffector(randint(1e7))(0))

overhead_emitter = butil.spawn_plane(location=Vector((0, 0, 5)), size=60)
butil.constrain_object(
overhead_emitter, "COPY_LOCATION", use_offset=True, target=camera_rigs[0]
overhead_emitter = weather.spawn_emitter(
camera_rigs[0], "plane", offset=Vector((0, 0, 5)), size=60
)
cube_emitter = weather.spawn_emitter(
camera_rigs[0], "cube", offset=Vector(), size=30
)

cube_emitter = butil.spawn_cube(location=Vector(), size=30)
butil.constrain_object(
cube_emitter, "COPY_LOCATION", use_offset=True, target=camera_rigs[0]
)
Expand Down

0 comments on commit 5d431f9

Please sign in to comment.