Jump to content

Fix - Effect rendering bug on models with opacity when the effect is inside the model


Distraught

Recommended Posts

  • Honorable Member

There's a bug in the game if you have like an NPC and you set its opacity to less then 1.0 and attach effects to it and the effects are inside the model. The effect will not be rendered because the effect rendering is after character rendering so when it's stenciling it, it won't know what should be seen behind the model.

 

To fix this we just have to pre-render the effects in this case.

To achieve this add this code to the beginning of CActorInstance::OnRender

if (GetAlphaValue() < 1.0f)
{
	for (auto it = m_AttachingEffectList.begin(); it != m_AttachingEffectList.end(); ++it)
	{
		CEffectManager::Instance().SelectEffectInstance(it->dwEffectIndex);
		CEffectManager::Instance().RenderEffect();
	}
}

 

and add a new method to CEffectManager in EffectLib/EffectManager.h:

void RenderEffect();

and for sure define it in EffectManager.cpp

void CEffectManager::RenderEffect()
{
	if (!m_pSelectedEffectInstance)
		return;

	m_pSelectedEffectInstance->Render();
}

 

Now you can create eg. mounts with effects like this:

iv0e0zA.png

 

Hope you like it and will be useful! ;)

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Love 15

WRnRW3H.gif

Link to comment
Share on other sites

  • Management
Link to comment
Share on other sites

  • 1 year later...

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.