Natural Selection 2

Natural Selection 2

NS2 GunGame
Pierre d'Aulique 2016 年 3 月 17 日 下午 3:07
Marines are almost totally invisible on Linux
http://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=647193426

Log is spammed with this:
Worker 08 : Error: Compilation errors in renderer/Deferred.hlsl 0(396) : error C1115: unable to find compatible overloaded function "clamp(vec3, float, vec3)" : #version 140 #pragma optionNV(fastmath on) #pragma optionNV(ifcvt none) #pragma optionNV(inline all) #pragma optionNV(strict on) #pragma optionNV(unroll all) vec3 matrix_row0(mat3 m, int i) { return vec3( m[0], m[1], m[2] ); }
vec4 matrix_row0(mat4 m, int i) { return vec4( m[0], m[1], m[2], m[3] ); }
void clip0(float x) { if (x < 0.0) ; }
void clip0(vec2 x) { if (any(lessThan(x, vec2(0.0, 0.0)))) ; }
void clip0(vec3 x) { if (any(lessThan(x, vec3(0.0, 0.0, 0.0)))) ; }
void clip0(vec4 x) { if (any(lessThan(x, vec4(0.0, 0.0, 0.0, 0.0)))) ; }
vec2 m_scalar_swizzle20(float x) { return vec2(x, x); }
ivec2 m_scalar_swizzle20(int x) { return ivec2(x, x); }
uvec2 m_scalar_swizzle20(uint x) { return uvec2(x, x); }
vec3 m_scalar_swizzle30(float x) { return vec3(x, x, x); }
ivec3 m_scalar_swizzle30(int x) { return ivec3(x, x, x); }
uvec3 m_scalar_swizzle30(uint x) { return uvec3(x, x, x); }
vec4 m_scalar_swizzle40(float x) { return vec4(x, x, x, x); }
ivec4 m_scalar_swizzle40(int x) { return ivec4(x, x, x, x); }
uvec4 m_scalar_swizzle40(uint x) { return uvec4(x, x, x, x); }
in vec3 POSITION;
in vec2 TEXCOORD0;
in vec3 NORMAL;
in vec3 BINORMAL;
in vec3 TANGENT;
in vec4 COLOR;
out vec4 frag_TEXCOORD0;
out vec2 frag_TEXCOORD1;
out vec3 frag_TEXCOORD2;
out vec3 frag_TEXCOORD3;
out vec3 frag_TEXCOORD4;
out vec3 frag_TEXCOORD5;
out vec4 frag_COLOR0;
out vec4 frag_TEXCOORD6;
layout (std140) uniform PassConstants {
vec2 imagePlaneSize;
vec2 rcpFrame;
vec4 rcpFrameOpt;
vec2 texelCenter;
float nearPlane;
float farPlane;
};
layout (std140) uniform SceneConstants {
mat4 cameraToScreenMatrix;
mat4 cameraToWorldMatrix;
mat4 worldToScreenMatrix;
mat4 worldToCameraMatrix;
vec3 wsCameraOrigin;
float time;
};
uniform sampler2D randomNormalTexture;
struct VS_DeferredPass_Input {
v[/code]
< >
正在显示第 1 - 6 条,共 6 条留言
Pierre d'Aulique 2016 年 3 月 17 日 下午 3:45 
http://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=647212191

There, I fixed it by removing all clamps from the shaders.
Before:
float3 tempModelColorBase = clamp( modelColorBase.rgb / modelColorMapTex.a, 0.0, 1.0 );
After:
float3 tempModelColorBase = modelColorBase.rgb / modelColorMapTex.a;

I have no idea whether anything breaks after that. The HLSL compiler doesn't infer types right for some reason and thinks that 1.0 is a vec3 value.
Pierre d'Aulique 2016 年 3 月 17 日 下午 3:59 
Okay, a more correct way is not to remove clamp completely but cast the second and third params to float like this:
float3 tempModelColorBase = clamp( modelColorBase.rgb / modelColorMapTex.a, (float) 0, (float) 1 );

This way it works. Please fix for all shaders in the mod that contain clamp.
ZycaR  [开发者] 2016 年 3 月 28 日 下午 1:23 
I didn't saw your thread till today (I'm not used to workshop stuff but learning) .. I'm very sorry for inconvience and will work hard to fix it. Thank you very much for suggestion.
ZycaR  [开发者] 2016 年 3 月 28 日 下午 1:33 
should be fixed in GunGame 0.25 RC .. please feel free to check it, I have no linux but exact casting to float is used in all shaders where clamp is used. Looks like 1 != 1.0 in bitness for shaders same as most programming languages.
最后由 ZycaR 编辑于; 2016 年 3 月 28 日 下午 1:34
Pierre d'Aulique 2016 年 3 月 28 日 下午 2:30 
Thank you, will try it soon!
Pierre d'Aulique 2016 年 4 月 24 日 上午 8:04 
Well, almost a month has passed but today I tried GG with friends and indeed this bug is fixed, everyone is visible. Thanks again!
< >
正在显示第 1 - 6 条,共 6 条留言
每页显示数: 1530 50