particle transparency

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Seven
Posts: 1030
Joined: Mon Nov 14, 2005 2:03 pm

particle transparency

Post by Seven »

having trouble with particle transparency using this code...particles appear with texture, but no transparency?
is there another setting that I need to enable?
using fire.bmp as the texture.

Code: Select all

		virtual void createSceneNodes()
		{
			IGE_Object::createSceneNodes();

			vector3df scale = getAbsoluteScale() + getScaleOffset();
			vector3df pos = getAbsolutePosition();
			vector3df rot = getAbsoluteRotation();

			m_Box = aabbox3d<f32>(-getAbsoluteScale().X, -getAbsoluteScale().Y, -getAbsoluteScale().Z, getAbsoluteScale().X, getAbsoluteScale().Y, getAbsoluteScale().Z);

			m_Ps = getSmgr()->addParticleSystemSceneNode(false, 0, getId(), pos, rot, scale);
			m_Ps->setMaterialFlag(E_MATERIAL_FLAG::EMF_LIGHTING,  getLevel()->getUseLight());
			m_Ps->setMaterialFlag(E_MATERIAL_FLAG::EMF_FOG_ENABLE, getLevel()->getUseFog());

			m_Em = m_Ps->createBoxEmitter(
				m_Box,
				m_Direction,
				m_MinParticlesPerSecond, m_MaxParticlesPerSecond,
				m_MinStartColor, m_MaxStartColor,
				m_LifeTimeMin, m_LifeTimeMax,
				m_MaxAngleDegrees,
				m_MinStartSize, m_MaxStartSize);

			m_Ps->setEmitter(m_Em);
			m_Em->drop();

			m_Paf = m_Ps->createFadeOutParticleAffector();
			m_Ps->addAffector(m_Paf);
			m_Paf->drop();

			m_Ps->setMaterialFlag(EMF_LIGHTING, getLevel()->getUseLight());
			m_Ps->setMaterialFlag(EMF_FOG_ENABLE, getLevel()->getUseFog());
			m_Ps->setMaterialFlag(EMF_ZWRITE_ENABLE, false);
			m_Ps->setMaterialTexture(0, getDriver()->getTexture(MEDIAPATH(getTexture0Filename())));
			m_Ps->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
		}
		
CuteAlien
Admin
Posts: 9643
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: particle transparency

Post by CuteAlien »

Hm, try if setting material BlendOperation to irr::video::EBO_ADD makes a difference. Otherwise try the other transparent materials, I'm not too certain about how this one works.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Seven
Posts: 1030
Joined: Mon Nov 14, 2005 2:03 pm

Re: particle transparency

Post by Seven »

sorry, found the trouble in another part of my code causing this issue. thanks for the push though :)
Seven
Posts: 1030
Joined: Mon Nov 14, 2005 2:03 pm

Re: particle transparency

Post by Seven »

I now have a nice little torch for my character to use :)

https://ibb.co/JtFJ6yR
CuteAlien
Admin
Posts: 9643
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: particle transparency

Post by CuteAlien »

And health potions which give me Diablo flashbacks ;-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Seven
Posts: 1030
Joined: Mon Nov 14, 2005 2:03 pm

Re: particle transparency

Post by Seven »

hehehe, you gotta love Diablo. As you can see, my first gui attempt is remarkably similar to Diablo's.
The gui is much more difficult than I would have imagined. Not the gui itself, but how to get everything interacting properly. So far it looks good. drag and drop works, moving from inventory to world and back works good. currently working on what happens when you right click to 'use' something in the inventory. (the potions work fine since it can send an event to the character class, but the torch needs to add a light back to the world while attaching itself to the character and a scroll might need to cast a spell into the world, maybe attached to the character or maybe not. Working on a system that isnt hard coded in the character class but instead allows the item itself to do the work. this allows me to create any type of object / item and pop it into the game.
so far so good, but time will tell :)
CuteAlien
Admin
Posts: 9643
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: particle transparency

Post by CuteAlien »

Yeah, amount of work for GUI is always a surprise. It was also what I spend most time on in my racer. Not editor or AI or physics, nope, GUI.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Seven
Posts: 1030
Joined: Mon Nov 14, 2005 2:03 pm

Re: particle transparency

Post by Seven »

btw, you do a fantastic thing by always being available for these silly questions. It is greatly appreciated!
CuteAlien
Admin
Posts: 9643
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: particle transparency

Post by CuteAlien »

Thanks! Actually I'm having fun posting here ;-) Also often learning about things myself that way.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply