Jump to content

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


Recommended Posts

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 Distraught (see edit history)
  • Metin2 Dev 1
  • Love 14

AxgtRfG.png
C++ programmer at Gameloft

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Activity

    1. 62

      Shop Ex Renewal

    2. 0

      [Problem] : System war between kingdoom

    3. 2

      DDos attacks

    4. 7

      Dynamic Weather

    5. 7

      How to avoid getting flooded in 2021

    6. 47

      Multiple Login Saver System

    7. 0

      BUG SKILL SURA

  • Recently Browsing

    No registered users viewing this page.

×
×
  • 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.