AcademySoftwareFoundation / AcademySoftwareFoundation/MaterialX

Unlit h/w code optimization does not work with definitions

Open
#1,203 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.3k
Forks
451
Avg merge
6d 6h
Merged PRs (30d)
5

Description

There is an optimization to avoid emitting lighting fragments for h/w code generation

* if an "unlit" surfaceshader is defected does not work if the shader is inside a definition.
It will always omit lighting.
* Also the environment lighting information never performs any check so is always included
though unused.
* Finally for unit tests which empty out the direct lighting list, this results in a strange situation where
you emit the direct lighting code but not the maximum number of lights uniform.

Seems in part that the GLSL code has a requiresLighting() logic that is only used in one place but not others.

Example:
```xml




















```

Contributor guide

Open the contributing guide

Research direction

Start by tracing the GLSL requiresLighting() logic and the hardware code-generation path for surfaces inside definitions, using the XML example to compare both cases. Check how direct lighting, environment lighting, and the maximum-lights uniform are emitted, then add or run unit coverage showing that unused lighting fragments and uniforms are omitted consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
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.