Page 1 of 1

particle transparency

Posted: Tue Nov 01, 2022 11:04 pm
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);
		}
		

Re: particle transparency

Posted: Tue Nov 01, 2022 11:18 pm
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.

Re: particle transparency

Posted: Wed Nov 02, 2022 3:01 am
by Seven
sorry, found the trouble in another part of my code causing this issue. thanks for the push though :)

Re: particle transparency

Posted: Wed Nov 02, 2022 3:12 am
by Seven
I now have a nice little torch for my character to use :)

https://ibb.co/JtFJ6yR

Re: particle transparency

Posted: Wed Nov 02, 2022 10:41 am
by CuteAlien
And health potions which give me Diablo flashbacks ;-)

Re: particle transparency

Posted: Wed Nov 02, 2022 1:40 pm
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 :)

Re: particle transparency

Posted: Wed Nov 02, 2022 3:07 pm
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.

Re: particle transparency

Posted: Wed Nov 02, 2022 4:22 pm
by Seven
btw, you do a fantastic thing by always being available for these silly questions. It is greatly appreciated!

Re: particle transparency

Posted: Wed Nov 02, 2022 4:32 pm
by CuteAlien
Thanks! Actually I'm having fun posting here ;-) Also often learning about things myself that way.