Coder Social home page Coder Social logo

Comments (5)

gkjohnson avatar gkjohnson commented on May 23, 2024 1

The solution is using the same approach like in WebGLCubeRenderTarget. Meaning applying the options to the newly created texture.

this.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );

I'm wondering if it would be nice to have a texture.setValues (or other name) function the way Material has so setting these options is a bit more readable.

from three.js.

gkjohnson avatar gkjohnson commented on May 23, 2024 1

I wonder if we should just redefine the configuration options of both WebGL3DRenderTarget and WebGLArrayRenderTarget

My preference would be to not break a bunch of usages of WebGLRenderTarget for such a minor superficial change.

I've noticed something confusing. E.g. the default value of the minFilter option in the RenderTarget class is LinearFilter. DataArrayTexture however uses NearestFilter.

If we add something like a setValues function it's fairly easy to default these to the expected LinearFilter value:

this.texture = new DataTexture( null, width, height, depth )
this.texture.setValues( {
  minFilter: LinearFilter,
  magFilter: LinearFilter,
  ...options
} );

from three.js.

Mugen87 avatar Mugen87 commented on May 23, 2024

This is because of the following line:

this.texture = new DataArrayTexture( null, width, height, depth );

Meaning the texture reference is redefined with a new instance. WebGL3DRenderTarget has the same issue.

The solution is using the same approach like in WebGLCubeRenderTarget. Meaning applying the options to the newly created texture.

from three.js.

Mugen87 avatar Mugen87 commented on May 23, 2024

I've noticed something confusing. E.g. the default value of the minFilter option in the RenderTarget class is LinearFilter. DataArrayTexture however uses NearestFilter. If we would reuse the same default parameter preset for all type of render targets, we end up with misconfigured internal textures.

WebGL3DRenderTarget and WebGLArrayRenderTarget both rely on data textures so it seems both need a different preset for default options.

from three.js.

Mugen87 avatar Mugen87 commented on May 23, 2024

I wonder if we should just redefine the configuration options of both WebGL3DRenderTarget and WebGLArrayRenderTarget. When we added Data3DTexture and DataArrayTexture, we decided to avoid the large ctor signature known from Texture. So if we just decide to decrease the number of properties you can set it options, we wouldn't have to change anything. Devs are then required to do this:

target = new THREE.WebGLArrayRenderTarget( 1, 1, 1 );
target.texture.wrapS === THREE.RepeatWrapping;

instead of

target = new THREE.WebGLArrayRenderTarget( 1, 1, 1, { wrapS: THREE.RepeatWrapping } );

from three.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.