Thread: [WIP] The SH5 EcoMod
View Single Post
Old 02-15-19, 06:17 PM   #182
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,214
Downloads: 793
Uploads: 10
Default

Okay, on my rig, the patch I have uploaded this afternoon fixed for good all the tiny lines; I play the game at the same resolution as you, but as I said video card and graphic settings might also play a role.

Reproducing your exact conditions would be impossible for me, so may I ask you a favour?

This is the code of the shader (ForestVS.fx) I have edited for patch 0.2.2:

Code:
float4x4 g_matWVP		: register(c0);
float3 SunLightDir		: register(c4);
float3 g_eyePos			: register(c5);

#ifdef OUTPUTDEPTH
float3	g_world			: register(c6);
#endif

struct VS_IN
{
     float4 pos		  : POSITION;                
     float3 texCoord  : TEXCOORD0;
};

struct VS_OUT
{
	float4 projPos		: POSITION;
    float2 texCoord		: TEXCOORD0;
    float4 pos			: TEXCOORD1;
};

const static float3 g_texCoords[36] = 
{
	{0,		0,  0},
	{-0.0002,	0,  1},
	
	{0.125,		0,  0},
	{0.1248,	0,  1},
	
	{0.25,		0,  0},
	{0.2498,	0,  1},
	
	{0.375,		0,  0},
	{0.3748,	0,  1},	
	
	{0.5,		0,  0},
	{0.4998,	0,  1},	
	
	{0.625,		0,  0},
	{0.6248,	0,  1},	
	
	{0.75,		0,  0},
	{0.7498,	0,  1},	
	
	{0.875,		0,  0},
	{0.8748,	0,  1},	
	
	{1,		0,  0},
	{0.9998,	0,  1},	
	
///////////////////////////

	{0,		1,  0},
	{-0.0002,	1,  1},
	
	{0.125, 	1,  0},
	{0.1248,	1,  1},
	
	{0.25,		1,  0},
	{0.2498,	1,  1},
	
	{0.375, 	1,  0},
	{0.3748,	1,  1},	
	
	{0.5,		1,  0},
	{0.4998,	1,  1},	
	
	{0.625, 	1,  0},
	{0.6248,	1,  1},	
	
	{0.75,		1,  0},
	{0.7498,	1,  1},	
	
	{0.875,		1,  0},
	{0.8748,	1,  1},	
	
	{1,		1,  0},
	{0.9998,	1,  1},	
};

static const float decompressVal = (32767.0 / 2048.0);

VS_OUT main ( VS_IN In )
{
	VS_OUT Out;
	
	const float3 up = float3(0, 1, 0);
#ifdef OUTPUTDEPTH	
	float3 viewDir	= normalize(SunLightDir - In.pos);// depth from the light's perspective - works only 

for shadow maps
#else
	float3 viewDir	= (In.pos - g_eyePos);
#endif	
	float3 right	= normalize(float3(-viewDir.z, 0, viewDir.x));//normalize(cross(viewDir, up));//
	//float3 up		= normalize(cross(right, viewDir));// this can be skipped if a top 

perspective is not allowed

	// decompress verts
	In.texCoord.x  *= 32767;
	In.texCoord.yz *= decompressVal;
	
	float3 texCoord = g_texCoords[(int)In.texCoord.x];
	
	// move position based on texture coordinates
	float3 outPos = In.pos;	
	
#ifdef OUTPUTDEPTH
	outPos += g_world;
#endif	

	outPos += right * ( (texCoord.y - 0.5f) * In.texCoord.y );
	outPos += up * ( texCoord.z * In.texCoord.z );
	
	Out.projPos  = mul(float4(outPos, 1), g_matWVP);	
	Out.texCoord = texCoord.xy;
	Out.pos.xyz	 = In.pos.xyz;
	Out.pos.w = Out.projPos.z;
	
	return Out;
};
You should open the same shader on your computer (you can use notepad for that) and replace the decimal numbers I have marked above in red with some smaller numbers.

Maybe you could start by using the same values on top of each red number (0, 0.125, 0.250, etc.) minus 0.001.

- If that is not enough, use even smaller numbers;

- if it works, use bigger values but still smaller that the ones I used for my patch.

- keep increasing/decreasing those numbers until you find the values closest to my settings that fix the lines issue for you.

I might have explained myself poorly, so don't hesitate asking in case you need further explanations
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote