-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introducing THREE.Image #17766
Comments
What would be the goals of this change? From the issues attached I see two:
For (1), adding material1.color = new TextureNode( texture, uvNode1 );
material2.color = new TextureNode( texture, uvNode2 ); For (2), I'm not sure whether UniformsUtils really needs to clone textures, or could just copy by reference. I don't have an opinion for or against this change yet, just trying to understand the goal and whether the additional abstraction is the right solution. |
The goal is to solve both issues. When cloning a texture, |
Is the intention to use this to map to the separate texture and sampler objects provided by WebGL2. This would seem a logical extension. |
Actually, WebGL 2 was not considered so far. And I think it's at the beginning not important. The main goal is a better management of internal |
Related: #12497. |
BabylonJS seems to have a similar class for this: https://doc.babylonjs.com/api/classes/babylon.internaltexture Their baseTexture (base class for their texture class) stores an InternalTexture and InternalTexture has references to the direct webGL buffers so the InternalTexture can be shared between different textures and use the same buffers. |
Thanks for this pointer. Indeed, ideally |
Will certain parameters be moved into |
Hello from pixi.js! https://github.com/pixijs/pixi.js/tree/dev/packages/core/src/textures BaseTexture, always was there.
While you are at it, you can also look at our brand-new v5 resource system - texture upload is separated. Example: https://pixijs.io/examples/#/textures/gradient-resource.js . Standard ones are ImageBitmap/HTMLImageElement/HTMLCanvasElement , users can implement their own , call texImage2D from the overriden method, set up extra params in BaseTexture. I use it for texture generation, partial uploading, runtime atlases. It was very difficult to rewrite texture subsystem and to pass reviews of whole team. Its really 2-year experience, I recommend you to look at it to save the time. |
Yeah, I've realized this when I've hacked around at this topic last year 😞 . Thanks for the input though! |
That's why I suggest to look more first before you start it. I gave you more reason to try that refactoring =) texture -> baseTexture |
|
Moved the discussion from #5728 to a separate issue.
The idea is to add
THREE.Image
as an additional class which is used byTHREE.Texture
. An instance ofTHREE.Image
is directly mapped to an instance ofWebGLTexture
(the raw WebGL texture object). That means multiple textures can refer to the same instance ofTHREE.Image
and not causing redundant texture uploads anymore (related issues #5728, #5821, #7223)Ideally,
THREE.Image
will make the handling of image objects transparent (e.g. the difference inHTMLImageElement
,ImageBitmap
or the image stub inDataTexture
is encapsulated in this new class).The text was updated successfully, but these errors were encountered: