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

New texture formats: R8 and RG8 #6602

Merged
merged 3 commits into from
May 23, 2024
Merged

New texture formats: R8 and RG8 #6602

merged 3 commits into from
May 23, 2024

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented May 23, 2024

  • exposed two new texture formats: PIXELFORMAT_R8 and PIXELFORMAT_RG8
  • both of these are supported on both WebGL2 and WebGPU, and are renderable
  • these are a replacement for PIXELFORMAT_L8 and PIXELFORMAT_LA8 that are WebGL only and not renderable
  • the old formats are kept for compatibility reason, as their behaviour is slightly different vs new formats (R is not automatically replicated into RGB when sampling and similar)
Co-authored-by: Will Eastcott <will@playcanvas.com>
@willeastcott
Copy link
Contributor

So should we deprecate L8 and LA8? Or alias them to R and RG?

@mvaligursky
Copy link
Contributor Author

So should we deprecate L8 and LA8? Or alias them to R and RG?

We could deprecate them (hide the docs). I won't move that to deprecated as that needs a cleanup first.
Aliasing is not ideal (I started with that), as their behaviour is different.

@Maksims
Copy link
Contributor

Maksims commented May 23, 2024

So should we deprecate L8 and LA8? Or alias them to R and RG?

LA8 format can be used by WebXR Depth Sensing as it can provide depth information either in R32F or LA8 formats.

@mvaligursky
Copy link
Contributor Author

So should we deprecate L8 and LA8? Or alias them to R and RG?

LA8 format can be used by WebXR Depth Sensing as it can provide depth information either in R32F or LA8 formats.

Yep, exactly the reason I didn't just remove it, as I've seen it used there. Does it support RB8 format by the way?

@mvaligursky
Copy link
Contributor Author

It seems from the WebXR API we just get a typed array .. so I guess internally at some point we can switch this to use RG texture format, to be eventually compatible with WebGPU when XR is there. But for now this should still just work.

@mvaligursky mvaligursky requested review from willeastcott and a team May 23, 2024 14:38
@mvaligursky mvaligursky merged commit 60f7faa into main May 23, 2024
8 checks passed
@mvaligursky mvaligursky deleted the mv-new-texture-formats branch May 23, 2024 15:24
@Maksims
Copy link
Contributor

Maksims commented May 23, 2024

It seems from the WebXR API we just get a typed array .. so I guess internally at some point we can switch this to use RG texture format, to be eventually compatible with WebGPU when XR is there. But for now this should still just work.

There are two paths: one is CPU that provides data as a buffer, that we use to construct a texture.
Or second path is GPU accelerated (e.g. Quest 3) that currently provides texture as R32F, but specs state that it can be LA8.

marklundin pushed a commit that referenced this pull request May 31, 2024
* New texture formats: R8 and RG8

* Apply suggestions from code review

Co-authored-by: Will Eastcott <will@playcanvas.com>

* deprecate the old constants

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
@Maksims
Copy link
Contributor

Maksims commented Jun 3, 2024

Unfortunately, removal of LA8 did break depth sensing for mobile.

@mvaligursky
Copy link
Contributor Author

Unfortunately, removal of LA8 did break depth sensing for mobile.

Ah thank's for the update. I changed my mind during the PR lifetime and only deprecated those formats, but I see I failed to change back two lines, making these deprecated formats unusable. Following PR will fix it.

@mvaligursky
Copy link
Contributor Author

done here now #6649 @Maksims

marklundin added a commit that referenced this pull request Jun 18, 2024
* refactored script type

* removed attribute check on esm scripts

* linting fixes

* Delete redundant scripts

* Remove engines field from package-lock.json

* Fix event name in ScriptType class

* Add export to rawToValue function and update script schema in ScriptHandler

* linting

* Update script attribute assignment in ScriptComponent

* Fix script initialization and enablement

* Fix missing semicolon in ScriptRegistry class

* Refactor script component and handler

* GS reorder fix (#6410)

* USDZ / GLTF exporter supports exposing of compressed textures on WebGPU (#6394)

* Support for Picker on WebGPU

* Gizmos example on webgpu

* USDZ / GLTF exporter supports exposing of compressed textures on WebGPU

* tiny comment update

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>

* restore default color when setting axis shape disable to false (#6587)

* [Fix] Add missing exposure handling from the Neutral tonemapping (#6592)

* SSAO engine example (#6586)

* SSAO engine example

* lint

* draco + texture resize: 17MB -> 6MB

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>

* [BREAKING] Removed backwards compatibility for few functions (#6408)

* [BREAKING] Removed backwards compatibility for few functions

* lint

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>

* Examples app bundle optimizations (#6588)

* treeshake smallest enabled

* ignore playcanvas PCUI from being treeshaken

* treeshake ignore only pcui

* added device type constants directly (no playcanvas dependency)

* format rollup

* word wrap fix

* Updated PCUI

* removed PCUI aliasing

* Fix to just submitted AO example to disabled baked in occlusion maps (#6593)

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>

* added publint to ci; removed build:publish (#6363)

* Fix types for calcAabb functions (#6596)

* vercel setup (#6600)

* replaces slashes for windows (#6601)

* fixed using query params with iframe example (#6604)

* New texture formats: R8 and RG8 (#6602)

* New texture formats: R8 and RG8

* Apply suggestions from code review

Co-authored-by: Will Eastcott <will@playcanvas.com>

* deprecate the old constants

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>

* Added orthogonal facing translation to gizmo (#6607)

* set shader chunk type to record (#6621)

* Gizmo example update (#6622)

* separated out grid code

* split out selector and disabled deselection on orbiting

* added type for observer set callback

* fixed example page

* Exports and types fixes (#6623)

* cleaned up ts and js config; adds debug and profiler to exports

* set module resolution to node

* added package json for linting of example modules and renamed @examples to examples

* PR commit (#6626)

* fixed fallback options (#6628)

* fixed example types (#6634)

* fixed selection bug (#6637)

* Fix URL handling in ScriptHandler (#6639)

* Fix mesh collider creation (#6630)

* Docs update (#6631)

* docs update

* Update README.md

---------

Co-authored-by: Will Eastcott <willeastcott@gmail.com>

* Update script component to use getSchema method instead of tSchema

* Refactor script component attribute initialization

* merge fix

* linting

* Update import statement in script.js

* Refactor script attribute assignment

* linting

* Refactor script component initialization

* Refactor script component and script handler

* linting + comments

* Fix the definition of sheenTint Standard Material property (#6665)

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>

* Update to skybox shader to map it closer to the infinity (#6664)

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>

* [Fix] Particle system handle different IB formats of incoming mesh (#6662)

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>

* [BREAKING] Remove deprecated AudioSourceComponent component (#6407)

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>

* Cubemap fix for webgpu (#6669)

* [BREAKING] Remove support for legacy scripts (#6584)

* [BREAKING] Remove support for legaxy scripts

* removed pc.script.attribute

---------

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>

* Fix shader chunk error for tonemapped compressed GS (#6670)

* Remove support for legacy scripts

* Remove legacy script system

* Add getScriptName function and toLowerCamelCase utility function

* jsdoc improvements

* Update src/framework/script/script.js

Co-authored-by: Will Eastcott <will@playcanvas.com>

* Update src/framework/script/script-attributes.js

Co-authored-by: Will Eastcott <will@playcanvas.com>

* linting + feedback

* Update src/framework/script/script.js

Co-authored-by: Will Eastcott <will@playcanvas.com>

* removed redundant error link

* Update src/framework/script/script.js

Co-authored-by: Will Eastcott <will@playcanvas.com>

* Update src/framework/script/script.js

Co-authored-by: Will Eastcott <will@playcanvas.com>

* Update src/framework/script/script.js

Co-authored-by: Will Eastcott <will@playcanvas.com>

* Update src/framework/script/script-attributes.js

Co-authored-by: Will Eastcott <will@playcanvas.com>

* Update src/framework/script/script-type.js

Co-authored-by: Will Eastcott <will@playcanvas.com>

* Update src/framework/components/script/component.js

Co-authored-by: Will Eastcott <will@playcanvas.com>

* Refactor attributeToValue function

---------

Co-authored-by: Donovan Hutchence <slimbuck7@gmail.com>
Co-authored-by: Martin Valigursky <59932779+mvaligursky@users.noreply.github.com>
Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
Co-authored-by: KPal <48248865+kpal81xd@users.noreply.github.com>
Co-authored-by: Will Eastcott <will@playcanvas.com>
Co-authored-by: kpal81xd <kpal81xd@gmail.com>
Co-authored-by: Alex <LeXXik@users.noreply.github.com>
Co-authored-by: Will Eastcott <willeastcott@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue enhancement
3 participants