Jump to content

Помощь с шейдером 'Mta-helper'


Recommended Posts

Добрый день, использую шейдер color.fx & mta-helper.fx для смены цвета текстуры, одежды персонажа. В шейдерах полный нуль, использовал урок от Kernel. Так вот, какая проблема.

Мне необходимо помимо перекраски, накладывать ещё одну текстуру сверху (картинку), если я её накладываю, то в определённых местах мира (в интерьерах с заменами текстур) появляется мерцание этой самой картинки. Если я отключаю mta-helper - мерцания нет, однако тогда текстура слишком яркая, что мне тоже не подходит.

Нужна помощь, как исправить мерцание?

 

164c6fbd98dd.png

dd0c26be5810.png

 

 

#include "mta-helper.fx" 
  
float4 color = 1; 
  
sampler Sampler0 : register( s0 ); 
  
struct VSInput 
{ 
    float4 Position     : POSITION0;  
    float3 Normal   : NORMAL0; 
    float4 Diffuse  : COLOR0; 
    float2 TexCoord     : TEXCOORD0; 
}; 
  
struct PSInput 
{ 
    float4 Position     : POSITION0; 
    float2 TexCoord     : TEXCOORD0; 
    float4 Diffuse  : COLOR0; 
}; 
  
PSInput VertexShaderFunction( VSInput VS ) 
{ 
    PSInput PS = (PSInput)0; 
     
    float4 worldPosition    = mul( VS.Position, gWorld ); 
    float4 viewPosition     = mul( worldPosition, gView ); 
    float4 position         = mul( viewPosition, gProjection ); 
     
    PS.Position     = position; 
    PS.TexCoord     = VS.TexCoord; 
     
    PS.Diffuse      = MTACalcGTAVehicleDiffuse( VS.Normal, VS.Diffuse ); 
     
    return PS; 
} 
  
float4 PixelShaderFunction( PSInput PS ) : COLOR0 
{    
    float4 texColor = tex2D( Sampler0, PS.TexCoord ); 
     
    texColor *= PS.Diffuse * color; 
     
    return texColor; 
} 
  
technique 
{ 
    pass P0 
    { 
        VertexShader    = compile vs_2_0 VertexShaderFunction(); 
        PixelShader     = compile ps_2_0 PixelShaderFunction(); 
    } 
} 

 

Edited by pesnike
Link to comment

Да ладно! Неужели никто не в курсе как решается эта проблема?

Окей, решил уже самостоятельно, тему можно закрывать, жадины.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...