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

Colormap breaks for textures with custom name #53

Open
JustAlittleWolf opened this issue Jun 8, 2024 · 3 comments
Open

Colormap breaks for textures with custom name #53

JustAlittleWolf opened this issue Jun 8, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@JustAlittleWolf
Copy link

JustAlittleWolf commented Jun 8, 2024

When using a texture with a custom name, the colormap doesn't get applied on LOD chunks.

fm1hB1F
Voxy_Bug.zip

grass_block.json
{
    "variants": {
        "snowy=false": {
            "model": "block/grass_block_issue"
        },
        "snowy=true": {
            "model": "block/grass_block_noissue"
        }
    }
}
grass_block_noissue.json

{"parent":"block/grass_block","textures":{"top":"block/grass_block_top"}}
grass_block_issue.json

{"parent":"block/grass_block","textures":{"top":"block/grass_block_top_custom_texture_name"}}

The snowy blocks (purple line in image) have their colormap applied fine in the LOD chunks, however the grass block texture with a custom name does not get it's colormap rendered properly.

The used texture pack with only the required files for the bug to happen is attached as well.

This might be what causes #32

@JustAlittleWolf
Copy link
Author

Update: this only seems to happen when the texture has color itself, if you change the texture to be grayscale (like the grass textures that minecraft uses) this does not happen.

@Steveplays28 Steveplays28 added the bug Something isn't working label Jun 9, 2024
@ebo2022
Copy link

ebo2022 commented Jun 20, 2024

I think either a similar problem or the same issue is happening with BetterEnd. Voxy doesn't seem to apply any coloration to the aurora crystals.

Can confirm this isn't a BetterEnd or BCLib-specific issue. I checked and BCLib just hooks into Fabric API's block color registry to register its color providers. Also, the block uses the regular blockstate/model system and no custom renderers or anything
2024-06-20_12 51 06
Vanilla chunks are on the left and Voxy LODs are on the right

@KawaiiSelbst
Copy link

KawaiiSelbst commented Jul 20, 2024

I've been messing with the code for a couple of days now, and I'm trying to fix it. I have found the reason for this and I know how to fix it, but I do not yet know exactly how to do it in the code.

This is because there are quads in the fragment shader quads.frag checks whether the color is in grayscale or not before applying the color. If you remove this check, then the colormaps are superimposed as needed, except that the side blocks of grass are tinted not only on the upper part but also on the part with the dirt.

It seems that this is due to the fact that in the renderFaces method of ModelTextureBakery to a var

var model = MinecraftClient.getInstance()
                    .getBakedModelManager()
                    .getBlockModels()
                    .getModel(state);

in

public ColourDepthTextureData[] renderFaces(BlockState state, long randomValue, boolean renderFluid) {

The texture gets in immediately with the overlay. You need to somehow get the base model and the grass_block_side_overlay texture separately, first put a color on it, and then bake it into the grass_block model, then you need to check
abs(colour.r-colour.g) < 0.02f && abs(colour.g-colour.b) < 0.02f in

if ((flags&(1u<<2)) != 0 && abs(colour.r-colour.g) < 0.02f && abs(colour.g-colour.b) < 0.02f) {

disappears by itself, because the block of grass in vanilla minecraft is the only texture with overlay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants