Skip to content

OSL implementation of transformmatrix vector3M4 variant ignores translation #2833

@jstone-lucasfilm

Description

@jstone-lucasfilm

The OSL implementation of the vector3M4 variant of transformmatrix treats the input as a direction (w=0), ignoring the translation component of the matrix:

https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx#L501

The GLSL and MDL implementations correctly treat it as a point (w=1), which includes translation:

https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/stdlib/genglsl/mx_transformmatrix_vector3M4.glsl
https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/source/MaterialXGenMdl/mdl/materialx/stdlib_1_6.mdl#L2302

The OSL implementation is also inconsistent with its corresponding vector2M3 variant, which correctly casts to point to include translation:

https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/stdlib/genosl/mx_transformmatrix_vector2M3.osl

One proposed fix would be the following:

sourcecode="transform({{mat}}, point({{in}}))"

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions