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

add SPLAT decoder to be able to encode .splat files to .drc files #1097

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

patrikant
Copy link

@patrikant patrikant commented Mar 7, 2025

I am using SPLAT files in addition to ply files. Currently, this datatype is not supported by the Draco library. A few months ago, I raised an issue regarding this topic (#1082), and there is another one concerning Gaussian splatting (#1020).

I am aware that SPLAT files are not standardized yet. This version accepts SPLAT files with the following attributes:

struct Gaussian {
	float position[3];
	float scale[3];
	uint8_t color[4];
	uint8_t rotation[4];
}; 

I attempted to encode the scale and rotation attributes as GeometryAttribute::GENERIC or custom attributes. However, I encountered some issues with the draco web loader in viewing these attributes. The two "new" attributes could not be decoded correctly. As a result, I am encoding position and scale together, as well as color and rotation. The implementation works perfectly for me.

Some examples for the compression using CL 10 and QP 11:
SPLAT file with 33MB -> DRC file with 10MB
SPLAT file with 4.6MB -> DRC file with 1.4MB
SPLAT file with 10MB -> DRC file with 3MB

Copy link

google-cla bot commented Mar 7, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@waveviewer
Copy link

Following this PR, I compressed a splat file from 187M to 41M. Could you provide the code for decoding the DRC back to splat? Thanks! @patrikant

@patrikant
Copy link
Author

patrikant commented Mar 9, 2025

Could you provide the code for decoding the DRC back to splat?

@waveviewer I do not need a local Draco decoder to decode DRC to Splat. So, I haven't customized these files yet, unfortunately. If it's necessary for this PR to be included in the next build, I can do it.
I am using the DRC files solely to view them in a WebGL viewer. I utilize a custom function from DracoLoader.js. Since they deprecated the function for using custom attributes to decode the geometry (dracoLoader.load is deprecated, so dracoLoader.decodeGeometry only uses the standard attributes), I don't know why this decision was made...
The decoded geometry is then utilized with a SplatLoader to be added to the scene.

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.

2 participants