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

Convert control map from 8/8/8 to 5/5/3/1 #115

Closed
TokisanGames opened this issue Jul 14, 2023 · 2 comments · Fixed by #234
Closed

Convert control map from 8/8/8 to 5/5/3/1 #115

TokisanGames opened this issue Jul 14, 2023 · 2 comments · Fixed by #234
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@TokisanGames
Copy link
Owner

TokisanGames commented Jul 14, 2023

See discussion here: #64

Currently control paints and reads RGB8 in 8/8/8 bit floats as base/overlay/blend.

New format is 32-bit unsigned integer (stored as RF since Godot doesn't support int formats in all cases). Here is the definition starting with the left most bits.

Description Range # Bits Bit #s Encode (C++) Decode (GLSL)
Base texture id 0-31 5 32-28 (x & 0x1F) <<27 x >>27u & 0x1Fu
Overlay texture id 0-31 5 27-23 (x & 0x1F) <<22 x >>22u & 0x1Fu
Texture blend 0-255 8 22-15 (x & 0xFF) <<14 x >>14u & 0xFFu
... reserved ...
Hole: 0 draw terrain, 1 discarded 0-1 1 3 (x & 0x1) <<2 x >>2u & 0x1u
Navigation: 0 no, 1 yes 0-1 1 2 (x & 0x1) <<1 x >>1u & 0x1u
Autoshader: 0 auto, 1 manual 0-1 1 1 x & 0x1 x & 0x1u
  • Possible future plans for reserved bits:

    • 5 bits - 32 paintable particles
    • 3 bits - paintable uv scale array index+
    • 3 bits - paintable slope array index+
    • 3 bits - paintable rotation array index+
    • 1 bit - paintable navigation mesh
    • 2 bits - 4 layers (including Hole above, eg water, non-destructive, hole, normal mesh)
    • 1 bit - future use (maybe added to particles)
    • | Texture blend weight array index+ | 0-7 | 3 | 22-20 | (x & 0x7) <<19 | x >>19u & 0x7u
  • Array for all + marked 3-bit indices above: { 0.0f, .125f, .25f, .334f, .5f, .667f, .8f, 1.0f };

Also see #64, #4, #60

@TokisanGames TokisanGames self-assigned this Jul 14, 2023
@TokisanGames TokisanGames added the enhancement New feature or request label Jul 14, 2023
@TokisanGames TokisanGames moved this to Alpha Release in @Terrain Jul 14, 2023
@TokisanGames TokisanGames added this to the Alpha milestone Jul 14, 2023
@TokisanGames TokisanGames moved this from Alpha Release to Beta Release in @Terrain Jul 15, 2023
@TokisanGames TokisanGames modified the milestones: Alpha, Beta Jul 15, 2023
@TokisanGames TokisanGames changed the title Conver control map from 8/8/8 to 5/5/3 Convert control map from 8/8/8 to 5/5/3 Jul 15, 2023
@TokisanGames TokisanGames changed the title Convert control map from 8/8/8 to 5/5/3 Convert control map from 8/8/8 to 5/5/3/1 Jul 19, 2023
@TokisanGames TokisanGames moved this from Beta Release to In Progress in @Terrain Jul 19, 2023
@TokisanGames TokisanGames moved this from In Progress to Beta Release in @Terrain Jul 25, 2023
@TokisanGames TokisanGames moved this from Beta Release to In Progress in @Terrain Jul 25, 2023
@TokisanGames TokisanGames moved this from In Progress to Beta Release in @Terrain Jul 29, 2023
@TokisanGames TokisanGames moved this to Beta Release in Terrain3D Roadmap Aug 21, 2023
@TokisanGames TokisanGames moved this from Beta Release to In Progress in Terrain3D Roadmap Sep 12, 2023
@Saul2022
Copy link

Out of curiosity , wouldn't this give a performance improvement by pushing more the 32 texture limit?

@TokisanGames
Copy link
Owner Author

We already hard limit the texture count to 32. The new control map format keeps that limit. All it does is compress 32 texture index stored in 8 bits to 5 bits. No performance difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants