Wrong Displaying by using 3D and 2D particles at same time

All information about Magic Particles: news, question, comments, etc.

Wrong Displaying by using 3D and 2D particles at same time

Postby zjhlogo » Mon Dec 14, 2015 6:04 am

I have 2 particles, one is 3D particle and another is 2D, they all packed in one ptc file. It is display correctly if I update them separately (only update one particle at the same time), but when I update two particle at the same time, 3D particle acted wrong. Do anyone have the same problem ? Or anyone know how can I fix it ?

here is the screenshoot
3D.jpg
correct one, if update only one particles
3D.jpg (111.97 KiB) Viewed 118222 times

3D+2D.jpg
wrong, the arrow fliped and splash all the time
3D+2D.jpg (72.16 KiB) Viewed 118222 times
Last edited by zjhlogo on Wed Dec 16, 2015 5:15 am, edited 1 time in total.
zjhlogo
 
Posts: 5
Joined: Mon Dec 14, 2015 3:43 am

Re: Wrong Displaying by using 3D and 2D particles at same ti

Postby Odin_KG » Mon Dec 14, 2015 2:19 pm

Give me, please, screenshot.
User avatar
Odin_KG
Administrator
Administrator
 
Posts: 255
Joined: Sat May 09, 2009 10:53 pm

Re: Wrong Displaying by using 3D and 2D particles at same ti

Postby zjhlogo » Wed Dec 16, 2015 5:23 am

here is the code relate to the particles:

Code: Select all
bool ParticlesApp::initialize()
{
   if (!BaseApp::initialize()) return false;

   spank::RenderInterface* pRenderInterface = getRenderInterface();

   int axis = MAGIC_pXpYpZ;
   MP_Manager::GetInstance().Initialization(axis, new MP_Platform_WIN_POSIX(), MAGIC_INTERPOLATION_ENABLE, MAGIC_CHANGE_EMITTER_DEFAULT, 1024, 1024, 1, 1.f, 0.1f, true);

   // eng: find of all ptc-files in folder
   MP_Manager::GetInstance().LoadEmittersFromFile("test.ptc");
   MP_Manager::GetInstance().RefreshAtlas();
   MP_Manager::GetInstance().CloseFiles();
   MP_Manager::GetInstance().Stop();

   MP_Emitter* emitter = nullptr;

   emitter = MP_Manager::GetInstance().GetEmitterByName("arrow");
   emitter->SetState(MAGIC_STATE_UPDATE);
   emitter->SetPosition(MP_POSITION(0.0f, 200.0f, 0.0f));
   emitter->SetScale(0.4f);
   Magic_SetLoopMode(emitter->GetEmitter(), MAGIC_FOREVER);

   emitter = MP_Manager::GetInstance().GetEmitterByName("huoxing");
   emitter->SetState(MAGIC_STATE_UPDATE);
   emitter->SetPosition(MP_POSITION(0.0f, 0.0f, 0.0f));
   Magic_SetLoopMode(emitter->GetEmitter(), MAGIC_FOREVER);

   MAGIC_CAMERA camera;
   camera.pos.x = m_cameraPos.x;
   camera.pos.y = m_cameraPos.y;
   camera.pos.z = m_cameraPos.z;
   camera.dir.x = m_lookAt.x - camera.pos.x;
   camera.dir.y = m_lookAt.y - camera.pos.y;
   camera.dir.z = m_lookAt.z - camera.pos.z;
   Magic_SetCamera(&camera);

   return true;
}

void ParticlesApp::selfUpdate(float dt)
{
   static float s_totalTime = 0.0f;

   dt *= 0.1f;
   s_totalTime += dt;

   MP_Emitter* emitter = nullptr;

   emitter = MP_Manager::GetInstance().GetEmitterByName("arrow");
   emitter->Update(dt * 1000.0);

   emitter = MP_Manager::GetInstance().GetEmitterByName("huoxing");
   emitter->Update(dt * 1000.0);

//   MP_Manager::GetInstance().Update(dt * 1000.0);
}

void ParticlesApp::selfRender()
{
   glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

   spank::RenderInterface* pRenderInterface = getRenderInterface();

   pRenderInterface->setCullFace(spank::RenderInterface::CFM_NONE);
    MP_Manager::GetInstance().Render();
   pRenderInterface->setCullFace(spank::RenderInterface::CFM_BACK);

   pRenderInterface->setBlendMode(spank::RenderInterface::BM_NORMAL);
   pRenderInterface->enableDepthWrite(true);
}

zjhlogo
 
Posts: 5
Joined: Mon Dec 14, 2015 3:43 am

Re: Wrong Displaying by using 3D and 2D particles at same ti

Postby Odin_KG » Wed Dec 16, 2015 1:18 pm

Axis Y is directed to UP for 3D emitter. And axis Y is directed to DOWN for 2D emitter. Perhaps it is reason of such behavior. I can offer to transform 2D emitter to 3D. Use the button '3d scene' for it in the editor. 3D API transforms automatically all emitters in 3D, but perhaps the error exists.

I am going to release version 3.3 by New Year. Probably this problem was already solved.
User avatar
Odin_KG
Administrator
Administrator
 
Posts: 255
Joined: Sat May 09, 2009 10:53 pm

Re: Wrong Displaying by using 3D and 2D particles at same ti

Postby zjhlogo » Thu Dec 17, 2015 3:33 am

the "3d scene" did not take any effect, I have to use "3d emitter" to convert them all to 3d emitters. and I found out if I cancel the option of particle "Keep aligned in direction", they all works fine. so may be there is some bugs of calculation of "Keep aligned in direction"
zjhlogo
 
Posts: 5
Joined: Mon Dec 14, 2015 3:43 am

Re: Wrong Displaying by using 3D and 2D particles at same ti

Postby Odin_KG » Thu Dec 17, 2015 5:06 pm

Once I fixed several bugs in version 2.25. Perhaps this bug was fixed too.
http://astralax.com/temp/magic3d.dll

Soon I hope to release version 3.3. And version 2.25 will be outdated.

phpBB [video]
User avatar
Odin_KG
Administrator
Administrator
 
Posts: 255
Joined: Sat May 09, 2009 10:53 pm

Re: Wrong Displaying by using 3D and 2D particles at same ti

Postby zjhlogo » Fri Dec 18, 2015 1:17 am

I replace the "magic3d.dll", It works now. thanks, and keep up the good job.

waiting for the new version ^_^
zjhlogo
 
Posts: 5
Joined: Mon Dec 14, 2015 3:43 am

Re: Wrong Displaying by using 3D and 2D particles at same ti

Postby Odin_KG » Fri Dec 18, 2015 8:46 am

thanks, and keep up the good job.

you are welcome :)
User avatar
Odin_KG
Administrator
Administrator
 
Posts: 255
Joined: Sat May 09, 2009 10:53 pm


Return to Magic Particles

Who is online

Users browsing this forum: No registered users and 5 guests

cron