Jump to content

WebGL2 sampler2DArray


AlexB
 Share

Recommended Posts

One of the killer new features in WebGL2 is the "sampler2DArray" uniform type. Apparently, we can use it to:

 

Quote

Texture arrays

A texture array is very similar to a 3D texture except that each slice is considered a separate texture. All the slices have to be the same size but this is a great way to give a shader access to hundreds of textures even though it only has a relatively small number of texture units. You can select the slice in your shader

EX: vec4 color = texture(someSampler2DArray, vec3(u, v, slice));

This would be a game changer for a project I'm working on, as it uses a shader which needs many textures as uniforms and we're hitting the limit regularly. Any thoughts on implementing this feature?

Link to comment
Share on other sites

1 minute ago, Deltakosh said:

We will :) But if you feel ok to implement it, please do:)

 

We could look into it. Can you give a little clue into where that would happen in the code? The current project is using ThreeJS but this could be the reason to switch :-)

Link to comment
Share on other sites

If webgl2 is supported (check engine.webGLVersion), you should do something like this:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Materials/babylon.effect.ts

and also update (and do the actual call) inside engine like here:

https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.engine.ts#L3669

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...