Extra shader types

Is there a technical reason for why there is no int, bool, vec2, vec3 or even arrays to set in .material and set like we can with vec4s? Or just not given priority?

2 Likes

Good question! @jhonny.goransson?

2 Likes

Technically, almost all uniform types are universally supported across GL versions except a few unsigned variants that require GL3+ so I’m guessing it is related to our internal implementation. I don’t really know the original design behind the material system unfortunately, but maybe @sven knows more. Personally, I would want to expand the user uniform type to be able to represent other data types such as the ones you mentioned. Setting a custom matrix for example, requires you to set all rows or columns as four different user constants.

Is there anything specific you want to do that is impossible with the current design, or is it just an annoyance/curiosity?

6 Likes

Arrays would be the the biggest breakthrough in usefulness, but mostly it’s annoying using vec4s for everything and not being able to label things properly.

4 Likes

Compared to Unity, Defold provides much less flexibility for the shaders. We need better vertex support (tangent), better runtime material manipulation to preserve batching and better input values for the shaders.

5 Likes