Skip to content

Commit

Permalink
Fix glTF metalness and roughness map orientation (#532)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 authored Aug 31, 2023
1 parent 6e2444f commit e18906b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions graphics/src/AssimpLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,13 @@ std::pair<ImagePtr, ImagePtr>
std::vector<unsigned char> metalnessData(width * height * bytesPerPixel);
std::vector<unsigned char> roughnessData(width * height * bytesPerPixel);

for (unsigned int x = 0; x < width; ++x)
for (unsigned int y = 0; y < height; ++y)
{
for (unsigned int y = 0; y < height; ++y)
for (unsigned int x = 0; x < width; ++x)
{
// RGBA so 4 bytes per pixel, alpha fully opaque
auto baseIndex = bytesPerPixel * (x * height + y);
auto color = _img.Pixel(x, y);
auto baseIndex = bytesPerPixel * (y * width + x);
auto color = _img.Pixel(x, (height - y - 1));
metalnessData[baseIndex] = color.B() * 255.0;
metalnessData[baseIndex + 1] = color.B() * 255.0;
metalnessData[baseIndex + 2] = color.B() * 255.0;
Expand Down

0 comments on commit e18906b

Please sign in to comment.