mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 19:56:38 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			61 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| void main_vp
 | |
| (
 | |
|     in float4 inPos : POSITION,
 | |
| 
 | |
|     out float4 pos : POSITION,
 | |
|     out float2 uv0 : TEXCOORD0,
 | |
|     out float4 noiseCoord : TEXCOORD1,
 | |
| 
 | |
|     uniform float4x4 worldViewProj,
 | |
|     uniform float timeVal,
 | |
|     uniform float scale
 | |
| )
 | |
| {
 | |
|     // Use standardise transform, so work accord with render system specific (RS depth, requires texture flipping, etc)
 | |
|     pos = mul(worldViewProj, inPos);
 | |
| 
 | |
|     // The input positions adjusted by texel offsets, so clean up inaccuracies
 | |
|     inPos.xy = sign(inPos.xy);
 | |
| 
 | |
|     // Convert to image-space
 | |
|     uv0 = (float2(inPos.x, -inPos.y) + 1.0f) * 0.5f;
 | |
|     noiseCoord = (pos + timeVal) * scale;
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
| float4 main_fp_nomrt (float2 iTexCoord : TEXCOORD0,
 | |
|        	       float3 noiseCoord : TEXCOORD1,
 | |
|                uniform sampler2D RT : register(s0),
 | |
|                uniform sampler2D NormalMap : register(s1),
 | |
|                uniform sampler2D CausticMap : register(s2),
 | |
|        	       uniform float4 tintColour) : COLOR
 | |
| {
 | |
| 	float4 normal = tex2D(NormalMap, noiseCoord) * 2 - 1;
 | |
| 
 | |
| 	return tex2D(RT, iTexCoord + normal.xy * 0.015) +
 | |
| 	       (tex2D(CausticMap, noiseCoord) / 5) +
 | |
| 	       tintColour ;
 | |
| }
 | |
| 
 | |
| 
 | |
| float4 main_fp (float2 iTexCoord : TEXCOORD0,
 | |
|        	       float3 noiseCoord : TEXCOORD1,
 | |
|                uniform float far,
 | |
|                uniform sampler2D RT : register(s0),
 | |
|                uniform sampler2D NormalMap : register(s1),
 | |
|                uniform sampler2D CausticMap : register(s2),
 | |
|                uniform sampler2D DepthMap : register(s3),
 | |
|        	       uniform float4 tintColour) : COLOR
 | |
| {
 | |
| 	float4 normal = tex2D(NormalMap, noiseCoord) * 2 - 1;
 | |
| 
 | |
|     float depth = tex2D(DepthMap, iTexCoord + normal.xy * 0.015).r * far;
 | |
|     depth = saturate(depth / 2000.f);
 | |
| 
 | |
|     float4 color = tex2D(RT, iTexCoord + normal.xy * 0.015) +
 | |
| 	       (tex2D(CausticMap, noiseCoord) / 5) +
 | |
| 	       tintColour;
 | |
| 
 | |
| 	return lerp(color, float4(0, 0.65, 0.65, 1), depth);
 | |
| }
 |