Jump to content

Is there a way to render "Translucent" parts of a model, but keep other parts "Solid" to prevent shadow glitches and wall clips?


Recommended Posts

Posted (edited)

So I made a model and texture ingame as a base, and I set its render mode ingame to "translucent" so that the glass portions of it render correctly.

This is where problems arise. If you've ever remodeled a transparent block in a texture pack, youll know of this horrific sight:
2020-04-05_06_55_17.png.f1e45815786243b21d8f938cf32a43d1.png

 

Excuse the crap quality, that is the FML gradle process, not my normal MC. Anyways, as you can see, it renders fine, the only issue is that there are pitch black shadows, and sometimes, you can see through the "frame" and see other "pieces" of the model through itself.

Is there any way to render the frame as a Solid block, and the glass / other parts as "translucent"?

If I cant solve this, Ill just use "cutout_mipped" and figure out a better "looking glass" hole, but I would like to know if there is an efficient way to do this with transparent textures first.

Btw, I AM on MCreator (yeah I know i suck, I gave up trying to setup blockItems in normal mods, because there are NO TUTORIALS FOR IT FFS)

 

Edit: i captured it clipping the frame:

2020-04-05_07_19_30.png.463cc8ccd59bbcf742ecff6f3cc55a22.png

Edited by MisterSirCode
Posted (edited)

1. Do not use MCreator.

2.

41 minutes ago, MisterSirCode said:

I gave up trying to setup blockItems in normal mods, because there are NO TUTORIALS FOR IT FFS)

Pretty sure there are a lot out there.

BlockItem is just an implementation of Item; you can treat it (register, etc) like an instance of Item.

 

3. Check out Forge’s multi-layer model. An example: https://github.com/McJtyMods/DeepResonance/blob/105c7d3ec6b479b6a0b0f0612b824b6ae874c049/src/main/resources/assets/deepresonance/blockstates/crystalizer.json

Edited by DavidM

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.

 

 

Posted
26 minutes ago, DavidM said:

1. Do not use MCreator.

2.

Pretty sure there are a lot out there.

BlockItem is just an implementation of Item; you can treat it (register, etc) like an instance of Item.

 

3. Check out Forge’s multi-layer model. An example: https://github.com/McJtyMods/DeepResonance/blob/105c7d3ec6b479b6a0b0f0612b824b6ae874c049/src/main/resources/assets/deepresonance/blockstates/crystalizer.json

How do i use the multi layer model? All im seeing is a blockstate, could you help me understand what does what, what points where, and how it interacts.

As for the tutorials, I couldnt find good docs on 1.14.4 blockitem, and NO, you cant just "register it as an item" It doesnt seem to work like that for me.

Posted
45 minutes ago, DavidM said:

1. Do not use MCreator.

2.

Pretty sure there are a lot out there.

BlockItem is just an implementation of Item; you can treat it (register, etc) like an instance of Item.

 

3. Check out Forge’s multi-layer model. An example: https://github.com/McJtyMods/DeepResonance/blob/105c7d3ec6b479b6a0b0f0612b824b6ae874c049/src/main/resources/assets/deepresonance/blockstates/crystalizer.json

like could you give me an example of a really basic minecraft block using forge multi layer? I keep googling but the only docs are in the mcdocs, and they dont talk about the thing in the crystalizer json.
 

"custom": {

"base": "deepresonance:crystalizer#base",

"Solid": "deepresonance:crystalizer#base",

"Translucent": "deepresonance:crystalizer#window"

}

It doesnt mention how to use that... 

Posted

@DavidM Ok, I attempted to use the forge multi-layer thing, But I think its wrong, ingame, the transparent part of the model (the white stained glass) is purple/black missing texture etc.

 

Blockstate: https://hatebin.com/zfhbigloda

 

Model: https://hatebin.com/wmaelcraqr

 

Blockbench compiles it into a multi-file mess that I cant really post in here, so I posted the original model file before I put it in blockbench.

Posted
1 hour ago, MisterSirCode said:

I don't believe these are the appropriate texture paths.

Quote

"1": "animate/white_concrete", "2": "animate/black_concrete", "3": "animate/gray_concrete", "5": "animate/computerFan", "6": "animate/white_stained_glass", "particle": "animate/black_concrete"

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
6 hours ago, Animefan8888 said:

I don't believe these are the appropriate texture paths.

 

 

They are, they are automatically changed when built. Nevermind that, Im asking for a solution to this issue

Posted (edited)
15 hours ago, MisterSirCode said:

and NO, you cant just "register it as an item" It doesnt seem to work like that for me.

You are doing something wrong then. Post your code.

BlockItem is an Item. To instantiate one, simply pass in the instance of your block.

 

13 hours ago, Animefan8888 said:

I don't believe these are the appropriate texture paths.

OP is using MCreator, which might screw around with asset files.

Just checked, and it seems that MCreator does not do anything about model files. My bad.

 

In that case, the problem is probably caused by the incorrect texture file path as Animefan8888 mentioned.

6 hours ago, MisterSirCode said:

they are automatically changed when built

 They are not. What you put in the path is what ends up into the ResourceLocation.

Edited by DavidM

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.

 

 

Posted (edited)

Hi

Alpha blending (transparency) is difficult.

You need to render all the opaque faces first, with depth-buffer writing turned on.  eg RenderType SOLID, CUTOUT, CUTOUT_MIPPED

Then you need to render the transparent faces next, with depth-buffer writing turned off, in the correct order (reverse sorted by depth - i.e. the faces which are furthest away get drawn first).  TRANSLUCENT apparently does depth sorting but I think it might also write to the depth buffer as well, I'm not sure.  If the sorting is done properly for all objects in the scene (not just your model's) then the depth buffer writing isn't critical.

 

If you don't do that, you get all sorts of weird clipping issues happening.

So I think the multi-layer approach might work ok - I'm not sure exactly how to code it because I've always used a TileEntityRenderer for this kind of block before.  If you can't find an example of it, and don't have any luck contacting the forge guys who coded it, you could try tracing through the vanilla model loading & baking code.  It's a bit of head damage but I've used it as the last resort a few times.

 

I'm not sure why the internal faces are black.  Something to do with lighting; but I don't understand why a west-facing quad on the inside of the block should be black when the west-facing quad on the outside of the block is not.  I saw another post recently where the vertex order of the faces was important, perhaps it is something to do with that.  There is also a flag in block model files to control ambientOcclusion, you could try messing with that.  I don't think ambient occlusion should cause shadows that deep but I haven't studied it since 1.6.4 so I'm not sure...

 

If you do crack it, please let me know?  I'd like to include it (block with both solid and transparent parts) in a tutorial project I'm working on.

Cheers

  TGG

 

Edited by TheGreyGhost
more detail
Posted
7 hours ago, DavidM said:

They are not. What you put in the path is what ends up into the ResourceLocation.

When you place your model into mcreator, it splits it into 2 files.

1 is a "parent file" which has no dimensions, it just has the "textures" in it. The second file is your original model, its in the custom directory, except the textures are linked to the first file.

 

Its how the app simplifies changing the textures

Posted (edited)
1 hour ago, TheGreyGhost said:

Hi

Alpha blending (transparency) is difficult.

You need to render all the opaque faces first, with depth-buffer writing turned on.  eg RenderType SOLID, CUTOUT, CUTOUT_MIPPED

Then you need to render the transparent faces next, with depth-buffer writing turned off, in the correct order (reverse sorted by depth - i.e. the faces which are furthest away get drawn first).  TRANSLUCENT apparently does depth sorting but I think it might also write to the depth buffer as well, I'm not sure.  If the sorting is done properly for all objects in the scene (not just your model's) then the depth buffer writing isn't critical.

 

If you don't do that, you get all sorts of weird clipping issues happening.

So I think the multi-layer approach might work ok - I'm not sure exactly how to code it because I've always used a TileEntityRenderer for this kind of block before.  If you can't find an example of it, and don't have any luck contacting the forge guys who coded it, you could try tracing through the vanilla model loading & baking code.  It's a bit of head damage but I've used it as the last resort a few times.

 

I'm not sure why the internal faces are black.  Something to do with lighting; but I don't understand why a west-facing quad on the inside of the block should be black when the west-facing quad on the outside of the block is not.  I saw another post recently where the vertex order of the faces was important, perhaps it is something to do with that.  There is also a flag in block model files to control ambientOcclusion, you could try messing with that.  I don't think ambient occlusion should cause shadows that deep but I haven't studied it since 1.6.4 so I'm not sure...

 

If you do crack it, please let me know?  I'd like to include it (block with both solid and transparent parts) in a tutorial project I'm working on.

Cheers

  TGG

 

Only info I could find was something simple called "forge multi layer" which didnt work, apparently its both outdated, and I cant find a working tutorial, then I tried CTM which was similar, you could enable specific layers of rendertypes, and even emmisive textures. However, that only supports up to 1.12

I wound up just removing the glass portion and replacing it with a "Grate" (basically a pixel grid to create a net) using the render type "Cutout" (not mipped, mipped turns my textures black for some reason) and it looks good enough

As for the black portion, that does have to do with the transparency, but it also has to do with graphics settings. due to the way that fast graphics turn transparent things black right? well, I tried fancy, and it fixed that, and it looks better anyways.
 

 

Edited by MisterSirCode
Posted

This question is unsolved, and Im going to leave it as semi complete. I didnt really ask this question very well, and will create a new one soon with a better description and with the new issues Ive gotten.

I solved everything here except that I cant use transparent pixels in a solid block. Ill have to do more research.

Posted (edited)
1 hour ago, MisterSirCode said:

When you place your model into mcreator, it splits it into 2 files.

1 is a "parent file" which has no dimensions, it just has the "textures" in it. The second file is your original model, its in the custom directory, except the textures are linked to the first file.

 

Its how the app simplifies changing the textures

That is how block models work in Forge...

It has nothing to do with MCreator itself.

 

You should check your log for texture errors if you are still experiencing missing textures.

Edited by DavidM

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.

 

 

Posted
8 minutes ago, DavidM said:

That is how block models work in Forge...

It has nothing to do with MCreator itself.

 

You should check your log for texture errors if you are still experiencing missing textures.

Thats weird, in all the tutorials I saw before I went to mcreator, making models in forge was similar to how you made them in a resource pack, I was never told to cut them into pieces and use parent textures that just complicate things...

 

Im not having any missing textures

 

Ive mostly solved this one except for the transparent textures, that was moved to a cleaner question here: 

 

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.