• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisãoa16dd4c656369f10ef6f3423bbcc80585b918071 (tree)
Hora2018-09-23 08:44:28
AutorMatias N. Goldberg <dark_ <sylinc@yaho...>
CommiterMatias N. Goldberg <dark_

Mensagem de Log

Fixed Area Lights LTC compiler errors with HLSL. It works now!

Mudança Sumário

Diff

diff -r 6158b1e636ea -r a16dd4c65636 Samples/Media/Hlms/Common/GLSL/CrossPlatformSettings_piece_all.glsl
--- a/Samples/Media/Hlms/Common/GLSL/CrossPlatformSettings_piece_all.glsl Sat Sep 22 18:30:39 2018 -0300
+++ b/Samples/Media/Hlms/Common/GLSL/CrossPlatformSettings_piece_all.glsl Sat Sep 22 20:44:28 2018 -0300
@@ -35,6 +35,7 @@
3535 #define mul( x, y ) ((x) * (y))
3636 #define saturate(x) clamp( (x), 0.0, 1.0 )
3737 #define lerp mix
38+#define rsqrt inversesqrt
3839 #define INLINE
3940
4041 #define finalDrawId drawId
diff -r 6158b1e636ea -r a16dd4c65636 Samples/Media/Hlms/Pbs/Any/AreaLights_LTC_piece_ps.any
--- a/Samples/Media/Hlms/Pbs/Any/AreaLights_LTC_piece_ps.any Sat Sep 22 18:30:39 2018 -0300
+++ b/Samples/Media/Hlms/Pbs/Any/AreaLights_LTC_piece_ps.any Sat Sep 22 20:44:28 2018 -0300
@@ -67,7 +67,7 @@
6767 float b = 3.4175940 + (4.1616724 + y)*y;
6868 float v = a / b;
6969
70- float theta_sintheta = (x > 0.0) ? v : 0.5*inversesqrt(max(1.0 - x*x, 1e-7)) - v;
70+ float theta_sintheta = (x > 0.0) ? v : 0.5*rsqrt(max(1.0 - x*x, 1e-7)) - v;
7171
7272 return cross( v1, v2 ) * theta_sintheta;
7373 }
@@ -188,7 +188,7 @@
188188 L[4] = L[0];
189189 }
190190
191-INLINE float LTC_Evaluate( float3 N, float3 V, float3 P, mat3 Minv, float3 points[4], bool twoSided )
191+INLINE float LTC_Evaluate( float3 N, float3 V, float3 P, float3x3 Minv, float3 points[4], bool twoSided )
192192 {
193193 // construct orthonormal basis around N
194194 float3 T1, T2;
@@ -196,7 +196,7 @@
196196 T2 = cross(N, T1);
197197
198198 // rotate area light in (T1, T2, N) basis
199- Minv = mul( Minv, transpose( mat3( T1, T2, N ) ) );
199+ Minv = mul( Minv, transpose( float3x3( T1, T2, N ) ) );
200200
201201 // polygon (allocate 5 vertices for clipping)
202202 float3 L[5];
@@ -246,7 +246,7 @@
246246 ClipQuadToHorizon( L, n );
247247
248248 if( n == 0 )
249- return float3(0, 0, 0);
249+ return 0;
250250 // project onto sphere
251251 L[0] = normalize( L[0] );
252252 L[1] = normalize( L[1] );
@@ -283,7 +283,7 @@
283283 float4 ltc0 = OGRE_SampleArray2DLevel( ltcMatrix, ltcSampler, ltcUV, 0, 0 );
284284 float4 ltc1 = OGRE_SampleArray2DLevel( ltcMatrix, ltcSampler, ltcUV, 1, 0 );
285285
286- mat3 Minv = mat3(
286+ float3x3 Minv = float3x3(
287287 float3(ltc0.x, 0, ltc0.y),
288288 float3( 0, 1, 0),
289289 float3(ltc0.z, 0, ltc0.w)
@@ -306,8 +306,9 @@
306306 ltcSpecular.xyz *= @insertpiece( F0 ).xyz * ltc1.x + (1.0 - @insertpiece( F0 ).xyz) * ltc1.y;
307307 @end
308308
309- float ltcDiffuse = LTC_Evaluate( nNormal.xyz, viewDir.xyz, inPs.pos.xyz, mat3(1),
310- passBuf.areaLtcLights[@n].points, doubleSidedLtc );
309+ float ltcDiffuse = LTC_Evaluate( nNormal.xyz, viewDir.xyz, inPs.pos.xyz,
310+ float3x3( float3( 1, 0, 0 ), float3( 0, 1, 0 ), float3( 0, 0, 1 ) ),
311+ passBuf.areaLtcLights[@n].points, doubleSidedLtc );
311312
312313 finalColour += passBuf.areaLtcLights[@n].diffuse.xyz * ltcDiffuse * @insertpiece( kD ).xyz;
313314 finalColour += passBuf.areaLtcLights[@n].specular.xyz * ltcSpecular * @insertpiece( kS ).xyz;
diff -r 6158b1e636ea -r a16dd4c65636 Samples/Media/Hlms/Pbs/HLSL/Structs_piece_vs_piece_ps.hlsl
--- a/Samples/Media/Hlms/Pbs/HLSL/Structs_piece_vs_piece_ps.hlsl Sat Sep 22 18:30:39 2018 -0300
+++ b/Samples/Media/Hlms/Pbs/HLSL/Structs_piece_vs_piece_ps.hlsl Sat Sep 22 20:44:28 2018 -0300
@@ -41,6 +41,14 @@
4141 float4 doubleSided;
4242 };
4343
44+struct AreaLtcLight
45+{
46+ float4 position; //.w contains the objLightMask
47+ float4 diffuse; //.w contains attenuation range
48+ float4 specular; //.w contains doubleSided
49+ float3 points[4];
50+};
51+
4452 @insertpiece( DeclCubemapProbeStruct )
4553
4654 //Uniforms that change per pass
@@ -94,6 +102,7 @@
94102 float pssmFadePoint;@end
95103 @property( hlms_lights_spot )Light lights[@value(hlms_lights_spot)];@end
96104 @property( hlms_lights_area_approx )AreaLight areaApproxLights[@value(hlms_lights_area_approx)];@end
105+ @property( hlms_lights_area_ltc )AreaLtcLight areaLtcLights[@value(hlms_lights_area_ltc)];@end
97106 @end @property( hlms_shadowcaster )
98107 //Vertex shader
99108 @property( exponential_shadow_maps )float4 viewZRow;@end
diff -r 6158b1e636ea -r a16dd4c65636 Samples/Media/Hlms/Pbs/Metal/Structs_piece_vs_piece_ps.metal
--- a/Samples/Media/Hlms/Pbs/Metal/Structs_piece_vs_piece_ps.metal Sat Sep 22 18:30:39 2018 -0300
+++ b/Samples/Media/Hlms/Pbs/Metal/Structs_piece_vs_piece_ps.metal Sat Sep 22 20:44:28 2018 -0300
@@ -41,6 +41,14 @@
4141 float4 doubleSided;
4242 };
4343
44+struct AreaLtcLight
45+{
46+ float4 position; //.w contains the objLightMask
47+ float4 diffuse; //.w contains attenuation range
48+ float4 specular; //.w contains doubleSided
49+ float3 points[4];
50+};
51+
4452 @insertpiece( DeclCubemapProbeStruct )
4553
4654 //Uniforms that change per pass
@@ -91,6 +99,7 @@
9199 float pssmFadePoint;@end
92100 @property( hlms_lights_spot )Light lights[@value(hlms_lights_spot)];@end
93101 @property( hlms_lights_area_approx )AreaLight areaApproxLights[@value(hlms_lights_area_approx)];@end
102+ @property( hlms_lights_area_ltc )AreaLtcLight areaLtcLights[@value(hlms_lights_area_ltc)];@end
94103 @end @property( hlms_shadowcaster )
95104 //Vertex shader
96105 @property( exponential_shadow_maps )float4 viewZRow;@end