-
Notifications
You must be signed in to change notification settings - Fork 2k
Implement support for CTBv4 and encrypted CTB files #10531
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
base: master
Are you sure you want to change the base?
Conversation
Looking forward to this :) |
I really hope this gets added soon! I would love to use prusia slicer instead of chitubox. |
Me too, I am really just waiting for someone to take a look at it. The past few changes have been bringing main branch changes over to this branch. |
@NickSica I love you, just bought a mars 3 as my first resin printer without knowing about all this anti-competitive/drm bs from chitubox. you are a life saver. |
Yeah I'm with you there I'm working slowly to allow people to get away from all the proprietary lock-in and outrageous slicer costs that resin printers have. At least it looks like Elegoo is moving slowly towards open source. |
I've attempted to build your patch but I'm getting the following error when tests are run
|
That is odd. I'll take a look when I'm back home. If there are any other detailed logs it'd help me look into it. |
I rebuilt it from scratch and didn't get these errors so if it's an actual issue. |
Mabye CI would help for cases like this? Just saying 😇 |
Sorry for the ignorance I'm relatively new to GitHub workflows past the basica. Isn't that something that Prusa would have to add to their repo? |
Yes, absolutely! That's what I meant. It's difficult for contributors to argue about whether something works on one computer or the other. If the repository had CI, that would be the criteria for "working" or "not working". |
I'm trying to build prusa slicer using an overlay in nix prusa-slicer_overlay = (self: super: {
prusa-slicer = super.prusa-slicer.overrideAttrs (prev: {
version = "git";
patches = [];
src = pkgs.fetchFromGitHub {
owner = "NickSica";
repo = "PrusaSlicer";
hash = "sha256-FnYT7ZHPl8SrJyitidg+RtIT9foGWHfcCgth3urac5k=";
rev = "master";
};
});
}); I had hoped it wasn't an issue with the package but it sounds like it |
Does it automatically run cmake and such following the build instructions in the repo? |
here is the package https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/applications/misc/prusa-slicer/default.nix the overlay should just swap out the sources. Is there a cmake flag missing? From what I could tell in the diff it doesn't seem like it. |
Yeah I'm not quite sure I was able to build using the flags that package has just fine on Arch. I've also never used nix so I'm unsure what else is going on. I also tried running that ctests in your error log, but it can't even seem to find tests in my build directory. |
so are ctests not running for you? there may be a cmake flag you have to pass to enable tests. |
I've built it with all the same cmake flags as the nix package. I think the nix package is explicitly running the ctests. I'll see if I can get them running but I'm not sure if Prusa even uses them. |
Has anyone tested this successfully? I have compiled the PR under Windows and Linux. |
Does UVTools open the file successfully? Or does it just not complain about it being encrypted(which is correct since I didn't implement the encryption portion) Can you also provide the stl and ctb files? It'll help me figure out what's wrong when I have some time.
|
Yeah, UVtools opens the file successfully I added the default cube from PrusaSlicer, so no stl, but I have uploaded the 3mf project, which also should contain the config (?). Hope this helps. Let me know if you need anything else. :-) Shape-Box_properties.zip (from UV tools) |
Huh this is weird since chitubox even opens the ctb file. I think you may be right about the magic number. |
Can you try the new changes I made? I also changed float_t to float to align with #11036 |
I'll give it a try. |
I honestly think that may be due to the build system setup. I've had to delete the build folders multiple times sometimes to get it to build correctly sometimes. |
Ok so my builds were failing until I added |
Sorry one more change adding EDIT: |
Okay, I managed to build PS again*. However, the printer still does not recognise the file. Shape-Box2.zip * by randomly running the manual steps and the build script, I haven't found a way to build it reliably on the first try. Edit:
Is it possible that the Mars 3 does not support unencrypted files? Edit2: |
|
Hey, it should be working now. Did you ever get the build with openssl working? |
I am still struggling to build the project (Windows). Oddly, I have no problems building a pure PrusaSlicer (without your changes). I can't tell you what the problem is at the moment. But I keep trying. 🤞 |
Did you pull the latest changes? What error are you getting? |
The build documentation says PrusaSlicer uses Visual Studio 2019, so using 2022-only features is very likely to be an issue. |
I mean Prusa has shown 0 interest in merging this to their repo so I was just adding it what made it work for me and others. There is a way to download it before VS2022, but I didn't want to put that much work into it if it works for 2022(since 2022 is free anyways) for the time being. I'm trying to generate builds using the github actions on my branch. If anyone wants to figure out how to get OpenSSL to build on windows without vcpkg be my guest but this was so much easier. |
I used VS 2019 on purpose, as I also followed the official instructions. EDIT: Did some system cleanup and a reboot. Now it works.
I would like to avoid bloating the discussion unnecessarily with my compiler problems. 😂 |
Nah this helps me figure out the windows build because while it builds on my windows machine, it's a bit overkill so it might not build on something like the github actions machines(which is getting the same error). On the bright side the linux builds work pretty consistently. |
I have just exported a file.
|
Ok I expected the chitubox to not work but the Mars 3 D: that's disheartening. |
I don't really know anything about the file format, I converted the CTB from PrusaSlicer to an encrypted CTB with uvtools. Then i compared the two headers. I also compared the header with a CTB from Chitubox. It is noticeable that the "Unknown" values in the PrusaSlicer file are all 0, and the values of the other two files are identical.
There are also differing "Unknown" and "Padding" values under SlicerSettings.
|
Yeah I kinda kept them the same as the regular ctb. They might have an actual use though to chitubox. Anything's possible with their file format. This side by side comparison is helpful though for me to track down any different values and fix them, thank you. I'm also pretty sure I set all my paddings to 0 so there might be another bug in there as well I need to look for. |
Yesterday i filtered out some fields, but i looked at the whole table again today. It looks like the value "405" in padding3 in the lower part doesn't belong there and therefore the values for DisclaimerOffset, DisclaimerSize and Padding7 have been "shifted". The position seems to be corrected during the conversion of uvtools. In the code you set unknown7 to value 73470, but uvtools interprets it as unknown8. PerLayerSettings should be zero, but is 64 Something seems definitely off. The value of BottomRetractSpeed (= 1.1E-44) also doesn't look correct. uvtools reads it like this.
|
Yeah I noticed the shift I just need to dig into it more. Having it all laid out for me will help while I'm exploring the issue, thank you. I was trying to figure out the issue with the windows build, but I may just need to split the .c files into separate ones to fix that. |
I found the issue, I'm just trying to figure out what's going on cuz it's writing an extra byte of 0s when it shouldn't be at the anti_alias_flag. I managed to observe it by filling 0 values with garbage. I also fixed a couple other bugs on the way like the light intensity not being right. Should have a new version by tonight if I figure out this weird bug. |
Chitubox is now loading the encrypted CTB! That means that it SHOULD work. Let me know if it actually does on your printer and I'd sit by it during the first print just in case(I don't think there should be any issues) |
I can confirm that it builds without problems and that created CTB files can be opened in Chitubox and UVtools. 👌 Later I will take a closer look at the "SlicerSettings" and check them for plausibility and then start a test print. |
Congrats! 😄 The CTB is accepted by the Mars 3 Pro and printing begins. However, I cancelled it, because I still want to compare the values in the header with the slicer settings. I haven't had time to do that yet. |
Finally haha it was an issue with the struct not being packed(something I documented worry about awhile ago). It'd be cool if we can figure out what some of the unknowns actually equate to in the long run(knowing chitu it may just be random nonsense). Lastly for anyone else following this thread I'll likely continue working on my fork and adding features to that which won't be reflected in this pull request. Hopefully I can bring them to PrusaSlicer eventually, but with the closed off development that's been a recent thing with PrusaSlicer I'm not banking on that fact. My main targets will be slowly implementing stuff from UVtools and the custom vat mixing GCode from TableFlipFoundry into it. Then eventually implementing GOO files and printer uploads. If anyone would like to take part feel free to open any issues and pull requests in the fork(I'll probably start a new branch called dev or something). |
71d64f7
to
e6dbcd8
Compare
profiles, and extra features like light off delay to MSLA printer settings Adds CTB format Fixes CTB format Adds more configurations for the new SLA options in PrintConfig Adds page number calculation Adds model height calculation Adds more GUI elements for configuration options and fixes missing options Fixes type errors with configuration Fixes PWM calculation to be 0-255 Adds configuration for Elegoo SLA printers to Elegoo.ini Fixes configuration issues for Elegoo printers Fixes typo Adds configuration options to Preset.cpp Changes default file format for Elegoo SLA printers to ctb Fixes some structuring issues and generic function for getting config values Adds ctb to sla file filters Adds ctb to the ArchiveWriter Fixes thumbnail sizes in Elegoo config to match the usual size Adds RLE encoding to thumbnails Changes grouping for SLA settings Adds new settings to the steps check Fixes a lot of bugs in file writing Fixes missing configuration Puts TSMC options on the same line Fixes more bugs in data write Fixes a bug in layer generation Fixes the options tab not being set up right and crashing Fixes indentation Cleans up the header file a bit Fixes the Elegoo SLA printer configurations Fixes the thumbnail Change CTB to use SLAArchiveFormatRegistry Add retract_height to configuration Change configuration to grey out TSMC options when disabled and keep retract parameters equal to lift distance Fix formatting to follow clang-format Fix the name of a configuration option in the toggle logic Change float_t to float Fix magic number for CTBv4 Change float_t to float Change from ctb to CTB to emulate other file format setups Add encrypted CTB. Have not tested too much, here be dragons. Add openssl and crypto to CMake file Fix multiple errors, getting closer Fix more bugs, still not quite right Fix encrypted CTB files. UVtools has a bug currently where it expects the signature at the end. Chitubox may have the same bug which is why it won't load it. Move hash to the end and add XOR cipher. Files still don't open in chitubox for some reason. Change PAGE_SIZE to CTB_PAGE_SIZE so it is unique Fix openssl include and change PAGE_SIZE to CTB_PAGE_SIZE Fix CMakeLists to include openssl correctly Fix TSMC option bug Fix several bugs and the CTBv4 output. Chitubox now loads the encrypted ctb file! Move some includes to .cpp file to try and fix some RAM usage on windows build Fixes Elegoo profiles Add skipped changes from rebase(bug fixes apparently) and disable clang format on files that aren't clang formatted
This implements support for CTBv4 and adds GUI elements for all the new configuration options included.
Some issues right now are the thumbnail color not matching what comes out in the sl1s file
and the layers being slightly off when it comes to size of the object in the layer(X and Y may be off by the same amount but their ratio is correct)the size being off actually matches what comes out of another slicer so this may just be an issue that comes with the file. This should close #5280 unless there's a specific need for the older CTB version. It shouldn't be hard to implement based off of this, though.