Jump to content

[1.11.2] Particle rendering seems a bit off in 1.11.2 vs. 1.10.2


Recommended Posts

Posted

I hope I can explain this....

 

I have a particle that gets rendered just above a block in the XZ plane.  It is static - doesn't move or have animations.  It will fade after a period of time.

 

In 1.10.2 it renders fine.  It sits where it it supposed to regardless of how the player moves.

 

In 1.11.2-13.20.0.2223 it seems to float when the player moves.  This impression is given because it looks like the render position of the particle shifts slightly in the direction of the player movement.  When the player stops moving, the particle goes back to where it is supposed to be.  I could be wrong, but it seems the particle interpPosXYZ values are off.  It's like the sequence of calculating the player's position changed in relation to the interpPosXYZ calculation.

 

EDIT: (Updated observation) In 1.11.2-13.20.0.2223 it seems to float when the player moves.  Looking for words to describe it.  If I were standing above the particle and looking down it is fixed where it should be.  If I were to move left, it looks like it shifts further right sliding above the block surface.  If I move right it shifts left.  The further I move the more it slides.  It's like it is the top of some sort of cube that shifts based on the camera, but it really is a 2D texture laying just above a block.  (If you want I can provide a link to my mod if you want to download and compare the versions.)

 

The render code can be found in Minecraft's ParticleFootStep particle.

 

So my question is whether I have to do anything special for rendering a particle in the XZ plane in 1.11.2.  This slight shifting can be a bit nauseating for me and I imagine it could be for others as well.  The particle needs to be "fixed" to avoid the floating sensation.

Posted

Copy/paste from the Minecraft code:

 

/**
     * Renders the particle
     */
    public void renderParticle(VertexBuffer buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
    {
        float f = ((float)this.footstepAge + partialTicks) / (float)this.footstepMaxAge;
        f = f * f;
        float f1 = 2.0F - f * 2.0F;

        if (f1 > 1.0F)
        {
            f1 = 1.0F;
        }

        f1 = f1 * 0.2F;
        GlStateManager.disableLighting();
        float f2 = 0.125F;
        float f3 = (float)(this.posX - interpPosX);
        float f4 = (float)(this.posY - interpPosY);
        float f5 = (float)(this.posZ - interpPosZ);
        float f6 = this.world.getLightBrightness(new BlockPos(this.posX, this.posY, this.posZ));
        this.currentFootSteps.bindTexture(FOOTPRINT_TEXTURE);
        GlStateManager.enableBlend();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        buffer.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(0.0D, 1.0D).color(f6, f6, f6, f1).endVertex();
        buffer.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 + 0.125F)).tex(1.0D, 1.0D).color(f6, f6, f6, f1).endVertex();
        buffer.pos((double)(f3 + 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(1.0D, 0.0D).color(f6, f6, f6, f1).endVertex();
        buffer.pos((double)(f3 - 0.125F), (double)f4, (double)(f5 - 0.125F)).tex(0.0D, 0.0D).color(f6, f6, f6, f1).endVertex();
        Tessellator.getInstance().draw();
        GlStateManager.disableBlend();
        GlStateManager.enableLighting();
    }

Posted

OK.  If I were to use the RenderManager.viewerPosXYZ calculations instead of the Particle.interpPosXYZ values the problem goes away.  Anyone know of a reason why I *shouldn't* use the RenderManager information rather than the Particle information?

Posted

OK.  Think I know why the problem is occuring.  My particle is rendered during the renderLitParticles() pass.  This occurs *before* the renderParticles() pass where the interpPosXYZ values are updated.  This means that my particle renderer was using the values from the previous pass, not the current one.  Seems to me that the interpPosXYZ values should be updated prior to *any* particle rendering.

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

    • Please read the FAQ and post logs as described there.
    • Upon starting the server I get; [main/ERROR] [minecraft/Main]: Failed to start the minecraft server net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [     Framework (framework) has failed to load correctly §7java.lang.NoClassDefFoundError: net/minecraft/client/gui/components/toasts/Toast ] I suspect there is a (possibly a few) client-only mods installed on my server. Any help would be appreciated! (Yes I know there are a lot of mods...) Here is the crash log:   https://paste.ee/p/pRz5mhMl#s=0
    • That's basically what the failure does, my apologies for failing to specify.  It just tries again on the next tick until it detects the entities for that chunk are loaded, and then tries to load the entity.  From there it gets into different failure states depending on what goes wrong, but in short, if the entity fails to load once the entity list becomes available, the request is cleared and must be resubmitted by the end user.  There should be few cases where that actually happens. Yes, that is my understanding of forceloading.  That's why on a successful summon, it removes the forceload.  Otherwise it does just leave the chunks loaded long term. Thank you for your help, any knowledge is useful!  I don't often mess with forceloading and my prior experience is 1.16 so I'm also a bit out of my depth haha.
    • I will have to do more research about 1.18 chunk loading. You were unclear about how your code manages with the entity load failure. If you simply used a loop, I suggest submitting a tick task to the next tick which does the same thing, checking if the entities are loaded and if so teleporting the right one else submitting another tick task etc. Also I think forceloading permanently force loads the chunk, and it only starts to unload when you make a subsequent call to mark the chunk as not forceloaded. I may be completely wrong, I dont know much about 1.18, most of my experience is 1.20. Good luck I hope you figure it out after all this time 😅
    • i managed to fix it by reinstalling the modpack and re-add all the extra mods I've had previously.
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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