Skip to content
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

NodeMaterial: CubeTexture WebGPU and WebGL #23743

Merged
merged 16 commits into from
Mar 21, 2022
Merged

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Mar 18, 2022

Description

This PR added support for CubeTextureNode in WebGPU and WebGL.

WebGPU Cube Texture Mipmaps Generating Approach

Initially I copy the image to the texture on the face z=0, mipLevel=0 of the cube like a Texture 2D, then I generate all the mipmaps starting from this face for the other faces in a decreasing way 5 .. 0 and 0 .. mipLevelCount until fill the 5 faces. On the last face of the cube I start the mipLevelOffset at 1: 1 .. mipLevelCount because 0 would already be the correct face of the cube and no longer a temporary one. See here.

Live examples

WebGPU
https://raw.githack.com/sunag/three.js/dev-cubemap/examples/webgpu_instance_uniform.html

WebGL
https://raw.githack.com/sunag/three.js/dev-cubemap/examples/webgl_materials_instance_uniform_nodes.html

image

Updates

Fixes

This contribution is funded by Google via Igalia.

@sunag sunag marked this pull request as draft March 18, 2022 04:01
@sunag sunag marked this pull request as ready for review March 18, 2022 04:18
@mrdoob mrdoob added this to the r139 milestone Mar 21, 2022
@mrdoob mrdoob merged commit 70b9ae8 into mrdoob:dev Mar 21, 2022
@mrdoob
Copy link
Owner

mrdoob commented Mar 21, 2022

Thanks!

@sunag sunag deleted the dev-cubemap branch March 21, 2022 20:30
abernier pushed a commit to abernier/three.js that referenced this pull request Sep 16, 2022
* fix camera ref

* add viewMatrix, cameraPosition and cleanup

* fi texture parameter

* add getCubeTexture() and bias API update

* WebGLNodeBuilder: update bias API

* fix refresh uniforms of shared materials

* add WebGPUNodeSampledCubeTexture

* WebGPURenderer: CubeTexture support

* TextureNode: update bias API

* add CubeTextureNode and ReflectNode

* update examples

* Revert "WebGPURenderer: CubeTexture support"

This reverts commit 6c62b26.

* Revert "Revert "WebGPURenderer: CubeTexture support""

This reverts commit 4498f37.

* fix default value of baseArrayLayer

* CubeTextureNode instanceof of TextureNode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants