Bladeren bron

shift glow logic to use a bool. we'll likely make that a scalar at some point, but not at the last second
gl math parity. for proper *command* parity we'll need to hunt down why it' forcing it to version 110

AzaezelX 2 dagen geleden
bovenliggende
commit
c0bd8de143

+ 1 - 1
Engine/source/renderInstance/renderParticleMgr.cpp

@@ -495,7 +495,7 @@ void RenderParticleMgr::renderParticle(ParticleRenderInst* ri, SceneRenderState*
 
    mParticleShaderConsts.mShaderConsts->setSafe( mParticleShaderConsts.mAlphaFactorSC, alphaFactor );
    mParticleShaderConsts.mShaderConsts->setSafe( mParticleShaderConsts.mAlphaScaleSC, alphaScale );
-   mParticleShaderConsts.mShaderConsts->setSafe(mParticleShaderConsts.mGlowSC, ri->glow ? 1 : 0);
+   mParticleShaderConsts.mShaderConsts->setSafe(mParticleShaderConsts.mGlowSC, ri->glow);
    
    mParticleShaderConsts.mShaderConsts->setSafe( mParticleShaderConsts.mFSModelViewProjSC, *ri->modelViewProj  );
    mParticleShaderConsts.mShaderConsts->setSafe( mParticleShaderConsts.mOneOverFarSC, 1.0f / state->getFarPlane() );     

+ 4 - 4
Templates/BaseGame/game/core/rendering/shaders/gl/particlesP.glsl

@@ -19,7 +19,6 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 // IN THE SOFTWARE.
 //-----------------------------------------------------------------------------
-
 #include "torque.glsl"
 #include "hlslCompat.glsl"
    
@@ -77,7 +76,7 @@ vec4 lmSample( vec3 nrm )
 
 uniform float alphaFactor;
 uniform float alphaScale;
-uniform int glow;
+uniform bool glow;
 
 out vec4 OUT_col;
 
@@ -107,9 +106,10 @@ void main()
    
    // Scale output color by the alpha factor (turn LerpAlpha into pre-multiplied alpha)
    vec3 colorScale = ( alphaFactor < 0.0 ? IN_color.rgb * diffuse.rgb : vec3( alphaFactor > 0.0 ? IN_color.a * diffuse.a * alphaFactor * softBlend : softBlend ) );
-   if (glow >0)
+   if (glow)
    {
-      vec4 glowCol = vec4(pow(max((IN_color * diffuse).rgb*10,0.0),3.54406804435),(IN_color * diffuse).a);
+      vec3 glowCol = (IN_color * diffuse).rgb*10;//pow((IN_color * diffuse).rgb*10,3.54406804435);
+      glowCol*=glowCol*glowCol*0.54406804435;
       colorScale *= glowCol.rgb;
    }
    OUT_col = hdrEncode( vec4( IN_color.rgb * diffuse.rgb * colorScale,

+ 2 - 2
Templates/BaseGame/game/core/rendering/shaders/particlesP.hlsl

@@ -75,7 +75,7 @@ float4 lmSample( float3 nrm )
 
 uniform float alphaFactor;
 uniform float alphaScale;
-uniform int glow;
+uniform bool glow;
 
 float4 main( Conn IN ) : TORQUE_TARGET0
 {
@@ -103,7 +103,7 @@ float4 main( Conn IN ) : TORQUE_TARGET0
    
    // Scale output color by the alpha factor (turn LerpAlpha into pre-multiplied alpha)
    float3 colorScale = ( alphaFactor < 0.0 ? IN.color.rgb * diffuse.rgb : ( alphaFactor > 0.0 ? IN.color.a * diffuse.a * alphaFactor * softBlend : softBlend ) );
-   if (glow >0)
+   if (glow)
    {
       float4 glowCol = float4(pow(max((IN.color * diffuse).rgb*10,0.0),3.54406804435),(IN.color * diffuse).a);
       colorScale *= glowCol.rgb;