Skip to content

Commit

Permalink
Parameterize enable_face_culling in interpolation unit test.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 365626038
  • Loading branch information
podlipensky authored and Copybara-Service committed Mar 29, 2021
1 parent e2f6455 commit 27f0e67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tensorflow_graphics/rendering/tests/interpolate_test.py
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
"""Tests for tensorflow_graphics.rendering.tests.interpolate."""

from absl.testing import parameterized
import tensorflow as tf

from tensorflow_graphics.rendering import interpolate
Expand Down Expand Up @@ -49,24 +50,26 @@ def setUp(self):
# Add batch dimension.
self.projection = tf.expand_dims(projection, axis=0)

def test_renders_colored_cube(self):
@parameterized.parameters(True, False)
def test_renders_colored_cube(self, enable_cull_face):
"""Renders a simple colored cube."""
num_layers = 1
rasterized = rasterization_backend.rasterize(
self.cube_vertex_positions,
self.cube_triangles,
self.projection, (self.image_width, self.image_height),
num_layers=num_layers,
enable_cull_face=False,
enable_cull_face=enable_cull_face,
backend=rasterization_backend.RasterizationBackends.CPU)

vertex_rgb = (self.cube_vertex_positions * 0.5 + 0.5)
vertex_rgba = tf.concat([vertex_rgb, tf.ones([1, 8, 1])], axis=-1)
rendered = interpolate.interpolate_vertex_attribute(vertex_rgba,
rasterized).value

face_culling_num = 1 if enable_cull_face else 0
baseline_image = rasterization_test_utils.load_baseline_image(
'Unlit_Cube_0_0.png', rendered.shape)
'Unlit_Cube_0_%d.png' % face_culling_num, rendered.shape)

images_near, error_message = rasterization_test_utils.compare_images(
self, baseline_image, rendered)
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 27f0e67

Please sign in to comment.