Posted March 19, 20214 yr Hello everyone, I just started modding with Forge and am currently working on custom particles. The particles themselves work perfectly, however, transparent particles make other particles behind them invisible. I know this issue is also present in Vanilla Minecraft and I was hoping that it could be eliminated with Forge since it makes particles with a lot of semi-transparent pixels ugly (as you can see in the attachment). This is the code I use for all my particles: public void renderParticle(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) { RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.defaultAlphaFunc(); Vector3d vector3d = renderInfo.getProjectedView(); float f = (float)(MathHelper.lerp((double)partialTicks, this.prevPosX, this.posX) - vector3d.getX()); float g = (float)(MathHelper.lerp((double)partialTicks, this.prevPosY, this.posY) - vector3d.getY()); float h = (float)(MathHelper.lerp((double)partialTicks, this.prevPosZ, this.posZ) - vector3d.getZ()); Quaternion quaternion; if(this.particleAngle == 0.0F){ quaternion = renderInfo.getRotation(); } else{ quaternion = new Quaternion(renderInfo.getRotation()); float f3 = MathHelper.lerp(partialTicks, this.prevParticleAngle, this.particleAngle); quaternion.multiply(Vector3f.ZP.rotation(f3)); } Vector3f vector3f1 = new Vector3f(-1.0F, -1.0F, 0.0F); vector3f1.transform(quaternion); Vector3f[] avector3f = new Vector3f[]{new Vector3f(-1.0F, -1.0F, 0.0F), new Vector3f(-1.0F, 1.0F, 0.0F), new Vector3f(1.0F, 1.0F, 0.0F), new Vector3f(1.0F, -1.0F, 0.0F)}; float f4 = this.getScale(partialTicks); for(int i = 0; i < 4; ++i) { Vector3f vector3f = avector3f[i]; vector3f.transform(quaternion); vector3f.mul(f4); vector3f.add(f, g, h); } float f7 = this.getMinU(); float f8 = this.getMaxU(); float f5 = this.getMinV(); float f6 = this.getMaxV(); int j = this.getBrightnessForRender(partialTicks); buffer.pos((double)avector3f[0].getX(), (double)avector3f[0].getY(), (double)avector3f[0].getZ()).tex(f8, f6).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j).endVertex(); buffer.pos((double)avector3f[1].getX(), (double)avector3f[1].getY(), (double)avector3f[1].getZ()).tex(f8, f5).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j).endVertex(); buffer.pos((double)avector3f[2].getX(), (double)avector3f[2].getY(), (double)avector3f[2].getZ()).tex(f7, f5).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j).endVertex(); buffer.pos((double)avector3f[3].getX(), (double)avector3f[3].getY(), (double)avector3f[3].getZ()).tex(f7, f6).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j).endVertex(); RenderSystem.enableDepthTest(); RenderSystem.depthMask(true); } I tried the disableDepthTest() and depthMask(false) methods because they appearantly worked for an older version of Minecraft, but they have no effect in 1.16.5. The defaultAlphaFunc() method makes the texture look a bit smoother, but that's about it. I also played around with other methods of RenderSystem, but I just kept making it worse that it already is. Does anyone have a solution for this? Thanks in advance! Edited March 23, 20214 yr by Mariobro85
March 20, 20214 yr You would need to set the IParticleRenderType to PARTICLE_SHEET_TRANSLUCENT via Particle#getRenderType iirc. Don't manipulate the render system in any way. Edited March 20, 20214 yr by ChampionAsh5357
March 20, 20214 yr Author 9 minutes ago, ChampionAsh5357 said: You would need to set the IParticleRenderType to PARTICLE_SHEET_TRANSLUCENT via Particle#getRenderType iirc. Don't manipulate the render system in any way. @Override public IParticleRenderType getRenderType() { return IParticleRenderType.PARTICLE_SHEET_TRANSLUCENT; } It already is.
March 22, 20214 yr Then you might want to check if the particle displays the same issues on Fabulous graphics. If not, then it's fine how it currently is.
March 23, 20214 yr Author While Fabulous graphics make the particles render behind stained glass and water, the particle rendering itself didn't change. I guess this is just how Minecraft handles particle transparency - at least the behaviour works well Thank you!
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.