Jump to content

[1.7.2]Model renders a little glitchy on overlapped areas


jabelar

Recommended Posts

Okay, I've been having fun making complicated entity models and animations.  One thing that bothers me though is that in order to have a smooth joint between two parts I like to overlap them a bit.  The problem is that the area of overlap will "flash" a bit where I mean that it shows the texture of either one or the other part "randomly".  I'm not sure if this is some OpenGL issue when there are two planes perfectly overlapping, or whether it is a rendering code issue where the order of the rendering is changing. 

 

Or maybe the screen refresh rate is randomly occuring in between the renders of my body parts?  Is this a display sync issue?

 

What confuses me about this, is that in my custom model class I'm fairly certain that the order of the render calls is fixed.  I basically "body.render()", "head.render()", etc. for all the body parts in order.

 

If the render order is fixed, why is there the glitchy flashing effect on overlapping parts?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

This is normal. This happen when the computer need to calculate the position of the texture on the same position. The computer can't. it is constantly trying to get one side to be visible.

If you stop rotating the screen, you can see is does not glitch. Simply because the computer does not need to calculate the position.

 

solution: shrink one side (face) to 99.999%, just a bit smaller. and voila, solved. but is that possible in minecraft?

Coding, Testing, Smiling, Publishing!

Link to comment
Share on other sites

This is normal. This happen when the computer need to calculate the position of the texture on the same position. The computer can't. it is constantly trying to get one side to be visible.

If you stop rotating the screen, you can see is does not glitch. Simply because the computer does not need to calculate the position.

 

solution: shrink one side (face) to 99.999%, just a bit smaller. and voila, solved. but is that possible in minecraft?

 

Yeah, I understand that what to render becomes ambiguous because they are both technically at same location.  But since it is a computer, I'd assume that it is still a logical process that would be biased to doing one or the other.  For example, the render order in my model class is a set order, so you would think that the last one rendered would be the one that would show in case of a "tie" in position.  I'm thinking that maybe actually true, but maybe the screen refresh is occasionally happening between the render calls.

 

Anyway, it does seem common in Minecraft so I suppose people aren't that picky about weird render issues (like heads of entities going inside blocks and such).  That is part of the charm of Minecraft (that the graphics aren't sophisticated).

 

I think it is possible to scale the parts to 99% before render, so maybe I'll try that.  I had thought about that, but wanted to know first if the issue had some other obvious fix.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Hi

 

I have had the same problem with textures which are parallel and on top of each other; it was caused by small roundoff errors determining which of the two textures  is "in front" of the other one.

 

If you have depth culling on, the render order doesn't matter unless you're doing alpha blending.

 

You can fix it by moving one of the textures slightly in front of the other one by a very small amount (i.e. by not trying to overlap them, leaving a very small gap instead).

 

-TGG

 

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Here's the newest crash: https://pastebin.com/mumDeWzW Seems to have something to do with JEI Also delete that server file? Also the newest log: https://pastebin.com/ATH8dbWc
    • Recently started to attempt 1.20.1 modding, in registering idle, walk and attack animations in the mob entity class i've run into two issues:   a) idle and walk animations seem to play simultaneously  + the mob itself does not seem to walk private static final EntityDataAccessor<Boolean> ATTACKING = SynchedEntityData.defineId(MugaEntity.class, EntityDataSerializers.BOOLEAN); public MugaEntity(EntityType<? extends Monster > pEntityType, Level pLevel) { super(pEntityType, pLevel); } public final AnimationState idleAnimationState = new AnimationState(); private int idleAnimationTimeout = 1; public final AnimationState attackAnimationState = new AnimationState(); public int attackAnimationTimeout = 0; @Override public void tick() { super.tick(); if(this.level().isClientSide()) { setupAnimationStates(); } } private void setupAnimationStates () { if(this.idleAnimationTimeout <= 0) { this.idleAnimationTimeout = this.random.nextInt(30) + 60; this.idleAnimationState.start(this.tickCount); } else { --this.idleAnimationTimeout; } if (this.isAttacking() && attackAnimationTimeout <= 0 ) { attackAnimationTimeout = 20; attackAnimationState.start(this.tickCount); } else { --this.attackAnimationTimeout; } if(this.isAttacking()) { attackAnimationState.stop(); } } @Override protected void updateWalkAnimation(float pPartialTick) { float f; if(this.getPose() == Pose.STANDING) { f=Math.min(pPartialTick * 3.0F, 1.0F); } else { f= 0.0F; } this.walkAnimation.update(f, 0.2F); } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(ATTACKING, false); } public void setAttacking(boolean attacking) { this.entityData.set(ATTACKING, attacking); } public boolean isAttacking() { return this.entityData.get(ATTACKING); } b) the attack animation is never played on attack, despite being registered  @Override public void setupAnim(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { this.root().getAllParts().forEach(ModelPart::resetPose); this.animateWalk(ModAnimationDefinitions.MUGA_WALKING, limbSwing, limbSwingAmount, 1f, 1f ); this.animate(((MugaEntity)entity).idleAnimationState, ModAnimationDefinitions.MUGA_IDLE, ageInTicks, 1f); this.animate(((MugaEntity)entity).attackAnimationState, ModAnimationDefinitions.MUGA_ATTACK, ageInTicks, 1f); }
    • Maybe there are some more broken files - check the new crash-report - the file name is mentioned in the first lines   If it is another crash, add it here
    • Thanks. Found and deleted it, but it doesn't change anything. When joining a new file is created, the screen freezes/ does not respond in typical manner and I have to close it then. I deleted it in curseforge>minecraft>instances>Modpack>saves>World>serverconfig Should I have deleted it anywhere else?
  • Topics

×
×
  • Create New...

Important Information

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