Skip to content

Commit

Permalink
Fix pedestrian animation in semantics map (#685)
Browse files Browse the repository at this point in the history
* Fix pedestrian animation in semantics map

* fix bug

* format
  • Loading branch information
pengzhenghao authored Mar 26, 2024
1 parent 6bf4267 commit ac0dd44
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions metadrive/component/sensors/semantic_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,25 @@ def _setup_effect(self):
label, Terrain.make_render_state(self.engine, "terrain.vert.glsl", "terrain_semantics.frag.glsl")
)
else:
cam.setTagState(
label,
RenderState.make(
ShaderAttrib.makeOff(), LightAttrib.makeAllOff(), TextureAttrib.makeOff(),
ColorAttrib.makeFlat((c[0] / 255, c[1] / 255, c[2] / 255, 1)), 1

if label == Semantics.PEDESTRIAN.label:
# PZH: This is a workaround fix to make pedestrians animated.
cam.setTagState(
label,
RenderState.make(
# ShaderAttrib.makeOff(),
LightAttrib.makeAllOff(),
TextureAttrib.makeOff(),
ColorAttrib.makeFlat((c[0] / 255, c[1] / 255, c[2] / 255, 1)),
1
)
)

else:
cam.setTagState(
label,
RenderState.make(
ShaderAttrib.makeOff(), LightAttrib.makeAllOff(), TextureAttrib.makeOff(),
ColorAttrib.makeFlat((c[0] / 255, c[1] / 255, c[2] / 255, 1)), 1
)
)
)

0 comments on commit ac0dd44

Please sign in to comment.