KhronosGroup / KhronosGroup/glTF-Sample-Assets

Sponza model has smooth normals in the wrong places

Open
#50 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.1k
Forks
107
Avg merge
9h 39m
Merged PRs (30d)
4

Description

This is what the normal map looks like when using dynamically calculated triangle normals (i.e. flat shaded). (Unfortunately this is in sRGB and tone mapped so the colors are a bit off):

![image](https://github.com/KhronosGroup/glTF-Sample-Models/assets/22196124/a5e21e3c-622a-437f-86b8-1872bb2768bf)

However when interpolating the vertex models that are read from the file we can see that the drapes are smooth shaded (which is great), but so is the top of the pillar (see the blue and yellow diagonal stripes:

![image](https://github.com/KhronosGroup/glTF-Sample-Models/assets/22196124/1e8f0c31-359a-4636-936b-b51c43f43d72)

Another way of seeing this is by only showing normals that have their y component above some threshold (I believe it's ~0.98 here):

![image](https://github.com/KhronosGroup/glTF-Sample-Models/assets/22196124/ad152ee7-ddfa-4fa2-a68b-40dfef68772a)

I hope it's clear that those normals are not how there are supposed to be. The side effect can be observed in this render for my pathtracer where a black spot occurs because ray samples that do not satisfy `dot(outDir, surfaceNormal) > 0` are discarded:

![image](https://github.com/KhronosGroup/glTF-Sample-Models/assets/22196124/015e05b4-83a7-447d-8f95-4937da9c2a51)

The solution is to not share the vertex normals in some geometries. My only experience with tools like blender is using it as a file converter by importing and exporting as is so I was not able to fix it myself. Although I'm very motivated to help out in anyway possible.

Do note that this isssue occurs in multiple places, so far the complete list I've found is:

- [ ] The top of the pillars on the first floor
- [ ] The arches holding up the roof on the ground floor
- [ ] The base of the plant pots

Contributor guide

Open the contributing guide

Research direction

Start by opening the Sponza model in Blender and inspecting the listed locations: the first-floor pillar tops, ground-floor roof arches, and plant-pot bases. Check which vertices are sharing normals across hard edges, then verify the corrected model by inspecting the normals and rerendering the affected surfaces.

Written by the indexing model from the issue text.

Assessment

Tech stack
blender
Domain
computer-graphics, content
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.