Jump to content

[1.15.2] Problems rendering a block


xX_deadbush_Xx

Recommended Posts

Hello,

I'm having a render problem with a block... when you look at the top from a very low angle you can see through the top of my block: https://imgur.com/a/VUA2dnV.

In the image you can see that the purple symbol on the top is still visible. This is because it sits on a different quad than the rest of the blocks top.

there is a square with this purple symbol with zero thickness 0.1 pixels above the top of the block. I'm doing this because the symbol gets rendered at full brightness using IBakedModel (This is why it seems like its glowing).

I have set the rendertype for the entire block to translucent because the square has zero alpha pixels and 20 alpha pixels.

 

Maybe it has something to do with me setting the render type of the block to translucent? I only really need this one quad with the symbol to be rendered translucent,

is it possible to only render a single quad translucent and the rest solid?

Link to comment
Share on other sites

I have tried the multi layer model but it wont render the translucent part... The solid part is there though

"translucent": {
    "textures": {
      "3": "witchcraftmod:blocks/modelled/ritual_stone/4"
    },
      "elements": [
        {
          "from": [3, 12.1, 3],
          "to": [13, 12.1, 13],
          "faces": {
            "north": {"uv": [0, 0, 8, 0], "texture": "#3"},
            "east": {"uv": [0, 0, 8, 0], "texture": "#3"},
            "south": {"uv": [0, 0, 8, 0], "texture": "#3"},
            "west": {"uv": [0, 0, 8, 0], "texture": "#3"},
            "up": {"uv": [0, 0, 16, 16], "texture": "#3"},
            "down": {"uv": [0, 0, 8, 8], "texture": "#3"}
          }
        }
      ]
  }

This is the translucent part, in the game its just not there at all :( The texture is definitely correct though

Link to comment
Share on other sites

Try this:

 

  // does the Glass Lantern render in the given layer (RenderType) - used as Predicate<RenderType> lambda for setRenderLayer
  public static boolean isGlassLanternValidLayer(RenderType layerToCheck) {
    return layerToCheck == RenderType.getCutout() || layerToCheck == RenderType.getTranslucent();
  }

 

-TGG

Link to comment
Share on other sites

It's still not putting the translucent texture onj the block... It does work on the blockitem though. I have tried only having it render the translucent part and that worked so it seems like the block cant have more than one RenderType at once... Any other ideas? If nothing works i will try using a TESR

Link to comment
Share on other sites

7 minutes ago, xX_deadbush_Xx said:

It's still not putting the translucent texture onj the block... It does work on the blockitem though. I have tried only having it render the translucent part and that worked so it seems like the block cant have more than one RenderType at once... Any other ideas? If nothing works i will try using a TESR

Blocks can have more than one render layer. Have you tried TheGreyGhost’s solution?

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Please post your code.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Model json:

https://pastebin.com/t0GwXURU

RenderType:

//in client setup
RenderTypeLookup.setRenderLayer(ModBlocks.RITUAL_STONE.get(), RenderHelper::isSolidOrTranslucent);

//in RenderHelper
public static boolean isSolidOrTranslucent(RenderType layerToCheck) {
	return layerToCheck == RenderType.getSolid() || layerToCheck == RenderType.getTranslucent();
}

Is there anything else I need to do?

Link to comment
Share on other sites

Hi

BTW your translucent texture should only have the up face, and none of the others on that element.

 

If it renders translucent in item but not block, it's almost certainly a renderlayer problem.  Are you sure the setRenderLayer is being executed and the RITUAL_STONE is correct?

 

What happens if you swap the order of translucent and solid?  It shouldn't matter, but it might show up  a subtle problem in your json.

You could consider simplifying your model to two simple elements then putting a breakpoint into MultiLayerModel.Loader to see whether your json file is being parsed as you expect

You could try putting a breakpoint into isSolidOrTranslucent and seeing if it's called when you place your block into the world; alternatively in ChunkRenderDispatcher::compile with a conditional breakpoint, or in MultiLayerModel::getQuads to see whether the quads are being rendered (and you just can't see them). 

 

Painful trial and error was the only way that worked for me unfortunately

 

-TGG

 

 

 

 

Link to comment
Share on other sites

Okay I think I just figured out what the problem is. As I said I'm rendering the top texture at full brightness and appearently that works differently for MultiLayerModels. I will see if I can figure out how to make it work for MultiLayerModels too. Thank you for your help

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.