Repository navigation
Custom OBJ item model invisible — RenderType / vertex format? #3633
Replies: 1 comment
|
In 1.21.1, For items, split the work by render pass instead of by render type. Each pass is its own // nested in ReaperDynamicModel
static final class BladePass extends BakedModelWrapper<BakedModel> {
private static final List<RenderType> TYPES =
List.of(RenderType.entityCutout(RCTextureAtlases.REAPER));
BladePass(BakedModel objModel) {
super(objModel);
}
@Override
public List<RenderType> getRenderTypes(ItemStack stack, boolean fabulous) {
return TYPES;
}
}
private final BakedModel bladePass; // = new BladePass(objModel) in the constructor
@Override
public List<BakedModel> getRenderPasses(ItemStack stack, boolean fabulous) {
return List.of(this.bladePass);
}
Your three questions:
Missing normals aren't the cause. The OBJ loader computes a face normal when the file has none (ObjModel.java#L316-L331). One more thing about the text pass: it can't work through baked quads even after this fix. The item path reads every quad in the vanilla block layout: int 3 is the color, ints 4–5 are the UV, int 6 is the lightmap and int 7 is the normal (VertexConsumer.java.patch#L10-L16). Your text quad writes color I checked this against the NeoForge |
Uh oh!
There was an error while loading. Please reload this page.
Env:
Problem:
Custom item uses OBJ geometry loader + IDynamicBakedModel. It is invisible in inventory/hand/item frames. No crash, no purple. Works without the dynamic wrapper.
Setup:
reaperchronicle:reapervia RegisterMaterialAtlasesEvent. Log:Created: 128x64x4 reaperchronicle:reaper-atlasREAPER_BLADE:DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP,getRendertypeSolidShader(), atlas texture, LIGHTMAPgetRenderTypes(stack, fabulous)->List.of(REAPER_BLADE, getText(...))getQuads(..., renderType):REAPER_BLADE->objModel.getQuads(state, side, random, data, null)reaper_text*-> manual quadReaperGeometry.bakewithStandaloneGeometryBakingContext.builder(context).withTextures(ATLAS, getTextures(), MissingTextureAtlasSprite.getLocation()).build(...)textures: { "texture": "reaperchronicle:reaper/common_reaper" }, OBJ usesusemtl Material, MTLmap_Kd #textureQuestions:
POSITION_COLOR_TEX_LIGHTMAPwrong for items? Should it beNEW_ENTITY/BLOCK?getRendertypeSolidShader()work with OBJ-baked models on item path, or need another shader?IDynamicBakedModel.getRenderTypesignored for items?I suspect missing normals for the item pipeline, but not sure. Pointers appreciated.
Links:
All reactions