Jump to content

Recommended Posts

  • Active+ Member
LensFlare.cpp
//search

RenderBar2d(0.0f, 0.0f, 1024.0f, 1024.0f);

//change

RenderBar2d(0.0f, 0.0f, (float)ms_Viewport.Width, (float)ms_Viewport.Height);

MapOutdoorRender.cpp
//search

m_LensFlare.Compute(mc_pEnvironmentData->DirLights[ENV_DIRLIGHT_BACKGROUND].Direction);

//change

    D3DXVECTOR3 v3SunDir = mc_pEnvironmentData->DirLights[ENV_DIRLIGHT_BACKGROUND].Direction;
    D3DXVec3Normalize(&v3SunDir, &v3SunDir);
    m_LensFlare.Compute(v3SunDir);

//search
D3DXVECTOR3 v3Target = pCamera->GetTarget();

    D3DXVECTOR3 v3LightEye(v3Target.x - 1.732f * 1250.0f,
                           v3Target.y - 1250.0f,
                           v3Target.z + 2.0f * 1.732f * 1250.0f);

//change

    D3DXVECTOR3 v3SunDir = mc_pEnvironmentData->DirLights[ENV_DIRLIGHT_BACKGROUND].Direction;

    D3DXVec3Normalize(&v3SunDir, &v3SunDir);

    D3DXVECTOR3 v3Target = pCamera->GetTarget();

    D3DXVECTOR3 v3LightEye = v3Target + v3SunDir * 5000.0f;

MapOutdoorCharacterShadow.cpp
//search
    D3DXVECTOR3 v3Eye(v3Target.x - 1.732f * 1250.0f,
                      v3Target.y - 1250.0f,
                      v3Target.z + 2.0f * 1.732f * 1250.0f);

//change
    D3DXVECTOR3 v3SunDir = mc_pEnvironmentData->DirLights[ENV_DIRLIGHT_BACKGROUND].Direction;

    D3DXVec3Normalize(&v3SunDir, &v3SunDir);

    D3DXVECTOR3 v3Eye = v3Target + v3SunDir * 5000.0f;

In the relevant map's msenv file, the value next to `enable` should be 1.

spacer.png

result

spacer.png

 

example c1.msenv

ScriptType         EnvrionmentData
ScriptVersion      1.0000

Group DirectionalLight
{
    Direction     0.450000 0.720000 -0.150000

    Group Background
    {
        Enable        1
        Diffuse       1.000000 0.972549 0.972549 1.000000
        Ambient       0.000000 0.000000 0.000000 1.000000
    }

    Group Character
    {
        Enable        1
        Diffuse       1.000000 0.972549 0.972549 1.000000
        Ambient       0.150000 0.150000 0.150000 1.000000
    }
}
Group Material
{
    Diffuse       1.000000 1.000000 1.000000 1.000000
    Ambient       0.882353 0.854902 0.784314 1.000000
    Emissive      0.321569 0.321569 0.411765 1.000000
}

Group Fog
{
    Enable        1
    NearDistance  5000.000000
    FarDistance   20000.000000
    Color         0.690196 0.741176 0.839216 1.000000
}

Group Filter
{
    Enable        0
    Color         0.556863 0.329412 0.329412 0.000000
    AlphaSrc      1
    AlphaDest     2
}

Group SkyBox
{
    Scale                 3500.000000 3500.000000 3500.000000
    GradientLevelUpper    4
    GradientLevelLower    1

    CloudScale            200000.000000 200000.000000
    CloudHeight           30000.000000
    CloudTextureScale     4.000000 4.000000
    CloudSpeed            0.004000 0.004000
    CloudTextureFileName  "d:/ymir work/environment/clouds_zone01.tga"
    List CloudColor
    {
        0.000000 0.000000 0.000000 0.000000
        0.000000 0.000000 0.000000 0.000000
    }
    List Gradient
    {
        0.094118 0.286275 0.658824 0.000000
        0.231373 0.403922 0.729412 0.000000

        0.231373 0.403922 0.729412 0.000000
        0.376471 0.498039 0.729412 0.000000

        0.376471 0.498039 0.729412 0.000000
        0.568627 0.678431 0.882353 0.000000

        0.568627 0.678431 0.882353 0.000000
        0.850980 0.901961 1.000000 0.000000

        0.850980 0.901961 1.000000 0.000000
        0.533333 0.564706 0.623529 0.000000
    }
}

Group LensFlare
{
    Enable                     1
    BrightnessColor            1.000000 0.886275 0.886275 1.000000
    MaxBrightness              0.740000
    MainFlareEnable            1
    MainFlareTextureFileName   "D:\Ymir Work\environment\sunflare.dds"
    MainFlareSize              0.350000
}

 

Edited by hasanmacit
A more organized code was written instead of hard code.
  • Metin2 Dev 3
  • Love 2

hasanmacit

Link to comment
https://metin2.dev/topic/34236-using-lensflare-effectively/
Share on other sites

  • 1 month later...
  • Active+ Member
58 minutes ago, TrC said:

wtf? 47bcb88c31a989275eef98f9c923bb2b.png

I updated the shadows to reflect the sun's position. It will be more realistic.

Edited by Metin2 Dev International
Core X - External 2 Internal

hasanmacit

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.