mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
emissive to recivesShadows
now we've got a glow mask and multiplier, ditch the emissive flag in favor of a proper recivesShadows
This commit is contained in:
parent
54a2235128
commit
645f88d4af
|
|
@ -572,7 +572,7 @@ void SkyBox::_initRender()
|
|||
mFogBandMat->mTranslucent = true;
|
||||
mFogBandMat->mVertColor[0] = true;
|
||||
mFogBandMat->mDoubleSided = true;
|
||||
mFogBandMat->mEmissive[0] = true;
|
||||
mFogBandMat->mReceiveShadows[0] = false;
|
||||
|
||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
features.addFeature(MFT_isBackground);
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ void SkySphere::_initRender()
|
|||
mFogBandMat->mTranslucent = true;
|
||||
mFogBandMat->mVertColor[0] = true;
|
||||
mFogBandMat->mDoubleSided = true;
|
||||
mFogBandMat->mEmissive[0] = true;
|
||||
mFogBandMat->mReceiveShadows[0] = false;
|
||||
|
||||
FeatureSet features = MATMGR->getDefaultFeatures();
|
||||
features.addFeature(MFT_isBackground);
|
||||
|
|
|
|||
|
|
@ -384,8 +384,7 @@ bool MatInstance::processMaterial()
|
|||
mUsesHardwareSkinning = finalFeatures.hasFeature( MFT_HardwareSkinning );
|
||||
|
||||
mIsForwardLit = ( custMat && custMat->mForwardLit ) ||
|
||||
( !finalFeatures.hasFeature( MFT_IsEmissive ) &&
|
||||
finalFeatures.hasFeature( MFT_ForwardShading ) );
|
||||
( finalFeatures.hasFeature( MFT_ForwardShading ) );
|
||||
|
||||
mIsHardwareSkinned = finalFeatures.hasFeature( MFT_HardwareSkinning );
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ Material::Material()
|
|||
mVertColor[i] = false;
|
||||
|
||||
mGlow[i] = false;
|
||||
mEmissive[i] = false;
|
||||
mReceiveShadows[i] = true;
|
||||
|
||||
mDetailScale[i].set(2.0f, 2.0f);
|
||||
|
||||
|
|
@ -345,7 +345,7 @@ void Material::initPersistFields()
|
|||
addField("subSurfaceRolloff", TypeF32, Offset(mSubSurfaceRolloff, Material), MAX_STAGES,
|
||||
"The 0 to 1 rolloff factor used in the subsurface scattering approximation.");
|
||||
|
||||
addField("emissive", TypeBool, Offset(mEmissive, Material), MAX_STAGES,
|
||||
addField("receiveShadows", TypeBool, Offset(mReceiveShadows, Material), MAX_STAGES,
|
||||
"Enables emissive lighting for the material.");
|
||||
|
||||
addField("doubleSided", TypeBool, Offset(mDoubleSided, Material),
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ public:
|
|||
F32 mSeqSegSize[MAX_STAGES];
|
||||
|
||||
bool mGlow[MAX_STAGES]; // entire stage glows
|
||||
bool mEmissive[MAX_STAGES];
|
||||
bool mReceiveShadows[MAX_STAGES];
|
||||
|
||||
Point2I mCellIndex[MAX_STAGES];
|
||||
Point2I mCellLayout[MAX_STAGES];
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ ImplementFeatureType( MFT_IsBC3nm, U32(-1), -1, true );
|
|||
ImplementFeatureType( MFT_IsBC5nm, U32(-1), -1, true);
|
||||
ImplementFeatureType( MFT_IsTranslucent, U32(-1), -1, true );
|
||||
ImplementFeatureType( MFT_IsTranslucentZWrite, U32(-1), -1, true );
|
||||
ImplementFeatureType( MFT_IsEmissive, U32(-1), -1, true );
|
||||
ImplementFeatureType( MFT_DiffuseMapAtlas, U32(-1), -1, true );
|
||||
ImplementFeatureType( MFT_NormalMapAtlas, U32(-1), -1, true );
|
||||
ImplementFeatureType( MFT_InterlacedDeferred, U32(-1), -1, true );
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ DeclareFeatureType( MFT_AlphaTest );
|
|||
DeclareFeatureType( MFT_NormalMap );
|
||||
DeclareFeatureType( MFT_RTLighting );
|
||||
|
||||
DeclareFeatureType( MFT_IsEmissive );
|
||||
DeclareFeatureType( MFT_SubSurface );
|
||||
DeclareFeatureType( MFT_LightMap );
|
||||
DeclareFeatureType( MFT_ToneMap );
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ BaseMatInstance * MaterialManager::createMeshDebugMatInstance(const LinearColorF
|
|||
debugMat = allocateAndRegister( meshDebugStr );
|
||||
|
||||
debugMat->mDiffuse[0] = meshColor;
|
||||
debugMat->mEmissive[0] = true;
|
||||
debugMat->mReceiveShadows[0] = false;
|
||||
}
|
||||
|
||||
BaseMatInstance *debugMatInstance = NULL;
|
||||
|
|
|
|||
|
|
@ -353,15 +353,10 @@ void ProcessedShaderMaterial::_determineFeatures( U32 stageNum,
|
|||
if ( mMaterial->mAlphaTest )
|
||||
fd.features.addFeature( MFT_AlphaTest );
|
||||
|
||||
if (mMaterial->mEmissive[stageNum])
|
||||
{
|
||||
fd.features.addFeature(MFT_IsEmissive);
|
||||
}
|
||||
else
|
||||
if (mMaterial->isTranslucent())
|
||||
{
|
||||
fd.features.addFeature(MFT_RTLighting);
|
||||
if (mMaterial->isTranslucent())
|
||||
fd.features.addFeature(MFT_ReflectionProbes);
|
||||
fd.features.addFeature(MFT_ReflectionProbes);
|
||||
}
|
||||
|
||||
if ( mMaterial->mAnimFlags[stageNum] )
|
||||
|
|
@ -1204,8 +1199,8 @@ void ProcessedShaderMaterial::_setShaderConstants(SceneRenderState * state, cons
|
|||
|
||||
// Deferred Shading: Determine Material Info Flags
|
||||
S32 matInfoFlags =
|
||||
(mMaterial->mEmissive[stageNum] ? 1 : 0) | //emissive
|
||||
(mMaterial->mSubSurface[stageNum] ? 2 : 0); //subsurface
|
||||
(mMaterial->mReceiveShadows[stageNum] ? 1 : 0) | //ReceiveShadows
|
||||
(mMaterial->mSubSurface[stageNum] ? 1 << 2 : 0); //subsurface
|
||||
mMaterial->mMatInfoFlags[stageNum] = matInfoFlags / 255.0f;
|
||||
shaderConsts->setSafe(handles->mMatInfoFlagsSC, mMaterial->mMatInfoFlags[stageNum]);
|
||||
if( handles->mAccuScaleSC->isValid() )
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void RenderOcclusionMgr::init()
|
|||
|
||||
mMaterial = MATMGR->allocateAndRegister( String::EmptyString );
|
||||
mMaterial->mDiffuse[0] = LinearColorF( 1, 0, 1, 1 );
|
||||
mMaterial->mEmissive[0] = true;
|
||||
mMaterial->mReceiveShadows[0] = false;
|
||||
mMaterial->mAutoGenerated = true;
|
||||
|
||||
mMatInstance = mMaterial->createMatInstance();
|
||||
|
|
@ -234,4 +234,4 @@ void RenderOcclusionMgr::render( SceneRenderState *state )
|
|||
|
||||
// Call setup one more time to end the pass.
|
||||
mMatInstance->setupPass( state, sgData );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,13 +146,6 @@ void main()
|
|||
//create surface
|
||||
Surface surface = createSurface( normDepth, colorBuffer, matInfoBuffer,
|
||||
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
||||
|
||||
//early out if emissive
|
||||
if (getFlag(surface.matFlag, 0))
|
||||
{
|
||||
OUT_col = vec4(0, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 L = lightPosition - surface.P;
|
||||
float dist = length(L);
|
||||
|
|
@ -162,22 +155,22 @@ void main()
|
|||
float distToLight = dist / lightRange;
|
||||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float shadowed = 1.0;
|
||||
#else
|
||||
|
||||
float shadow = 1.0;
|
||||
#ifndef NO_SHADOW
|
||||
if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
|
||||
{
|
||||
#ifdef SHADOW_CUBE
|
||||
|
||||
// TODO: We need to fix shadow cube to handle soft shadows!
|
||||
float occ = texture( shadowMap, tMul( worldToLightProj, -surfaceToLight.L ) ).r;
|
||||
float shadowed = saturate( exp( lightParams.y * ( occ - distToLight ) ) );
|
||||
shadow = saturate( exp( lightParams.y * ( occ - distToLight ) ) );
|
||||
|
||||
#else
|
||||
vec2 shadowCoord = decodeShadowCoord( tMul( worldToLightProj, -surfaceToLight.L ) ).xy;
|
||||
float shadowed = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
vec2 shadowCoord = decodeShadowCoord( tMul( worldToLightProj, -surfaceToLight.L ) ).xy;
|
||||
shadow = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
#endif
|
||||
|
||||
#endif // !NO_SHADOW
|
||||
}
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
vec3 lightCol = lightColor.rgb;
|
||||
#ifdef USE_COOKIE_TEX
|
||||
|
|
@ -225,7 +218,7 @@ void main()
|
|||
#endif
|
||||
|
||||
//get punctual light contribution
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
|
||||
}
|
||||
|
||||
OUT_col = vec4(lighting, 0);
|
||||
|
|
|
|||
|
|
@ -55,13 +55,6 @@ void main()
|
|||
|
||||
//create surface
|
||||
Surface surface = createSurface(normDepth, colorBuffer, matInfoBuffer, IN_uv0.xy, eyePosWorld, IN_wsEyeRay, cameraToWorld);
|
||||
|
||||
//early out if emissive
|
||||
if (getFlag(surface.matFlag, 0))
|
||||
{
|
||||
OUT_col = vec4(surface.albedo, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef USE_SSAO_MASK
|
||||
float ssao = 1.0 - texture( ssaoMask, viewportCoordToRenderTarget( IN_uv0.xy, rtParams7 ) ).r;
|
||||
|
|
|
|||
|
|
@ -80,13 +80,6 @@ void main()
|
|||
//create surface
|
||||
Surface surface = createSurface( normDepth, colorBuffer,matInfoBuffer,
|
||||
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
||||
|
||||
//early out if emissive
|
||||
if (getFlag(surface.matFlag, 0))
|
||||
{
|
||||
OUT_col = vec4(0, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 L = lightPosition - surface.P;
|
||||
float dist = length(L);
|
||||
|
|
@ -96,9 +89,10 @@ void main()
|
|||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
|
||||
vec3 lightCol = lightColor.rgb;
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float shadowed = 1.0;
|
||||
#else
|
||||
float shadow = 1.0;
|
||||
#ifndef NO_SHADOW
|
||||
if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
|
||||
{
|
||||
// Get the shadow texture coordinate
|
||||
vec4 pxlPosLightProj = tMul( worldToLightProj, vec4( surface.P, 1 ) );
|
||||
vec2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + vec2( 0.5, 0.5 );
|
||||
|
|
@ -106,7 +100,7 @@ void main()
|
|||
|
||||
//distance to light in shadow map space
|
||||
float distToLight = pxlPosLightProj.z / lightRange;
|
||||
float shadowed = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
shadow = softShadow_filter(shadowMap, ssPos.xy/ssPos.w, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
#ifdef USE_COOKIE_TEX
|
||||
// Lookup the cookie sample.
|
||||
vec4 cookie = texture(cookieMap, shadowCoord);
|
||||
|
|
@ -117,6 +111,7 @@ void main()
|
|||
// regions of the cookie texture.
|
||||
lightCol *= max(cookie.r, max(cookie.g, cookie.b));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -156,7 +151,7 @@ void main()
|
|||
#endif
|
||||
|
||||
//get Punctual light contribution
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
|
||||
//get spot angle attenuation
|
||||
lighting *= getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,24 +186,17 @@ void main()
|
|||
//create surface
|
||||
Surface surface = createSurface( normDepth, colorBuffer, matInfoBuffer,
|
||||
uv0, eyePosWorld, wsEyeRay, cameraToWorld);
|
||||
|
||||
//early out if emissive
|
||||
if (getFlag(surface.matFlag, 0))
|
||||
{
|
||||
OUT_col = vec4(0, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//create surface to light
|
||||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, -lightDirection);
|
||||
|
||||
//light color might be changed by PSSM_DEBUG_RENDER
|
||||
vec3 lightingColor = lightColor.rgb;
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float shadow = 1.0;
|
||||
#else
|
||||
|
||||
float shadow = 1.0;
|
||||
#ifndef NO_SHADOW
|
||||
if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
|
||||
{
|
||||
// Fade out the shadow at the end of the range.
|
||||
vec4 zDist = vec4(zNearFarInvNearFar.x + zNearFarInvNearFar.y * surface.depth);
|
||||
float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y;
|
||||
|
|
@ -211,7 +204,7 @@ void main()
|
|||
vec4 shadowed_colors = AL_VectorLightShadowCast( shadowMap, uv0.xy, worldToLightProj, surface.P, scaleX, scaleY, offsetX, offsetY,
|
||||
farPlaneScalePSSM, surfaceToLight.NdotL);
|
||||
|
||||
float shadow = shadowed_colors.a;
|
||||
shadow = shadowed_colors.a;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
lightingColor = shadowed_colors.rgb;
|
||||
|
|
@ -223,7 +216,7 @@ void main()
|
|||
if ( fadeOutAmt > 1.0 )
|
||||
lightingColor = vec3(1.0,1.0,1.0);
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif //NO_SHADOW
|
||||
|
||||
#ifdef DIFFUSE_LIGHT_VIZ
|
||||
|
|
|
|||
|
|
@ -162,21 +162,21 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
float distToLight = dist / lightRange;
|
||||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float shadowed = 1.0;
|
||||
#else
|
||||
|
||||
float shadow = 1.0;
|
||||
#ifndef NO_SHADOW
|
||||
if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
|
||||
{
|
||||
#ifdef SHADOW_CUBE
|
||||
|
||||
// TODO: We need to fix shadow cube to handle soft shadows!
|
||||
float occ = TORQUE_TEXCUBE( shadowMap, mul( worldToLightProj, -surfaceToLight.L ) ).r;
|
||||
float shadowed = saturate( exp( lightParams.y * ( occ - distToLight ) ) );
|
||||
shadow = saturate( exp( lightParams.y * ( occ - distToLight ) ) );
|
||||
|
||||
#else
|
||||
float2 shadowCoord = decodeShadowCoord( mul( worldToLightProj, -surfaceToLight.L ) ).xy;
|
||||
float shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
shadow = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
float3 lightCol = lightColor.rgb;
|
||||
|
|
@ -221,7 +221,7 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
#endif
|
||||
|
||||
//get punctual light contribution
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
|
||||
}
|
||||
|
||||
return float4(lighting, 0);
|
||||
|
|
|
|||
|
|
@ -51,12 +51,6 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
|||
Surface surface = createSurface(normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
||||
IN.uv0.xy, eyePosWorld, IN.wsEyeRay, cameraToWorld);
|
||||
|
||||
//early out if emissive
|
||||
if (getFlag(surface.matFlag, 0))
|
||||
{
|
||||
return float4(surface.albedo, 0);
|
||||
}
|
||||
|
||||
#ifdef USE_SSAO_MASK
|
||||
float ssao = 1.0 - TORQUE_TEX2D( ssaoMask, viewportCoordToRenderTarget( IN.uv0.xy, rtParams7 ) ).r;
|
||||
surface.ao = min(surface.ao, ssao);
|
||||
|
|
|
|||
|
|
@ -86,11 +86,11 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
Surface surface = createSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
||||
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
|
||||
|
||||
//early out if emissive
|
||||
if (getFlag(surface.matFlag, 0))
|
||||
{
|
||||
return float4(0, 0, 0, 0);
|
||||
}
|
||||
//early out if we take no shadows
|
||||
if (!getFlag(surface.matFlag, 0))
|
||||
{
|
||||
return float4(surface.albedo, 0);
|
||||
}
|
||||
|
||||
float3 L = lightPosition - surface.P;
|
||||
float dist = length(L);
|
||||
|
|
@ -100,17 +100,18 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
{
|
||||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
|
||||
float3 lightCol = lightColor.rgb;
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float shadowed = 1.0;
|
||||
#else
|
||||
|
||||
float shadow = 1.0;
|
||||
#ifndef NO_SHADOW
|
||||
if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
|
||||
{
|
||||
// Get the shadow texture coordinate
|
||||
float4 pxlPosLightProj = mul( worldToLightProj, float4( surface.P, 1 ) );
|
||||
float2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 );
|
||||
shadowCoord.y = 1.0f - shadowCoord.y;
|
||||
//distance to light in shadow map space
|
||||
float distToLight = pxlPosLightProj.z / lightRange;
|
||||
float shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
shadow = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap), ssPos.xy, shadowCoord, shadowSoftness, distToLight, surfaceToLight.NdotL, lightParams.y);
|
||||
#ifdef USE_COOKIE_TEX
|
||||
// Lookup the cookie sample.
|
||||
float4 cookie = TORQUE_TEX2D(cookieMap, shadowCoord);
|
||||
|
|
@ -121,6 +122,7 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
// regions of the cookie texture.
|
||||
lightCol *= max(cookie.r, max(cookie.g, cookie.b));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DIFFUSE_LIGHT_VIZ
|
||||
|
|
@ -153,7 +155,7 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
#endif
|
||||
|
||||
//get Punctual light contribution
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadow);
|
||||
//get spot angle attenuation
|
||||
lighting *= getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,23 +176,17 @@ float4 main(FarFrustumQuadConnectP IN) : SV_TARGET
|
|||
//create surface
|
||||
Surface surface = createSurface( normDepth, TORQUE_SAMPLER2D_MAKEARG(colorBuffer),TORQUE_SAMPLER2D_MAKEARG(matInfoBuffer),
|
||||
IN.uv0, eyePosWorld, IN.wsEyeRay, cameraToWorld);
|
||||
|
||||
//early out if emissive
|
||||
if (getFlag(surface.matFlag, 0))
|
||||
{
|
||||
return float4(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
//create surface to light
|
||||
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, -lightDirection);
|
||||
|
||||
//light color might be changed by PSSM_DEBUG_RENDER
|
||||
float3 lightingColor = lightColor.rgb;
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float shadow = 1.0;
|
||||
#else
|
||||
|
||||
float shadow = 1.0;
|
||||
#ifndef NO_SHADOW
|
||||
if (getFlag(surface.matFlag, 0)) //also skip if we don't recieve shadows
|
||||
{
|
||||
// Fade out the shadow at the end of the range.
|
||||
float4 zDist = (zNearFarInvNearFar.x + zNearFarInvNearFar.y * surface.depth);
|
||||
float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y;
|
||||
|
|
@ -200,7 +194,7 @@ float4 main(FarFrustumQuadConnectP IN) : SV_TARGET
|
|||
float4 shadowed_colors = AL_VectorLightShadowCast( TORQUE_SAMPLER2D_MAKEARG(shadowMap), IN.uv0.xy, worldToLightProj, surface.P, scaleX, scaleY, offsetX, offsetY,
|
||||
farPlaneScalePSSM, surfaceToLight.NdotL);
|
||||
|
||||
float shadow = shadowed_colors.a;
|
||||
shadow = shadowed_colors.a;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
lightingColor = shadowed_colors.rgb;
|
||||
|
|
@ -212,7 +206,7 @@ float4 main(FarFrustumQuadConnectP IN) : SV_TARGET
|
|||
if ( fadeOutAmt > 1.0 )
|
||||
lightingColor = 1.0;
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif //NO_SHADOW
|
||||
|
||||
#ifdef DIFFUSE_LIGHT_VIZ
|
||||
|
|
|
|||
|
|
@ -3156,7 +3156,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
};
|
||||
new GuiCheckBoxCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
internalName = "emissiveCheckbox";
|
||||
internalName = "receiveShadowsCheckbox";
|
||||
Enabled = "1";
|
||||
isContainer = "0";
|
||||
Profile = "ToolsGuiCheckBoxProfile";
|
||||
|
|
@ -3167,11 +3167,11 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
MinExtent = "8 2";
|
||||
canSave = "1";
|
||||
Visible = "1";
|
||||
Command = "MaterialEditorGui.updateActiveMaterial(\"emissive[\" @ MaterialEditorGui.currentLayer @ \"]\",$ThisControl.getValue());";
|
||||
Command = "MaterialEditorGui.updateActiveMaterial(\"receiveShadows[\" @ MaterialEditorGui.currentLayer @ \"]\",$ThisControl.getValue());";
|
||||
tooltipprofile = "ToolsGuiDefaultProfile";
|
||||
ToolTip = "Emissive causes an object to not be affected by lights. Good for light sources.";
|
||||
ToolTip = "Do we recieve shadows?";
|
||||
hovertime = "1000";
|
||||
text = "Emissive";
|
||||
text = "receiveShadows";
|
||||
groupNum = "-1";
|
||||
buttonType = "ToggleButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
|
|||
|
|
@ -935,7 +935,7 @@ function MaterialEditorGui::guiSync( %this, %material )
|
|||
MaterialEditorPropertiesWindow-->glowMulTextEdit.setText((%material).glowMul[%layer]);
|
||||
MaterialEditorPropertiesWindow-->glowMulSlider.setValue((%material).glowMul[%layer]);
|
||||
MaterialEditorPropertiesWindow-->glowCheckbox.setValue((%material).glow[%layer]);
|
||||
MaterialEditorPropertiesWindow-->emissiveCheckbox.setValue((%material).emissive[%layer]);
|
||||
MaterialEditorPropertiesWindow-->receiveShadowsCheckbox.setValue((%material).receiveShadows[%layer]);
|
||||
MaterialEditorPropertiesWindow-->parallaxTextEdit.setText((%material).parallaxScale[%layer]);
|
||||
MaterialEditorPropertiesWindow-->parallaxSlider.setValue((%material).parallaxScale[%layer]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue