Particle3D Rendering behind Sprite

Hi,

I am having 3 Layers and in the Forefront Layer i am creating Particle3D, but its always coming behind the sprite. I tried to mess with Particle3D.setDepthField but no luck. I even tried CppTest examples with setting CameraPerspective but still no luck. Please guide me. In my game there will be 2d & 3d Mix. I am just trying cool 3d Particle Effect in the Front Layer.

1 Like

@pabitrapadhy, Hi, Do u have any idea how to mix 2d & 3d particle system and render it on the front layer. i am finding it very tough to work out both. Please help

I Followed all these questions on the forum 3d and 2d Particle. and this one also z Order between 2d and 3d. But no luck working it out.

Here is my Code

if ( !Layer::init() )
{
    return false;
}

auto rootNode = CSLoader::createNode("MainScene.csb");

addChild(rootNode);

auto winSize = Director::getInstance()->getVisibleSize();
auto origin = Director::getInstance()->getVisibleOrigin();

FileUtils::getInstance()->addSearchPath("res/Particle3D/materials");
FileUtils::getInstance()->addSearchPath("res/Particle3D/scripts");

//auto allChild = m_pNode->getChildren();

auto sprite = Sprite::create("res/HelloWorld.png");
sprite->setPosition(Vec2(winSize.width/2, winSize.height/2));

this->addChild(sprite, -1);

Camera * _camera;

_camera = Camera::createPerspective(30.0f, winSize.width / winSize.height, 1.0f, 1000.0f);
_camera->setPosition3D(Vec3(0.0f, 0.0f, -10.0f));
_camera->lookAt(Vec3(0.0f, 0.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f));
_camera->setCameraFlag(CameraFlag::USER1);
this->addChild(_camera);

auto rootps = PUParticleSystem3D::create("blackHole.pu", "pu_mediapack_01.material");
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
rootps->setPosition(50.0f, 50.0f);

rootps->startParticleSystem();

this->addChild(rootps, 1, PARTICLE_SYSTEM_TAG);

sprite->setGlobalZOrder(1);
rootps->setGlobalZOrder(5);

Please help me out on this.

Hi @jugnu

No I didn’t dive that deep into 3D.
But, here’s a thing that I faced during my experiments.

2D things were always drawn before 3D
for that some Billboard Class is there, which does some certain stuff or something.
but pardon me I didn’t check those details in much.

Let me try to request @super626, if he could help you with something at his spare time.

Best,
Pabitra

ok thanks… will look into billboard class

you try this : http://discuss.cocos2d-x.org/t/puparticlesystem3d-zorder/21149/2