-
Notifications
You must be signed in to change notification settings - Fork 272
Open
Open
Copy link
Labels
GraphicsGraphical featureGraphical feature
Description
Problem this feature should fix
Right now when a texture isn't provided on a material, a default texture is attached instead.
- 2D texture: white pixel (255, 255, 255, 255)
- Cubemap texture: black pixel (0, 0, 0, 0) for each face
Expected solution
We should implement a system to provide more options to shaders to choose what the default "no-texture set" behaviour should be.
We could either:
- Not provide any texture, and let the shader check if a texture is passed using
textureQueryLod()
. IftextureQueryLod()
returns 0, no texture is bound, so a backup color/behaviour can be selected. - Let shader uniforms specify what type of default texture they require (similar to unity, were properties can define the color of the default texture):
_MainTex("Texture",2D)="white"{}
.
It could look like:
uniform sampler2D albedo; [default = "white"]
I'm leaning toward using textureQueryLod()
, since the overhead should be minimal, and would give more control to the user. With the other method, we would need to define a fixed set of preset textures, while using textureQueryLod
will let the user choose anything, or even branch out and skip a code-block completely. This would also reduce the amount of textures binds, which could potentially improve performance.
Edit: I think we should look into bindless textures!
Metadata
Metadata
Assignees
Labels
GraphicsGraphical featureGraphical feature