AcademySoftwareFoundation / AcademySoftwareFoundation/MaterialX
ImageSamplingProperties::setProperties does not handle sampler properties set at different levels of the call chain
- Dominant language
- C++
- Stars
- 2.3k
- Forks
- 451
- Avg merge
- 6d 6h
- Merged PRs (30d)
- 5
Description
When uaddressmode/vaddressmode are set at a different level of the call chain, the ImageSamplingProperties::setProperties code can not find the appropriate sampling parameters for a given texture.
setProperties is written assuming that the sampling parameters and filename are set at the same place in a MaterialX material, as it uses the root prefix of the texture filename's uniform to identify the where to pull uaddressmode, vaddressmode and filtertype inputs from. This breaks easily in cases where the filename is not hardcoded in the image node and passed in from a nodedef interface:
```
```
If you load the above material in MaterialXView in a GPU debugger such as RenderDoc, you will see that the wrap mode is set to 'Repeat' instead of 'Clamp' for image_color_file.

It's not obvious to me, in the general case, how one is supposed to correctly extract sampler properties from a MaterialX material - in most realtime renderering APIs these need to be set on the CPU side, not in the shader itself.
Contributor guide
Research direction
Start at ImageSamplingProperties::setProperties and reproduce the issue with the XML material shown in the report, using MaterialXView and a GPU debugger such as RenderDoc. Trace how sampler inputs are resolved when the filename comes through a nodedef interface; done means image_color_file receives the declared Clamp wrap mode rather than Repeat.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100