Skip to content

Commit 9ca5489

Browse files
patricklabatutfacebook-github-bot
authored andcommitted
Fix spelling of "Gouraud"
Summary: Fix spelling of *Gouraud* in [Gouraud shading](https://en.wikipedia.org/wiki/Gouraud_shading). Reviewed By: nikhilaravi Differential Revision: D19943547 fbshipit-source-id: 5c016b7b051a7b33a7b68ed5303b642d9e834bbd
1 parent f0dc651 commit 9ca5489

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

docs/notes/renderer_getting_started.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,18 @@ Shaders are the most flexible part of the PyTorch3D rendering API. We have creat
9191

9292
A shader can incorporate several steps:
9393
- **texturing** (e.g interpolation of vertex RGB colors or interpolation of vertex UV coordinates followed by sampling from a texture map (interpolation uses barycentric coordinates output from rasterization))
94-
- **lighting/shading** (e.g. ambient, diffuse, specular lighting, Phong, Gourad, Flat)
94+
- **lighting/shading** (e.g. ambient, diffuse, specular lighting, Phong, Gouraud, Flat)
9595
- **blending** (e.g. hard blending using only the closest face for each pixel, or soft blending using a weighted sum of the top K faces per pixel)
9696

9797
We have examples of several combinations of these functions based on the texturing/shading/blending support we have currently. These are summarised in this table below. Many other combinations are possible and we plan to expand the options available for texturing, shading and blending.
9898

9999

100-
|Example Shaders | Vertex Textures| Texture Map| Flat Shading| Gourad Shading| Phong Shading | Hard blending | Soft Blending |
100+
|Example Shaders | Vertex Textures| Texture Map| Flat Shading| Gouraud Shading| Phong Shading | Hard blending | Soft Blending |
101101
| ------------- |:-------------: | :--------------:| :--------------:| :--------------:| :--------------:|:--------------:|:--------------:|
102102
| HardPhongShader | :heavy_check_mark: |||| :heavy_check_mark: | :heavy_check_mark:||
103103
| SoftPhongShader | :heavy_check_mark: |||| :heavy_check_mark: | | :heavy_check_mark:|
104-
| HardGouradShader | :heavy_check_mark: ||| :heavy_check_mark: || :heavy_check_mark:||
105-
| SoftGouradShader | :heavy_check_mark: ||| :heavy_check_mark: ||| :heavy_check_mark:|
104+
| HardGouraudShader | :heavy_check_mark: ||| :heavy_check_mark: || :heavy_check_mark:||
105+
| SoftGouraudShader | :heavy_check_mark: ||| :heavy_check_mark: ||| :heavy_check_mark:|
106106
| TexturedSoftPhongShader || :heavy_check_mark: ||| :heavy_check_mark: || :heavy_check_mark:|
107107
| HardFlatShader | :heavy_check_mark: || :heavy_check_mark: ||| :heavy_check_mark:||
108108
| SoftSilhouetteShader ||||||| :heavy_check_mark:|

pytorch3d/renderer/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
from .materials import Materials
1919
from .mesh import (
2020
HardFlatShader,
21-
HardGouradShader,
21+
HardGouraudShader,
2222
HardPhongShader,
2323
MeshRasterizer,
2424
MeshRenderer,
2525
RasterizationSettings,
26-
SoftGouradShader,
26+
SoftGouraudShader,
2727
SoftPhongShader,
2828
SoftSilhouetteShader,
2929
TexturedSoftPhongShader,
30-
gourad_shading,
30+
gouraud_shading,
3131
interpolate_face_attributes,
3232
interpolate_texture_map,
3333
interpolate_vertex_colors,

pytorch3d/renderer/mesh/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
from .renderer import MeshRenderer
66
from .shader import (
77
HardFlatShader,
8-
HardGouradShader,
8+
HardGouraudShader,
99
HardPhongShader,
10-
SoftGouradShader,
10+
SoftGouraudShader,
1111
SoftPhongShader,
1212
SoftSilhouetteShader,
1313
TexturedSoftPhongShader,
1414
)
15-
from .shading import gourad_shading, phong_shading
15+
from .shading import gouraud_shading, phong_shading
1616
from .texturing import ( # isort: skip
1717
interpolate_face_attributes,
1818
interpolate_texture_map,

pytorch3d/renderer/mesh/shader.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from ..cameras import OpenGLPerspectiveCameras
1515
from ..lighting import PointLights
1616
from ..materials import Materials
17-
from .shading import flat_shading, gourad_shading, phong_shading
17+
from .shading import flat_shading, gouraud_shading, phong_shading
1818
from .texturing import interpolate_texture_map, interpolate_vertex_colors
1919

2020
# A Shader should take as input fragments from the output of rasterization
@@ -126,7 +126,7 @@ def forward(self, fragments, meshes, **kwargs) -> torch.Tensor:
126126
return images
127127

128128

129-
class HardGouradShader(nn.Module):
129+
class HardGouraudShader(nn.Module):
130130
"""
131131
Per vertex lighting - the lighting model is applied to the vertex colors and
132132
the colors are then interpolated using the barycentric coordinates to
@@ -138,7 +138,7 @@ class HardGouradShader(nn.Module):
138138
139139
.. code-block::
140140
141-
shader = HardGouradShader(device=torch.device("cuda:0"))
141+
shader = HardGouraudShader(device=torch.device("cuda:0"))
142142
"""
143143

144144
def __init__(self, device="cpu", cameras=None, lights=None, materials=None):
@@ -159,7 +159,7 @@ def forward(self, fragments, meshes, **kwargs) -> torch.Tensor:
159159
cameras = kwargs.get("cameras", self.cameras)
160160
lights = kwargs.get("lights", self.lights)
161161
materials = kwargs.get("materials", self.materials)
162-
pixel_colors = gourad_shading(
162+
pixel_colors = gouraud_shading(
163163
meshes=meshes,
164164
fragments=fragments,
165165
lights=lights,
@@ -170,7 +170,7 @@ def forward(self, fragments, meshes, **kwargs) -> torch.Tensor:
170170
return images
171171

172172

173-
class SoftGouradShader(nn.Module):
173+
class SoftGouraudShader(nn.Module):
174174
"""
175175
Per vertex lighting - the lighting model is applied to the vertex colors and
176176
the colors are then interpolated using the barycentric coordinates to
@@ -182,7 +182,7 @@ class SoftGouradShader(nn.Module):
182182
183183
.. code-block::
184184
185-
shader = SoftGouradShader(device=torch.device("cuda:0"))
185+
shader = SoftGouraudShader(device=torch.device("cuda:0"))
186186
"""
187187

188188
def __init__(
@@ -213,7 +213,7 @@ def forward(self, fragments, meshes, **kwargs) -> torch.Tensor:
213213
cameras = kwargs.get("cameras", self.cameras)
214214
lights = kwargs.get("lights", self.lights)
215215
materials = kwargs.get("materials", self.materials)
216-
pixel_colors = gourad_shading(
216+
pixel_colors = gouraud_shading(
217217
meshes=meshes,
218218
fragments=fragments,
219219
lights=lights,

pytorch3d/renderer/mesh/shading.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def phong_shading(
7979
return colors
8080

8181

82-
def gourad_shading(
82+
def gouraud_shading(
8383
meshes, fragments, lights, cameras, materials
8484
) -> torch.Tensor:
8585
"""

tests/test_rendering_meshes.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from pytorch3d.renderer.mesh.renderer import MeshRenderer
2626
from pytorch3d.renderer.mesh.shader import (
2727
BlendParams,
28-
HardGouradShader,
28+
HardGouraudShader,
2929
HardPhongShader,
3030
SoftSilhouetteShader,
3131
TexturedSoftPhongShader,
@@ -51,7 +51,7 @@ def load_rgb_image(filename, data_dir=DATA_DIR):
5151
class TestRenderingMeshes(unittest.TestCase):
5252
def test_simple_sphere(self, elevated_camera=False):
5353
"""
54-
Test output of phong and gourad shading matches a reference image using
54+
Test output of phong and gouraud shading matches a reference image using
5555
the default values for the light sources.
5656
5757
Args:
@@ -128,32 +128,32 @@ def test_simple_sphere(self, elevated_camera=False):
128128
self.assertTrue(torch.allclose(rgb, image_ref_phong_dark, atol=0.05))
129129

130130
######################################
131-
# Change the shader to a GouradShader
131+
# Change the shader to a GouraudShader
132132
######################################
133133
lights.location = torch.tensor([0.0, 0.0, -2.0], device=device)[None]
134134
renderer = MeshRenderer(
135135
rasterizer=rasterizer,
136-
shader=HardGouradShader(
136+
shader=HardGouraudShader(
137137
lights=lights, cameras=cameras, materials=materials
138138
),
139139
)
140140
images = renderer(sphere_mesh)
141141
rgb = images[0, ..., :3].squeeze().cpu()
142142
if DEBUG:
143143
Image.fromarray((rgb.numpy() * 255).astype(np.uint8)).save(
144-
DATA_DIR / "DEBUG_simple_sphere_light_gourad%s.png" % postfix
144+
DATA_DIR / "DEBUG_simple_sphere_light_gouraud%s.png" % postfix
145145
)
146146

147147
# Load reference image
148-
image_ref_gourad = load_rgb_image(
149-
"test_simple_sphere_light_gourad%s.png" % postfix
148+
image_ref_gouraud = load_rgb_image(
149+
"test_simple_sphere_light_gouraud%s.png" % postfix
150150
)
151-
self.assertTrue(torch.allclose(rgb, image_ref_gourad, atol=0.005))
151+
self.assertTrue(torch.allclose(rgb, image_ref_gouraud, atol=0.005))
152152
self.assertFalse(torch.allclose(rgb, image_ref_phong, atol=0.005))
153153

154154
def test_simple_sphere_elevated_camera(self):
155155
"""
156-
Test output of phong and gourad shading matches a reference image using
156+
Test output of phong and gouraud shading matches a reference image using
157157
the default values for the light sources.
158158
159159
The rendering is performed with a camera that has non-zero elevation.

0 commit comments

Comments
 (0)