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

Godot4: support importing and exporting 32-bit raw files #369

Merged
merged 3 commits into from
Aug 28, 2023

Conversation

MJacred
Copy link
Contributor

@MJacred MJacred commented May 16, 2023

Test file for importing

  • min height: 0
  • max height: 131.87
  • endianness: little

as tar.gz file, as github does not allow uploading .raw file: heightmap_24.raw.tar.gz

created with: https://github.com/cubiest/bmesh-map

@MJacred
Copy link
Contributor Author

MJacred commented May 16, 2023

@Zylann: does the main branch (i.e. the Godot 3 version) support 24-bit? If so, I'd backport the import

addons/zylann.hterrain/hterrain_data.gd Outdated Show resolved Hide resolved
addons/zylann.hterrain/util/util.gd Outdated Show resolved Hide resolved
addons/zylann.hterrain/tools/importer/importer_dialog.gd Outdated Show resolved Hide resolved
addons/zylann.hterrain/util/util.gd Outdated Show resolved Hide resolved
@Zylann
Copy link
Owner

Zylann commented May 29, 2023

The Godot 3.6 version did not have 24-bit raw import.

@MJacred
Copy link
Contributor Author

MJacred commented Jun 1, 2023

The Godot 3.6 version did not have 24-bit raw import.

Sorry, that was imprecise. What I meant: Does it support 24-bit heightmaps internally?
If it doesn't, importing a 24-bit raw file makes no sense, because the precision is lost.

@Zylann
Copy link
Owner

Zylann commented Jun 1, 2023

The Godot 3.6 version uses half-precision floats to store heightmaps, which is 16-bit. There is still a bit of advantage in importing a higher-precision heightmap, but most of the precision may be lost indeed.

@MJacred
Copy link
Contributor Author

MJacred commented Jun 2, 2023

Alright, then I'll make a backport after this PR is merged

@MJacred MJacred requested a review from Zylann June 2, 2023 18:49
@MJacred MJacred force-pushed the godot4 branch 2 times, most recently from 5014c2b to 98bf3c4 Compare June 3, 2023 16:58
@MJacred MJacred requested a review from Zylann June 3, 2023 16:59
@MJacred MJacred mentioned this pull request Jun 8, 2023
@MJacred
Copy link
Contributor Author

MJacred commented Jun 12, 2023 via email

@Zylann
Copy link
Owner

Zylann commented Jun 12, 2023

I kinda lost track of this, how can the user make the wrong choice if the option is simply disabled when the import type changes?
And why would it need to be Undefined for other types, when those other types simply would not need to read it?
I would indeed prefer something simpler that does not involve creating two ways of disabling a property, when one exists already.

@MJacred
Copy link
Contributor Author

MJacred commented Jun 12, 2023 via email

@Zylann
Copy link
Owner

Zylann commented Jun 12, 2023

I see, so far I think set_property_enabled was not used in this kind of semantic, it might as well have hidden the properties instead because they did not matter for the current settings. Perhaps there can be a set_property_visible function later on.

@MJacred
Copy link
Contributor Author

MJacred commented Jun 16, 2023

@Zylann: should I (additionally) rewrite this to importing/exporting 32-bit raw files instead?

@Zylann
Copy link
Owner

Zylann commented Jun 16, 2023

If you still need to import/export 24-bit raw and it's a format known to be used by other software then there is no reason to not have it. Same if you want 32-bit. Note that "raw" isn't a format, what really counts is what's told to be in it, usually fixed-point, float or else.

@MJacred MJacred reopened this Aug 14, 2023
@MJacred MJacred changed the base branch from godot4 to master August 14, 2023 18:21
@MJacred
Copy link
Contributor Author

MJacred commented Aug 14, 2023

@Zylann: sorry for the delay. I think all your change requests are implemented. And it's now importing as 32-bit for various reasons

@MJacred MJacred changed the title Godot4: support importing and exporting 24-bit raw files Godot4: support importing and exporting 32-bit raw files Aug 14, 2023
@MJacred
Copy link
Contributor Author

MJacred commented Aug 27, 2023

@Zylann: removed debug logs and replaced if-else with clampi

@Zylann Zylann merged commit 73d9d1d into Zylann:master Aug 28, 2023
3 checks passed
@Zylann
Copy link
Owner

Zylann commented Aug 28, 2023

Thanks!

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

2 participants