Jump to content

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


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 16

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

  • Honorable Member
1 hour ago, ASIKOO said:

 

It's done.

Oh, thank you ☺️

  • Metin2 Dev 2
  • Love 1

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

  • 1 year later...
  • Active+ Member

@ Distraught Thanks for the release, but it will make a visual bug in character select. You can see the select target on characters.

Edited by ReFresh
Core X - External 2 Internal

I'll be always helpful!  😉

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.