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



×
×
  • Create New...

Important Information

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