-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Add THREE.CubemapGenerator #15331
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
Add THREE.CubemapGenerator #15331
Conversation
|
I also think |
|
Would be great to see this promoted to the standard library and using |
|
Live equirectangular scene background: |
|
👍 to the API change and for this being promoted. This would run into the same leak as #15288 though, times 6 as its a CubeCamera. Saving the Scene and CubeCamera per CubemapGenerator instance and replacing the camera's |
|
@WestLangley AFAIK, there's no way to dispose the build up cache of WebGLState other than calling WebGLRenderer's dispose, but in my case, the renderer is still in use and do not want to dispose it. I don't know the background of caching WebGLState for every camera/scene pair, but maybe there's a way to render without storing the state, e.g.: renderer.autoSaveState = false
generator.fromEquirectangular(texture);
renderer.autoSaveState = true;Not an ideal API, but a combination of unexpected memory growth (it was a discovery to me that a new scene/camera trigger a new WebGLState to be permanently cached), as well as no way to clean up this state made this a particular difficult bug to track down. Fixing this in the renderer is probably the ideal long term fix, but not familiar enough with the WebGLState if that is something possible. |
This happens right now to ensure correct uniform data of lights (because some of these data are view dependent). |
|
Thanks! |
I'm not sure how this pattern would apply later to var options = {
generateMipmaps: true,
minFilter: THREE.LinearMipMapLinearFilter,
magFilter: THREE.LinearFilter
};
var background = new THREE.WebGLRenderTargetCube( 512, 512, options )
.fromEquirectangularTexture( renderer, texture );Hmm, we should rename However, I always thought that these objects could have a more render-like API... var mirror = new THREE.WebGLRenderBuffer( renderer );
mirror.setSize( width, height );
mirror.render( scene, camera );
var background = new THREE.WebGLCubeRenderBuffer( renderer );
background.setSize( width, height );
background.renderEquirectangularTexture( texture ); |
|
@mrdoob Maybe you did not understand my question... I am proposing that |
|
I was proposing turning |
|
I see. I'll file a new PR with your suggestion. :-) |
I'm not going to convert BTW: I was never a fan of the current API since the following line new THREE.CubemapGenerator( renderer ).fromEquirectangular( texture, options );is actually not consistent to the project's API style. A |
I have done that. I just haven't filed the PR yet. |
The intention is for this to replace
THREE.EquirectangularToCubeGenerator, but for now, the new class is simply added to the file.Usage is as follows:
This differs from the existing generator in that it does not modify the input
format,type, orencoding.I feel this is a much simpler API.
/ping @jsantell @richardmonette