I'm using 3d particle System (Billboards ar particles) as desribed in LibGDX blog: https://github.com/libgdx/libgdx/wiki/3D-Particle-Effects It doesn't work. It doesn't crash. It just doesn't appear on the screen.
Here's my code:
Init:
private void createParticles3d() {
particleSystem3d = ParticleSystem.get();
particleBatch = new BillboardParticleBatch();
particleBatch.setCamera(cam);
particleSystem3d.add(particleBatch);
ParticleEffectLoader.ParticleEffectLoadParameter loadParam = new ParticleEffectLoader.ParticleEffectLoadParameter(particleSystem3d.getBatches());
ParticleEffectLoader loader = new ParticleEffectLoader(new InternalFileHandleResolver());
assets.setLoader(com.badlogic.gdx.graphics.g3d.particles.ParticleEffect.class, loader);
assets.load("data/test3dparticles.pfx", com.badlogic.gdx.graphics.g3d.particles.ParticleEffect.class, loadParam);
assets.finishLoading();
originalBubblesEffect3d = assets.get("data/test3dparticles.pfx");
bubblesEffect3d = originalBubblesEffect3d.copy();
bubblesEffect3d.init();
bubblesEffect3d.start();
particleSystem3d.add(bubblesEffect3d);
}
Render:
modelBatch.begin(cam);
//Also tried to set some matrix transform here
particleSystem3d.update();
particleSystem3d.begin();
particleSystem3d.draw();
particleSystem3d.end();
modelBatch.render(particleSystem3d);
modelBatch.end();
Particle file:
{unique:{billboardBatch:{class:com.badlogic.gdx.graphics.g3d.particles.ResourceData$SaveData,data:{cfg:{class:com.badlogic.gdx.graphics.g3d.particles.batches.BillboardParticleBatch$Config,mode:Screen}},indices:[0]}},data:[],assets:[{filename:C:/Users/tte/Desktop/temp/_FISHES/bubbles/bubbles1.png,type:com.badlogic.gdx.graphics.Texture}],resource:{class:com.badlogic.gdx.graphics.g3d.particles.ParticleEffect,controllers:[{name:"Billboard Controller",emitter:{class:com.badlogic.gdx.graphics.g3d.particles.emitters.RegularEmitter,minParticleCount:0,maxParticleCount:200,continous:true,emission:{active:true,lowMin:0,lowMax:0,highMin:250,highMax:250,relative:false,scaling:[1],timeline:[0]},delay:{active:false,lowMin:0,lowMax:0},duration:{active:true,lowMin:3000,lowMax:3000},life:{active:true,lowMin:0,lowMax:0,highMin:500,highMax:1000,relative:false,scaling:[1,1,0.3],timeline:[0,0.66,1]},lifeOffset:{active:false,lowMin:0,lowMax:0,highMin:0,highMax:0,relative:false,scaling:[1],timeline:[0]}},influencers:[{class:com.badlogic.gdx.graphics.g3d.particles.influencers.RegionInfluencer$Single,regions:[{halfInvAspectRatio:0.5,v2:1,u2:1}]},{class:com.badlogic.gdx.graphics.g3d.particles.influencers.SpawnInfluencer,spawnShape:{class:com.badlogic.gdx.graphics.g3d.particles.values.PointSpawnShapeValue,active:false,xOffsetValue:{active:false,lowMin:0,lowMax:0},yOffsetValue:{active:false,lowMin:0,lowMax:0},zOffsetValue:{active:false,lowMin:0,lowMax:0},spawnWidthValue:{active:false,lowMin:0,lowMax:0,highMin:0,highMax:0,relative:false,scaling:[1],timeline:[0]},spawnHeightValue:{active:false,lowMin:0,lowMax:0,highMin:0,highMax:0,relative:false,scaling:[1],timeline:[0]},spawnDepthValue:{active:false,lowMin:0,lowMax:0,highMin:0,highMax:0,relative:false,scaling:[1],timeline:[0]},edges:false}},{class:com.badlogic.gdx.graphics.g3d.particles.influencers.ColorInfluencer$Single,alpha:{active:false,lowMin:0,lowMax:0,highMin:1,highMax:1,relative:false,scaling:[0,0.15,0.5,0],timeline:[0,0.5,0.8,1]},color:{active:false,colors:[1,0.12156863,0.047058824,0,0,0],timeline:[0,1]}},{class:com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsInfluencer,velocities:[{class:com.badlogic.gdx.graphics.g3d.particles.influencers.DynamicsModifier$PolarAcceleration,isGlobal:false,strengthValue:{active:false,lowMin:0,lowMax:0,highMin:5,highMax:10,relative:false,scaling:[1],timeline:[0]},thetaValue:{active:false,lowMin:0,lowMax:0,highMin:0,highMax:360,relative:false,scaling:[1],timeline:[0]},phiValue:{active:true,lowMin:0,lowMax:0,highMin:-35,highMax:35,relative:false,scaling:[1,0,0],timeline:[0,0.5,1]}}]}],renderer:{class:com.badlogic.gdx.graphics.g3d.particles.renderers.BillboardRenderer}}]}}
Maybe I should somehow specify where to get textures for particleEffects etc. Before I was using 2d particles and could provide a directory where particle textures are found.