Mariobro85 Posted March 19, 2021 Share Posted March 19, 2021 (edited) 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, 2021 by Mariobro85 Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted March 20, 2021 Share Posted March 20, 2021 (edited) 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, 2021 by ChampionAsh5357 Quote Link to comment Share on other sites More sharing options...
Mariobro85 Posted March 20, 2021 Author Share Posted March 20, 2021 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. Quote Link to comment Share on other sites More sharing options...
ChampionAsh5357 Posted March 22, 2021 Share Posted March 22, 2021 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. 1 Quote Link to comment Share on other sites More sharing options...
Mariobro85 Posted March 23, 2021 Author Share Posted March 23, 2021 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.