Diff
checker
텍스트
텍스트
이미지
문서
Excel
폴더
Legal
Enterprise
데스크톱
요금제
로그인
데스크톱 앱 다운로드
텍스트 비교
두 텍스트 파일의 차이점을 찾아보세요
도구
기록
실시간 편집
변경 없는 행 숨기기
줄바꿈 비활성화
레이아웃
나란히 보기
합쳐 보기
비교 단위
스마트
단어
글자
구문 강조
언어 선택
제외
텍스트 변환
첫 변경으로
수정
Diffchecker Desktop
가장 안전하게 Diffchecker를 사용하는 방법. 데스크톱 앱을 사용하면 비교 데이터가 외부로 전송되지 않습니다!
데스크톱 앱 받기
water.ps [water fog fix skyloader]
생성일
5년 전
비교 결과 만료 없음
초기화
내보내기
공유
설명
4 삭제
행
총
삭제
글자
총
삭제
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
131 행
복사
16 추가
행
총
추가
글자
총
추가
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
141 행
복사
#include "common.h"
#include "common.h"
struct vf
struct vf
{
{
float4 hpos : POSITION ;
float4 hpos : POSITION ;
float2 tbase : TEXCOORD0 ; // base
float2 tbase : TEXCOORD0 ; // base
float2 tnorm0 : TEXCOORD1 ; // nm0
float2 tnorm0 : TEXCOORD1 ; // nm0
float2 tnorm1 : TEXCOORD2 ; // nm1
float2 tnorm1 : TEXCOORD2 ; // nm1
half3 M1 : TEXCOORD3 ;
half3 M1 : TEXCOORD3 ;
half3 M2 : TEXCOORD4 ;
half3 M2 : TEXCOORD4 ;
half3 M3 : TEXCOORD5 ;
half3 M3 : TEXCOORD5 ;
half3 v2point : TEXCOORD6 ;
half3 v2point : TEXCOORD6 ;
복사
복사됨
복사
복사됨
#ifdef USE_SOFT_WATER
#ifdef NEED_SOFT_WATER
float4 tctexgen : TEXCOORD7 ;
float4 tctexgen : TEXCOORD7 ;
복사
복사됨
복사
복사됨
#endif // USE_SOFT_WATER
#endif // NEED_SOFT_WATER
half4 c0 : COLOR0 ;
half4 c0 : COLOR0 ;
복사
복사됨
복사
복사됨
//
float fog : FOG ;
float fog : FOG ;
};
};
uniform sampler2D s_nmap;
uniform sampler2D s_nmap;
uniform samplerCUBE s_env0;
uniform samplerCUBE s_env0;
uniform samplerCUBE s_env1;
uniform samplerCUBE s_env1;
uniform sampler2D s_leaves;
uniform sampler2D s_leaves;
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
#if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
복사
복사됨
복사
복사됨
half3 water_intensity;
uniform
half3 water_intensity;
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
#endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER)
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Pixel
// Pixel
/*
/*
half4 main ( v2p I ) : COLOR
half4 main ( v2p I ) : COLOR
{
{
half4 t_base = tex2D (s_base,I.tbase);
half4 t_base = tex2D (s_base,I.tbase);
half3 t_env = texCUBE (s_env, I.tenv);
half3 t_env = texCUBE (s_env, I.tenv);
half3 refl = lerp (t_env,t_base,I.c0.a);
half3 refl = lerp (t_env,t_base,I.c0.a);
half3 color = lerp (refl, t_base,t_base.a);
half3 color = lerp (refl, t_base,t_base.a);
half3 final = color*I.c0*2 ;
half3 final = color*I.c0*2 ;
half alpha_shift = saturate(.5-I.c0.a);
half alpha_shift = saturate(.5-I.c0.a);
half alpha_add = alpha_shift*alpha_shift;
half alpha_add = alpha_shift*alpha_shift;
half alpha = t_base.a;
half alpha = t_base.a;
// out
// out
return half4 (final, t_base.a ); //t_base.a + (1-I.c0.a)); //half4 (final, t_base.a );
return half4 (final, t_base.a ); //t_base.a + (1-I.c0.a)); //half4 (final, t_base.a );
}
}
*/
*/
half4 main( vf I ) : COLOR
half4 main( vf I ) : COLOR
{
{
half4 base = tex2D (s_base,I.tbase);
half4 base = tex2D (s_base,I.tbase);
half3 n0 = tex2D (s_nmap,I.tnorm0);
half3 n0 = tex2D (s_nmap,I.tnorm0);
half3 n1 = tex2D (s_nmap,I.tnorm1);
half3 n1 = tex2D (s_nmap,I.tnorm1);
half3 Navg = n0 + n1 - 1;
half3 Navg = n0 + n1 - 1;
half3 Nw = mul (half3x3(I.M1, I.M2, I.M3), Navg);
half3 Nw = mul (half3x3(I.M1, I.M2, I.M3), Navg);
Nw = normalize (Nw);
Nw = normalize (Nw);
half3 v2point = normalize (I.v2point);
half3 v2point = normalize (I.v2point);
half3 vreflect= reflect(v2point, Nw);
half3 vreflect= reflect(v2point, Nw);
vreflect.y= vreflect.y*2-1; // fake remapping
vreflect.y= vreflect.y*2-1; // fake remapping
/* // true remapping. Slow.
/* // true remapping. Slow.
half3 vreflectabs = abs(vreflect);
half3 vreflectabs = abs(vreflect);
half vreflectmax = max( vreflectabs.x, max(vreflectabs.y, vreflectabs.z));
half vreflectmax = max( vreflectabs.x, max(vreflectabs.y, vreflectabs.z));
vreflect /= vreflectmax;
vreflect /= vreflectmax;
if (vreflect.y<0.99)
if (vreflect.y<0.99)
vreflect.y = vreflect.y*2-1;
vreflect.y = vreflect.y*2-1;
*/
*/
half3 env0 = texCUBE (s_env0, vreflect);
half3 env0 = texCUBE (s_env0, vreflect);
half3 env1 = texCUBE (s_env1, vreflect);
half3 env1 = texCUBE (s_env1, vreflect);
half3 env = lerp (env0,env1,L_ambient.w);
half3 env = lerp (env0,env1,L_ambient.w);
env *= env*2;
env *= env*2;
half fresnel = saturate (dot(vreflect,v2point));
half fresnel = saturate (dot(vreflect,v2point));
half power = pow(fresnel,9);
half power = pow(fresnel,9);
half amount = 0.15h+0.25h*power; // 1=full env, 0=no env
half amount = 0.15h+0.25h*power; // 1=full env, 0=no env
half3 c_reflection = env*amount;
half3 c_reflection = env*amount;
half3 final = lerp(c_reflection,base.rgb,base.a);
half3 final = lerp(c_reflection,base.rgb,base.a);
final *= I.c0*2;
final *= I.c0*2;
// tonemap
// tonemap
#ifdef USE_VTF
#ifdef USE_VTF
// final *= I.c0.w ;
// final *= I.c0.w ;
#else
#else
// final *= tex2D (s_tonemap,I.tbase).x ; // any TC - OK
// final *= tex2D (s_tonemap,I.tbase).x ; // any TC - OK
#endif
#endif
#ifdef NEED_SOFT_WATER
#ifdef NEED_SOFT_WATER
half alpha = 0.75h+0.25h*power; // 1=full env, 0=no env
half alpha = 0.75h+0.25h*power; // 1=full env, 0=no env
#ifdef USE_SOFT_WATER
#ifdef USE_SOFT_WATER
// Igor: additional depth test
// Igor: additional depth test
half4 _P = tex2Dproj( s_position, I.tctexgen);
half4 _P = tex2Dproj( s_position, I.tctexgen);
half waterDepth = _P.z-I.tctexgen.z;
half waterDepth = _P.z-I.tctexgen.z;
// water fog
// water fog
half fog_exp_intens = -4.0h;
half fog_exp_intens = -4.0h;
float fog = 1-exp(fog_exp_intens*waterDepth);
float fog = 1-exp(fog_exp_intens*waterDepth);
half3 Fc = half3( 0.1h, 0.1h, 0.1h) * water_intensity.r;
half3 Fc = half3( 0.1h, 0.1h, 0.1h) * water_intensity.r;
// half3 Fc = lerp(half3( 1.0h, 0.0h, 0.0h), half3( 0.0h, 1.0h, 0.0h), water_intensity.r);
// half3 Fc = lerp(half3( 1.0h, 0.0h, 0.0h), half3( 0.0h, 1.0h, 0.0h), water_intensity.r);
// half3 Fc = half3( 0.1h, 0.1h, 0.2h);
// half3 Fc = half3( 0.1h, 0.1h, 0.2h);
// half3 Fc = half3( 1.0h, 0.0h, 0.0h);
// half3 Fc = half3( 1.0h, 0.0h, 0.0h);
final = lerp (Fc, final, alpha);
final = lerp (Fc, final, alpha);
alpha = min(alpha, saturate(waterDepth));
alpha = min(alpha, saturate(waterDepth));
alpha = max (fog, alpha);
alpha = max (fog, alpha);
// Leaves
// Leaves
half4 leaves = tex2D(s_leaves, I.tbase);
half4 leaves = tex2D(s_leaves, I.tbase);
leaves.rgb *= water_intensity.r;
leaves.rgb *= water_intensity.r;
half calc_cos = -dot(float3(I.M1.z, I.M2.z, I.M3.z), normalize(v2point));
half calc_cos = -dot(float3(I.M1.z, I.M2.z, I.M3.z), normalize(v2point));
half calc_depth = saturate(waterDepth*calc_cos);
half calc_depth = saturate(waterDepth*calc_cos);
half fLeavesFactor = smoothstep(0.025, 0.05, calc_depth );
half fLeavesFactor = smoothstep(0.025, 0.05, calc_depth );
fLeavesFactor *= smoothstep(0.1, 0.075, calc_depth );
fLeavesFactor *= smoothstep(0.1, 0.075, calc_depth );
final = lerp(final, leaves, leaves.a*fLeavesFactor);
final = lerp(final, leaves, leaves.a*fLeavesFactor);
alpha = lerp(alpha, leaves.a, leaves.a*fLeavesFactor);
alpha = lerp(alpha, leaves.a, leaves.a*fLeavesFactor);
#endif // USE_SOFT_WATER
#endif // USE_SOFT_WATER
복사
복사됨
복사
복사됨
return half4 (final,
alpha*I.c0.a*I.c0.a
) ;
// Fogging
final = lerp(fog_color, final, I.fog);
alpha *= I.fog*I.fog;
return half4 (final,
alpha
) ;
#else // NEED_SOFT_WATER
#else // NEED_SOFT_WATER
복사
복사됨
복사
복사됨
return
half4
(final,
1
) ;
// Fogging
final = lerp(fog_color, final, I.fog);
return
float4
(final,
I.fog*I.fog
) ;
#endif // NEED_SOFT_WATER
#endif // NEED_SOFT_WATER
}
}
저장된 비교 결과
원본
파일 열기
#include "common.h" struct vf { float4 hpos : POSITION ; float2 tbase : TEXCOORD0 ; // base float2 tnorm0 : TEXCOORD1 ; // nm0 float2 tnorm1 : TEXCOORD2 ; // nm1 half3 M1 : TEXCOORD3 ; half3 M2 : TEXCOORD4 ; half3 M3 : TEXCOORD5 ; half3 v2point : TEXCOORD6 ; float4 tctexgen : TEXCOORD7 ; half4 c0 : COLOR0 ; // float fog : FOG ; }; uniform sampler2D s_nmap; uniform samplerCUBE s_env0; uniform samplerCUBE s_env1; uniform sampler2D s_leaves; #if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER) half3 water_intensity; #endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER) //////////////////////////////////////////////////////////////////////////////// // Pixel /* half4 main ( v2p I ) : COLOR { half4 t_base = tex2D (s_base,I.tbase); half3 t_env = texCUBE (s_env, I.tenv); half3 refl = lerp (t_env,t_base,I.c0.a); half3 color = lerp (refl, t_base,t_base.a); half3 final = color*I.c0*2 ; half alpha_shift = saturate(.5-I.c0.a); half alpha_add = alpha_shift*alpha_shift; half alpha = t_base.a; // out return half4 (final, t_base.a ); //t_base.a + (1-I.c0.a)); //half4 (final, t_base.a ); } */ half4 main( vf I ) : COLOR { half4 base = tex2D (s_base,I.tbase); half3 n0 = tex2D (s_nmap,I.tnorm0); half3 n1 = tex2D (s_nmap,I.tnorm1); half3 Navg = n0 + n1 - 1; half3 Nw = mul (half3x3(I.M1, I.M2, I.M3), Navg); Nw = normalize (Nw); half3 v2point = normalize (I.v2point); half3 vreflect= reflect(v2point, Nw); vreflect.y= vreflect.y*2-1; // fake remapping /* // true remapping. Slow. half3 vreflectabs = abs(vreflect); half vreflectmax = max( vreflectabs.x, max(vreflectabs.y, vreflectabs.z)); vreflect /= vreflectmax; if (vreflect.y<0.99) vreflect.y = vreflect.y*2-1; */ half3 env0 = texCUBE (s_env0, vreflect); half3 env1 = texCUBE (s_env1, vreflect); half3 env = lerp (env0,env1,L_ambient.w); env *= env*2; half fresnel = saturate (dot(vreflect,v2point)); half power = pow(fresnel,9); half amount = 0.15h+0.25h*power; // 1=full env, 0=no env half3 c_reflection = env*amount; half3 final = lerp(c_reflection,base.rgb,base.a); final *= I.c0*2; // tonemap #ifdef USE_VTF // final *= I.c0.w ; #else // final *= tex2D (s_tonemap,I.tbase).x ; // any TC - OK #endif #ifdef NEED_SOFT_WATER half alpha = 0.75h+0.25h*power; // 1=full env, 0=no env #ifdef USE_SOFT_WATER // Igor: additional depth test half4 _P = tex2Dproj( s_position, I.tctexgen); half waterDepth = _P.z-I.tctexgen.z; // water fog half fog_exp_intens = -4.0h; float fog = 1-exp(fog_exp_intens*waterDepth); half3 Fc = half3( 0.1h, 0.1h, 0.1h) * water_intensity.r; // half3 Fc = lerp(half3( 1.0h, 0.0h, 0.0h), half3( 0.0h, 1.0h, 0.0h), water_intensity.r); // half3 Fc = half3( 0.1h, 0.1h, 0.2h); // half3 Fc = half3( 1.0h, 0.0h, 0.0h); final = lerp (Fc, final, alpha); alpha = min(alpha, saturate(waterDepth)); alpha = max (fog, alpha); // Leaves half4 leaves = tex2D(s_leaves, I.tbase); leaves.rgb *= water_intensity.r; half calc_cos = -dot(float3(I.M1.z, I.M2.z, I.M3.z), normalize(v2point)); half calc_depth = saturate(waterDepth*calc_cos); half fLeavesFactor = smoothstep(0.025, 0.05, calc_depth ); fLeavesFactor *= smoothstep(0.1, 0.075, calc_depth ); final = lerp(final, leaves, leaves.a*fLeavesFactor); alpha = lerp(alpha, leaves.a, leaves.a*fLeavesFactor); #endif // USE_SOFT_WATER return half4 (final, alpha*I.c0.a*I.c0.a ) ; #else // NEED_SOFT_WATER return half4 (final, 1 ) ; #endif // NEED_SOFT_WATER }
수정본
파일 열기
#include "common.h" struct vf { float4 hpos : POSITION ; float2 tbase : TEXCOORD0 ; // base float2 tnorm0 : TEXCOORD1 ; // nm0 float2 tnorm1 : TEXCOORD2 ; // nm1 half3 M1 : TEXCOORD3 ; half3 M2 : TEXCOORD4 ; half3 M3 : TEXCOORD5 ; half3 v2point : TEXCOORD6 ; #ifdef USE_SOFT_WATER #ifdef NEED_SOFT_WATER float4 tctexgen : TEXCOORD7 ; #endif // USE_SOFT_WATER #endif // NEED_SOFT_WATER half4 c0 : COLOR0 ; float fog : FOG ; }; uniform sampler2D s_nmap; uniform samplerCUBE s_env0; uniform samplerCUBE s_env1; uniform sampler2D s_leaves; #if defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER) uniform half3 water_intensity; #endif // defined(USE_SOFT_WATER) && defined(NEED_SOFT_WATER) //////////////////////////////////////////////////////////////////////////////// // Pixel /* half4 main ( v2p I ) : COLOR { half4 t_base = tex2D (s_base,I.tbase); half3 t_env = texCUBE (s_env, I.tenv); half3 refl = lerp (t_env,t_base,I.c0.a); half3 color = lerp (refl, t_base,t_base.a); half3 final = color*I.c0*2 ; half alpha_shift = saturate(.5-I.c0.a); half alpha_add = alpha_shift*alpha_shift; half alpha = t_base.a; // out return half4 (final, t_base.a ); //t_base.a + (1-I.c0.a)); //half4 (final, t_base.a ); } */ half4 main( vf I ) : COLOR { half4 base = tex2D (s_base,I.tbase); half3 n0 = tex2D (s_nmap,I.tnorm0); half3 n1 = tex2D (s_nmap,I.tnorm1); half3 Navg = n0 + n1 - 1; half3 Nw = mul (half3x3(I.M1, I.M2, I.M3), Navg); Nw = normalize (Nw); half3 v2point = normalize (I.v2point); half3 vreflect= reflect(v2point, Nw); vreflect.y= vreflect.y*2-1; // fake remapping /* // true remapping. Slow. half3 vreflectabs = abs(vreflect); half vreflectmax = max( vreflectabs.x, max(vreflectabs.y, vreflectabs.z)); vreflect /= vreflectmax; if (vreflect.y<0.99) vreflect.y = vreflect.y*2-1; */ half3 env0 = texCUBE (s_env0, vreflect); half3 env1 = texCUBE (s_env1, vreflect); half3 env = lerp (env0,env1,L_ambient.w); env *= env*2; half fresnel = saturate (dot(vreflect,v2point)); half power = pow(fresnel,9); half amount = 0.15h+0.25h*power; // 1=full env, 0=no env half3 c_reflection = env*amount; half3 final = lerp(c_reflection,base.rgb,base.a); final *= I.c0*2; // tonemap #ifdef USE_VTF // final *= I.c0.w ; #else // final *= tex2D (s_tonemap,I.tbase).x ; // any TC - OK #endif #ifdef NEED_SOFT_WATER half alpha = 0.75h+0.25h*power; // 1=full env, 0=no env #ifdef USE_SOFT_WATER // Igor: additional depth test half4 _P = tex2Dproj( s_position, I.tctexgen); half waterDepth = _P.z-I.tctexgen.z; // water fog half fog_exp_intens = -4.0h; float fog = 1-exp(fog_exp_intens*waterDepth); half3 Fc = half3( 0.1h, 0.1h, 0.1h) * water_intensity.r; // half3 Fc = lerp(half3( 1.0h, 0.0h, 0.0h), half3( 0.0h, 1.0h, 0.0h), water_intensity.r); // half3 Fc = half3( 0.1h, 0.1h, 0.2h); // half3 Fc = half3( 1.0h, 0.0h, 0.0h); final = lerp (Fc, final, alpha); alpha = min(alpha, saturate(waterDepth)); alpha = max (fog, alpha); // Leaves half4 leaves = tex2D(s_leaves, I.tbase); leaves.rgb *= water_intensity.r; half calc_cos = -dot(float3(I.M1.z, I.M2.z, I.M3.z), normalize(v2point)); half calc_depth = saturate(waterDepth*calc_cos); half fLeavesFactor = smoothstep(0.025, 0.05, calc_depth ); fLeavesFactor *= smoothstep(0.1, 0.075, calc_depth ); final = lerp(final, leaves, leaves.a*fLeavesFactor); alpha = lerp(alpha, leaves.a, leaves.a*fLeavesFactor); #endif // USE_SOFT_WATER // Fogging final = lerp(fog_color, final, I.fog); alpha *= I.fog*I.fog; return half4 (final, alpha ) ; #else // NEED_SOFT_WATER // Fogging final = lerp(fog_color, final, I.fog); return float4 (final, I.fog*I.fog ) ; #endif // NEED_SOFT_WATER }
비교하기