Torque 3D Beta 5 Bug: Big framerate drop when scaling an object with shadows enabled
by Stephane Conde · in Torque 3D Professional · 09/07/2009 (3:03 pm) · 7 replies
In basic lighting, when scaling a single object that has shadows enabled, the framerate drops significantly (i.e. from ~15 fps to ~0.1 fps).
This issue is visible in an unmodified version of Torque 3D Beta 5 in the Undercity level. Just changing the scale of "CistFan4" from '1 1 1' to '5 5 5' should make the issue quite apparent.
I believe that the issue is related to shadows since disabling shadows in the "ceiling_fan" datablock before scaling "CistFan4" doesn't show any framerate drop. This issue also only appears in Beta 5, when projected shadows for basic lighting were added.
Here is a profiler dump when the framerate tanks:
It looks like something is going on in the decal manager clipping code...
Please let me know if there is any other information I can provide to help fix this issue.
Thank you very much in advance for any help you might be able to provide.
Stephane
This issue is visible in an unmodified version of Torque 3D Beta 5 in the Undercity level. Just changing the scale of "CistFan4" from '1 1 1' to '5 5 5' should make the issue quite apparent.
I believe that the issue is related to shadows since disabling shadows in the "ceiling_fan" datablock before scaling "CistFan4" doesn't show any framerate drop. This issue also only appears in Beta 5, when projected shadows for basic lighting were added.
Here is a profiler dump when the framerate tanks:
Profiler Data Dump: Ordered by non-sub total time - %NSTime % Time Invoke # Name 43.518 43.522 2936 ContainerFindObjects_Box 36.399 36.399 114 ClippedPolyList_cullUnusedVerts 11.920 11.920 114 ClippedPolyList_GenerateNormals 2.452 2.466 43125 GFXD3D9ShaderConstBuffer_activate 0.885 1.571 23 RenderTranslucentMgr_render 0.814 92.893 114 DecalManager_clipDecal 0.576 0.632 28454 GFXDevice_updateStates 0.287 0.452 2448 GFXDevice_drawTextN 0.274 0.278 23 DecalManager_RenderDecals_RenderBatch 0.260 99.066 23 CanvasRenderControls 0.249 0.308 20181 TSMesh_InnerRender 0.249 0.249 114 ClippedPolyList_triangulate 0.183 0.183 130 ParticleEmitter_copyToVB_Orient 0.167 0.182 23 ClientNetProcess 0.163 0.471 1141 TSShapeInstance_Render 0.147 99.994 23 MainLoop 0.136 0.136 23 SwapBuffers 0.135 0.135 23 DecalManager_RenderDecals_SphereTreeCull 0.128 0.209 23 AdvanceClientTime 0.092 0.095 23 CanvasPreRender 0.071 0.107 1403 Player_PhysicsSection 0.059 2.057 145 RenderMeshMgr_render 0.058 0.058 21658 SceneRenderPassManager_addInst 0.057 0.076 21459 MatInstance_setTransforms 0.056 0.056 4070 GFXD3D9StateBlock_Activate 0.053 0.174 1472 AdvanceObjects 0.042 0.042 1088 LightManager_ScoreLights 0.035 0.035 106918 GenericConstBufferLayout_set 0.031 0.241 23 ClientProcess 0.030 0.649 76 ProjectedShadow_RenderToTexture 0.029 0.029 53 ParticleEmitter_copyToVB_NonOriented 0.029 0.029 183 ParticleEmitter_copyToVB_LockCopy 0.028 0.043 3932 convertUTF8toUTF16 0.027 0.027 99 RenderPassManager_Sort 0.021 0.028 22538 BasicLightManager_SetLightInfo 0.019 97.227 99 RenderPassManager_Render 0.018 0.029 1169 ProcessedShaderMaterial_SetShaderConstants 0.018 0.021 175918 GFont_getCharInfo 0.018 0.018 2248 Frustum_UpdatePlanes 0.017 0.037 1403 Player_UpdatePos 0.015 0.016 23 ServerNetProcess 0.015 0.015 135034 oneUTF8toUTF32 0.015 93.560 161 RenderObjectMgr_render 0.014 2.480 43125 GFXD3D9Device_setShaderConstBufferInternal 0.014 1.185 3495 treeTraverseVisit_prepRenderImage 0.012 0.012 1794 SG_Rezone 0.011 0.042 2016 ProcessedShaderMaterial_SetupPass 0.010 0.030 3191 SceneObjectSetTransform 0.010 0.036 281 ShapeBase_PrepRenderImage 0.010 0.010 99 RenderPassManager_Clear 0.009 0.009 15570 GenericConstBuffer_getDirtyBuffer 0.008 0.008 11546 Frustum_Intersects 0.006 0.013 23 LightManager_RegisterGlobalLights 0.006 1.210 23 BuildSceneTree 0.006 1.191 3235 treeTraverseVisit 0.005 0.010 23 RenderGlowMgr_Render 0.005 0.005 23 Container_FindObjectList_Box 0.005 0.005 20204 LightManager_GetBestLights 0.005 0.006 23 ContainerFindObjects_Frustum 0.004 0.546 23 ProcessTimeEvent 0.004 0.004 3490 SceneObj_setRenderTransform 0.004 0.178 46 AdvanceTime 0.003 0.003 1008 ProcessedShaderMaterial_SetTextureStages 0.003 0.003 1794 CheckBins 0.003 0.003 904 SimFindObject 0.003 0.003 2458 String_char_constructor 0.003 0.003 23 GFXEndScene 0.003 0.113 1472 Player_ProcessTick 0.003 0.244 183 ParticleEmitter_copyToVB 0.003 0.004 1177 GFXD3D9ShaderConstBuffer_activate_dirty_check_1 0.002 0.048 2338 MatInstance_SetupPass 0.002 0.002 23 GFXBeginScene 0.002 0.002 1 GFont_loadCharInfo 0.002 0.247 198 ParticleEmitter_prepRenderImage 0.002 0.002 4708 GenericConstBuffer_isEqual 0.001 0.003 322 ProcessedCustomMaterial_SetupPass 0.001 0.001 23 SFXXAudioDevice_Update 0.001 0.001 442 Frustum_OBB_Intersects 0.001 0.001 759 UpdateActionThread 0.001 97.900 23 SceneGraphRender 0.001 0.001 2799 Container_FindWaterAndZoneObjects_Box 0.001 0.001 1262 String_getHashCaseInsensitive 0.001 43.511 114 DecalManager_clipDecal_buildPolyList 0.001 0.013 1794 SG_ZoneInsert 0.001 0.001 1169 ProcessedShaderMaterial_SetTextureTransforms 0.001 0.001 2 GFXTextureManager_CreateTexture_Bitmap 0.001 0.001 1794 SG_ZoneRemove 0.001 0.001 69 WaterObject_prepRenderImage 0.001 0.001 3565 String_default_constructor 0.001 0.013 199 convertUTF8toUTF16_create 0.001 0.001 145 GFXTextureManager_FindPooledTexure 0.000 0.000 150 GFXD3D9Device_AllocVertexDecl 0.000 0.000 4146 String_String_constructor 0.000 0.001 3 SWIZZLE_UPLOAD 0.000 0.006 23 Container_FindObjectList_Frustum 0.000 96.672 23 RenderCurrentImages 0.000 0.000 92 PostEffect_SetShaderConsts 0.000 0.000 23 SimAdvanceTime 0.000 0.592 76 RenderPassManager_RenderPass 0.000 0.000 23 SG_FindZone 0.000 0.002 23 SFXSystem_Update 0.000 0.000 23 DecalManager_RenderDecals_Sort 0.000 0.000 1141 TSShapeInstance_IFLMaterials 0.000 0.000 23 SkyBox_prepRenderImage 0.000 0.000 23 MatTextureTarget_FindTargetByName 0.000 0.000 23 ClientCatchup 0.000 0.000 23 SFXSystem_AssignVoices 0.000 0.000 2 Swizzle32_Upload 0.000 0.103 23 ServerProcess 0.000 96.672 23 TraverseScene 0.000 0.000 23 SceneGraphRender_PreRenderSignal 0.000 0.000 183 ParticleEmitter_copyToVB_Sort 0.000 0.013 23 RegisterLights 0.000 0.000 23 SFXSystem_UpdateSources 0.000 0.000 69 Frustum_SphereInFrustum 0.000 0.000 23 SceneGraphRender_PostRenderSignal 0.000 0.000 23 RenderParticleMgr_render 0.000 0.000 23 UnregisterLights 0.000 0.000 23 SFXListener_SortSources 0.000 0.000 23 RenderRefractMgr_render 0.000 0.000 2 convertUTF16toUTF8 0.000 0.000 23 RenderOcclusionMgr_render 0.000 0.000 23 InteriorPrepBatchRender 0.000 0.000 29 oneUTF32toUTF8 0.000 0.000 29 oneUTF16toUTF32 0.000 0.000 23 RenderImposterMgr_Render 0.000 0.000 0 FeatureSet_Exclude 0.000 0.000 0 String_char_len_constructor 0.000 0.000 0 ContainerCastRay 0.000 0.000 0 FeatureSet_UpdateDirty 0.000 0.000 0 GFXTextureManager_CreateTexture_DDS 0.000 0.000 0 GFXD3D9Shader_GetShaderConstants 0.000 0.000 0 FeatureSet_Merge 0.000 0.000 0 FeatureSet_Filter 0.000 0.000 0 GFXD3D9Shader_Init 0.000 0.000 0 ShaderData_GetShader 0.000 0.000 0 ShaderGen_GenerateShader 0.000 0.000 0 TSSkinMesh_UpdateSkin 0.000 0.000 0 GFXDevice_CreateStateBlock 0.000 0.000 0 GFXD3DTexMan_loadTexture 0.000 0.000 0 GFXD3DTexMan_loadSurface 0.000 0.000 0 FeatureSet_RebuildDesc 0.000 0.000 0 TSMesh_CreateVBIB 0.000 0.000 0 GFXD3D9ShaderConstBuffer_activate_dirty_check_2 0.000 0.000 0 GFXTextureManager_CleanupPool 0.000 0.000 0 ContainerCastRayRendered 0.000 0.000 0 RemoveFromBins 0.000 0.000 0 InsertBins 0.000 0.000 0 convertUTF16toUTF8_create 0.000 0.000 0 String_UTF16_constructor 0.000 0.000 0 TSSkinMesh_UpdateTransforms 0.000 0.000 0 ShaderGen_GetShader 0.000 0.000 0 GFXD3D9Shader_CompileShader 0.000 0.000 0 TSStatic_onAdd 0.000 0.000 0 TSShapeInstance_PrepCollision 0.000 0.000 0 GameRenderWorld 0.000 0.000 0 SimFindObjectByLine 0.000 0.000 0 ProcessedShaderMaterial_DetermineFeatures Ordered by stack trace total time - % Time % NSTime Invoke # Name 4.495 -95.499 0 ROOT 99.994 0.147 23 MainLoop 99.066 0.260 23 CanvasRenderControls 97.900 0.001 23 SceneGraphRender 96.672 0.000 23 TraverseScene 96.672 0.000 23 RenderCurrentImages 96.636 0.018 23 RenderPassManager_Render 93.560 0.015 161 RenderObjectMgr_render 92.893 0.814 114 DecalManager_clipDecal 43.511 0.001 114 DecalManager_clipDecal_buildPolyList 43.510 43.510 114 ContainerFindObjects_Box 36.399 36.399 114 ClippedPolyList_cullUnusedVerts 11.920 11.920 114 ClippedPolyList_GenerateNormals 0.249 0.249 114 ClippedPolyList_triangulate 0.649 0.030 76 ProjectedShadow_RenderToTexture 0.592 0.000 76 RenderPassManager_RenderPass 0.591 0.001 76 RenderPassManager_Render 0.589 0.010 76 RenderMeshMgr_render 0.559 0.001 760 GFXD3D9Device_setShaderConstBufferInternal 0.558 0.556 760 GFXD3D9ShaderConstBuffer_activate 0.001 0.001 912 GenericConstBuffer_getDirtyBuffer 0.001 0.001 228 GFXD3D9ShaderConstBuffer_activate_dirty_check_1 0.000 0.000 912 GenericConstBuffer_isEqual 0.014 0.001 456 MatInstance_SetupPass 0.013 0.003 456 ProcessedShaderMaterial_SetupPass 0.009 0.006 228 ProcessedShaderMaterial_SetShaderConstants 0.002 0.002 228 BasicLightManager_SetLightInfo 0.000 0.000 912 GenericConstBufferLayout_set 0.001 0.001 2052 GenericConstBufferLayout_set 0.001 0.001 228 ProcessedShaderMaterial_SetTextureStages 0.000 0.000 228 ProcessedShaderMaterial_SetTextureTransforms 0.004 0.004 380 GFXDevice_updateStates 0.001 0.001 23 GFXD3D9StateBlock_Activate 0.002 0.001 380 MatInstance_setTransforms 0.000 0.000 1140 GenericConstBufferLayout_set 0.001 0.001 380 BasicLightManager_SetLightInfo 0.000 0.000 1520 GenericConstBufferLayout_set 0.000 0.000 380 GenericConstBufferLayout_set 0.000 0.000 76 RenderPassManager_Sort 0.000 0.000 76 RenderPassManager_Clear 0.016 0.004 76 ShapeBase_PrepRenderImage 0.012 0.007 76 TSShapeInstance_Render 0.005 0.004 380 TSMesh_InnerRender 0.001 0.001 380 SceneRenderPassManager_addInst 0.000 0.000 380 LightManager_GetBestLights 0.000 0.000 76 TSShapeInstance_IFLMaterials 0.011 0.011 1444 Frustum_UpdatePlanes 0.001 0.001 76 String_char_constructor 0.000 0.000 76 GFXTextureManager_FindPooledTexure 0.001 0.000 62 MatInstance_SetupPass 0.001 0.001 62 ProcessedCustomMaterial_SetupPass 0.000 0.000 31 ProcessedShaderMaterial_SetShaderConstants 0.000 0.000 31 BasicLightManager_SetLightInfo 0.000 0.000 155 GenericConstBufferLayout_set 0.000 0.000 31 ProcessedShaderMaterial_SetTextureTransforms 0.000 0.000 31 BasicLightManager_SetLightInfo 0.001 0.000 31 GFXDevice_updateStates 0.000 0.000 31 GFXD3D9StateBlock_Activate 0.001 0.000 62 GFXD3D9Device_setShaderConstBufferInternal 0.001 0.000 62 GFXD3D9ShaderConstBuffer_activate 0.000 0.000 124 GenericConstBuffer_getDirtyBuffer 0.000 0.000 31 GFXD3D9ShaderConstBuffer_activate_dirty_check_1 0.000 0.000 124 GenericConstBuffer_isEqual 0.000 0.000 434 GenericConstBufferLayout_set 1.571 0.885 23 RenderTranslucentMgr_render 0.595 0.009 30423 GFXD3D9Device_setShaderConstBufferInternal 0.586 0.584 30423 GFXD3D9ShaderConstBuffer_activate 0.002 0.002 4585 GenericConstBuffer_getDirtyBuffer 0.000 0.000 46 GFXD3D9ShaderConstBuffer_activate_dirty_check_1 0.000 0.000 184 GenericConstBuffer_isEqual 0.045 0.034 15120 MatInstance_setTransforms 0.011 0.011 30240 GenericConstBufferLayout_set 0.036 0.036 15287 GFXDevice_updateStates 0.001 0.001 46 GFXD3D9StateBlock_Activate 0.004 0.004 15120 BasicLightManager_SetLightInfo 0.003 0.003 15852 GenericConstBufferLayout_set 0.001 0.000 46 MatInstance_SetupPass 0.001 0.000 46 ProcessedShaderMaterial_SetupPass 0.001 0.000 23 ProcessedShaderMaterial_SetShaderConstants 0.000 0.000 161 GenericConstBufferLayout_set 0.000 0.000 23 BasicLightManager_SetLightInfo 0.000 0.000 23 ProcessedShaderMaterial_SetTextureStages 0.000 0.000 23 ProcessedShaderMaterial_SetTextureTransforms 1.468 0.049 69 RenderMeshMgr_render 1.323 0.004 11286 GFXD3D9Device_setShaderConstBufferInternal 1.320 1.311 11286 GFXD3D9ShaderConstBuffer_activate 0.006 0.006 9422 GenericConstBuffer_getDirtyBuffer 0.003 0.002 757 GFXD3D9ShaderConstBuffer_activate_dirty_check_1 0.001 0.001 3028 GenericConstBuffer_isEqual 0.030 0.002 1728 MatInstance_SetupPass 0.026 0.007 1468 ProcessedShaderMaterial_SetupPass 0.017 0.011 734 ProcessedShaderMaterial_SetShaderConstants 0.003 0.002 734 BasicLightManager_SetLightInfo 0.001 0.001 2844 GenericConstBufferLayout_set 0.003 0.003 6560 GenericConstBufferLayout_set 0.002 0.002 734 ProcessedShaderMaterial_SetTextureStages 0.000 0.000 734 ProcessedShaderMaterial_SetTextureTransforms 0.002 0.001 260 ProcessedCustomMaterial_SetupPass 0.001 0.001 130 ProcessedShaderMaterial_SetShaderConstants 0.000 0.000 130 BasicLightManager_SetLightInfo 0.000 0.000 130 GenericConstBufferLayout_set 0.000 0.000 260 GenericConstBufferLayout_set 0.000 0.000 130 BasicLightManager_SetLightInfo 0.000 0.000 130 GenericConstBufferLayout_set 0.000 0.000 130 ProcessedShaderMaterial_SetTextureTransforms 0.029 0.021 5708 MatInstance_setTransforms 0.007 0.007 16613 GenericConstBufferLayout_set 0.019 0.012 2993 GFXDevice_updateStates 0.007 0.007 696 GFXD3D9StateBlock_Activate 0.016 0.011 5708 BasicLightManager_SetLightInfo 0.005 0.005 21438 GenericConstBufferLayout_set 0.001 0.001 5708 GenericConstBufferLayout_set 0.010 0.005 23 RenderGlowMgr_Render 0.002 0.000 46 MatInstance_SetupPass 0.002 0.001 46 ProcessedShaderMaterial_SetupPass 0.001 0.000 23 ProcessedShaderMaterial_SetShaderConstants 0.000 0.000 23 BasicLightManager_SetLightInfo 0.000 0.000 46 GenericConstBufferLayout_set 0.000 0.000 23 ProcessedShaderMaterial_SetTextureStages 0.000 0.000 23 ProcessedShaderMaterial_SetTextureTransforms 0.001 0.000 23 GFXDevice_updateStates 0.001 0.001 23 GFXD3D9StateBlock_Activate 0.001 0.000 502 GFXD3D9Device_setShaderConstBufferInternal 0.001 0.000 502 GFXD3D9ShaderConstBuffer_activate 0.000 0.000 320 GenericConstBuffer_getDirtyBuffer 0.000 0.000 23 GFXD3D9ShaderConstBuffer_activate_dirty_check_1 0.000 0.000 92 GenericConstBuffer_isEqual 0.001 0.001 251 MatInstance_setTransforms 0.000 0.000 251 GenericConstBufferLayout_set 0.007 0.006 92 GFXDevice_updateStates 0.001 0.001 92 GFXD3D9StateBlock_Activate 0.001 0.001 92 Frustum_UpdatePlanes 0.001 0.001 966 String_char_constructor 0.001 0.000 92 GFXD3D9Device_setShaderConstBufferInternal 0.001 0.000 92 GFXD3D9ShaderConstBuffer_activate 0.000 0.000 92 GFXD3D9ShaderConstBuffer_activate_dirty_check_1 0.000 0.000 368 GenericConstBuffer_isEqual 0.000 0.000 207 GenericConstBuffer_getDirtyBuffer 0.000 0.000 138 String_getHashCaseInsensitive 0.000 0.000 92 PostEffect_SetShaderConsts 0.000 0.000 69 GFXTextureManager_FindPooledTexure 0.000 0.000 23 MatTextureTarget_FindTargetByName 0.000 0.000 23 String_getHashCaseInsensitive 0.000 0.000 92 GenericConstBufferLayout_set 0.000 0.000 23 RenderParticleMgr_render 0.000 0.000 23 RenderRefractMgr_render 0.000 0.000 23 RenderOcclusionMgr_render 0.000 0.000 23 RenderImposterMgr_Render 0.026 0.026 23 RenderPassManager_Sort 0.009 0.009 23 RenderPassManager_Clear 0.000 0.000 23 InteriorPrepBatchRender 1.210 0.006 23 BuildSceneTree 1.191 0.006 3235 treeTraverseVisit 1.185 0.014 3495 treeTraverseVisit_prepRenderImage 0.450 0.151 936 TSShapeInstance_Render 0.299 0.242 19368 TSMesh_InnerRender 0.052 0.052 20265 SceneRenderPassManager_addInst 0.005 0.005 19368 LightManager_GetBestLights 0.000 0.000 936 TSShapeInstance_IFLMaterials 0.278 0.274 23 DecalManager_RenderDecals_RenderBatch 0.002 0.002 23 LightManager_ScoreLights 0.002 0.002 130 SceneRenderPassManager_addInst 0.000 0.000 130 GFXD3D9Device_AllocVertexDecl 0.000 0.000 130 String_default_constructor 0.000 0.000 23 LightManager_GetBestLights 0.247 0.002 198 ParticleEmitter_prepRenderImage 0.244 0.003 183 ParticleEmitter_copyToVB 0.183 0.183 130 ParticleEmitter_copyToVB_Orient 0.029 0.029 53 ParticleEmitter_copyToVB_NonOriented 0.029 0.029 183 ParticleEmitter_copyToVB_LockCopy 0.000 0.000 20 GFXD3D9Device_AllocVertexDecl 0.000 0.000 183 ParticleEmitter_copyToVB_Sort 0.001 0.001 183 SceneRenderPassManager_addInst 0.000 0.000 15 Frustum_UpdatePlanes 0.000 0.000 183 Frustum_Intersects 0.135 0.135 23 DecalManager_RenderDecals_SphereTreeCull 0.000 0.000 69 Frustum_SphereInFrustum 0.035 0.035 936 LightManager_ScoreLights 0.020 0.006 205 ShapeBase_PrepRenderImage 0.009 0.005 129 TSShapeInstance_Render 0.004 0.003 433 TSMesh_InnerRender 0.001 0.001 433 SceneRenderPassManager_addInst 0.000 0.000 433 LightManager_GetBestLights 0.000 0.000 129 TSShapeInstance_IFLMaterials 0.005 0.005 129 LightManager_ScoreLights 0.000 0.000 129 SceneRenderPassManager_addInst 0.000 0.000 159 Frustum_Intersects 0.003 0.003 2378 Frustum_Intersects 0.001 0.001 107 SceneRenderPassManager_addInst 0.001 0.001 69 WaterObject_prepRenderImage 0.000 0.000 31 SceneRenderPassManager_addInst 0.000 0.000 46 Frustum_Intersects 0.000 0.000 46 Frustum_UpdatePlanes 0.000 0.000 23 DecalManager_RenderDecals_Sort 0.000 0.000 23 SkyBox_prepRenderImage 0.010 0.007 23 ContainerFindObjects_Box 0.003 0.003 5083 Frustum_Intersects 0.002 0.002 122 Frustum_UpdatePlanes 0.001 0.001 442 Frustum_OBB_Intersects 0.000 0.000 23 SG_FindZone 0.013 0.000 23 RegisterLights 0.013 0.006 23 LightManager_RegisterGlobalLights 0.006 0.000 23 Container_FindObjectList_Frustum 0.005 0.005 23 Container_FindObjectList_Box 0.001 0.001 1495 Frustum_Intersects 0.000 0.000 46 Frustum_UpdatePlanes 0.003 0.003 437 Frustum_UpdatePlanes 0.000 0.000 23 SceneGraphRender_PreRenderSignal 0.000 0.000 23 SceneGraphRender_PostRenderSignal 0.000 0.000 23 UnregisterLights 0.452 0.287 2448 GFXDevice_drawTextN 0.150 0.144 2448 GFXDevice_updateStates 0.006 0.006 1136 GFXD3D9StateBlock_Activate 0.015 0.015 146471 GFont_getCharInfo 0.414 0.373 7200 GFXDevice_updateStates 0.042 0.042 2023 GFXD3D9StateBlock_Activate 0.031 0.021 3699 convertUTF8toUTF16 0.010 0.010 99304 oneUTF8toUTF32 0.006 0.005 23 ContainerFindObjects_Frustum 0.001 0.001 2202 Frustum_Intersects 0.003 0.003 26678 GFont_getCharInfo 0.002 0.002 23 GFXBeginScene 0.001 0.001 1368 String_char_constructor 0.001 0.001 46 SimFindObject 0.001 0.001 1069 String_getHashCaseInsensitive 0.000 0.000 46 Frustum_UpdatePlanes 0.000 0.000 1253 String_String_constructor 0.546 0.004 23 ProcessTimeEvent 0.241 0.031 23 ClientProcess 0.209 0.128 23 AdvanceClientTime 0.075 0.002 23 AdvanceTime 0.073 0.023 736 AdvanceObjects 0.046 0.001 736 Player_ProcessTick 0.044 0.034 667 Player_PhysicsSection 0.010 0.002 667 Player_UpdatePos 0.007 0.001 667 SceneObjectSetTransform 0.004 0.000 667 SG_ZoneInsert 0.004 0.004 667 SG_Rezone 0.001 0.001 667 CheckBins 0.001 0.001 667 SceneObj_setRenderTransform 0.000 0.000 667 SG_ZoneRemove 0.000 0.000 667 ContainerFindObjects_Box 0.000 0.000 667 Container_FindWaterAndZoneObjects_Box 0.000 0.000 667 String_default_constructor 0.001 0.000 69 SceneObjectSetTransform 0.001 0.000 69 SG_ZoneInsert 0.001 0.001 69 SG_Rezone 0.000 0.000 69 CheckBins 0.000 0.000 69 SceneObj_setRenderTransform 0.000 0.000 69 SG_ZoneRemove 0.000 0.000 69 SceneObj_setRenderTransform 0.004 0.003 690 SceneObjectSetTransform 0.001 0.001 690 SceneObj_setRenderTransform 0.001 0.000 690 ContainerFindObjects_Box 0.000 0.000 690 Container_FindWaterAndZoneObjects_Box 0.000 0.000 690 String_default_constructor 0.005 0.001 322 SceneObjectSetTransform 0.002 0.000 322 SG_ZoneInsert 0.002 0.002 322 SG_Rezone 0.001 0.001 322 CheckBins 0.000 0.000 322 SceneObj_setRenderTransform 0.000 0.000 322 SG_ZoneRemove 0.000 0.000 230 SceneObj_setRenderTransform 0.000 0.000 23 UpdateActionThread 0.000 0.000 4 String_default_constructor 0.002 0.000 23 SFXSystem_Update 0.001 0.001 23 SFXXAudioDevice_Update 0.000 0.000 23 SFXSystem_UpdateSources 0.000 0.000 23 SFXSystem_AssignVoices 0.000 0.000 23 SFXListener_SortSources 0.182 0.167 23 ClientNetProcess 0.012 0.001 190 convertUTF8toUTF16_create 0.012 0.007 190 convertUTF8toUTF16 0.005 0.005 32780 oneUTF8toUTF32 0.001 0.001 2 GFXTextureManager_CreateTexture_Bitmap 0.000 0.000 2 SWIZZLE_UPLOAD 0.000 0.000 2 Swizzle32_Upload 0.000 0.000 4 String_char_constructor 0.000 0.000 6 String_getHashCaseInsensitive 0.000 0.000 4 String_default_constructor 0.001 0.001 100 SimFindObject 0.000 0.000 2842 String_String_constructor 0.000 0.000 577 String_default_constructor 0.000 0.000 38 String_char_constructor 0.000 0.000 22 String_getHashCaseInsensitive 0.103 0.000 23 ServerProcess 0.103 0.002 23 AdvanceTime 0.101 0.030 736 AdvanceObjects 0.067 0.002 736 Player_ProcessTick 0.064 0.037 736 Player_PhysicsSection 0.027 0.015 736 Player_UpdatePos 0.010 0.002 736 SceneObjectSetTransform 0.006 0.000 736 SG_ZoneInsert 0.005 0.005 736 SG_Rezone 0.001 0.001 736 CheckBins 0.001 0.001 736 SceneObj_setRenderTransform 0.000 0.000 736 SG_ZoneRemove 0.001 0.001 736 SimFindObject 0.001 0.000 736 ContainerFindObjects_Box 0.000 0.000 736 Container_FindWaterAndZoneObjects_Box 0.000 0.000 736 String_default_constructor 0.001 0.001 736 UpdateActionThread 0.004 0.003 690 SceneObjectSetTransform 0.001 0.001 690 SceneObj_setRenderTransform 0.000 0.000 690 ContainerFindObjects_Box 0.000 0.000 690 Container_FindWaterAndZoneObjects_Box 0.000 0.000 690 String_default_constructor 0.016 0.015 23 ServerNetProcess 0.000 0.000 23 ClientCatchup 0.000 0.000 16 SceneObjectSetTransform 0.000 0.000 16 SceneObj_setRenderTransform 0.000 0.000 16 ContainerFindObjects_Box 0.000 0.000 16 Container_FindWaterAndZoneObjects_Box 0.000 0.000 16 String_default_constructor 0.000 0.000 23 String_default_constructor 0.000 0.000 1 SceneObjectSetTransform 0.000 0.000 1 SceneObj_setRenderTransform 0.000 0.000 23 SimAdvanceTime 0.136 0.136 23 SwapBuffers 0.095 0.092 23 CanvasPreRender 0.003 0.000 2769 GFont_getCharInfo 0.002 0.002 1 GFont_loadCharInfo 0.000 0.000 1 SWIZZLE_UPLOAD 0.000 0.000 1 String_char_constructor 0.000 0.000 1 String_getHashCaseInsensitive 0.001 0.000 34 convertUTF8toUTF16 0.000 0.000 1573 oneUTF8toUTF32 0.003 0.003 23 GFXEndScene 0.000 0.000 22 SimFindObject 0.000 0.000 5 convertUTF8toUTF16_create 0.000 0.000 5 convertUTF8toUTF16 0.000 0.000 765 oneUTF8toUTF32 0.000 0.000 2 convertUTF16toUTF8 0.000 0.000 29 oneUTF32toUTF8 0.000 0.000 29 oneUTF16toUTF32 0.000 0.000 5 String_char_constructor 0.000 0.000 25 String_default_constructor 0.000 0.000 39 String_String_constructor 0.000 0.000 3 String_getHashCaseInsensitive 0.000 0.000 4 convertUTF8toUTF16_create 0.000 0.000 4 convertUTF8toUTF16 0.000 0.000 612 oneUTF8toUTF32 0.000 0.000 12 String_String_constructor 0.000 0.000 3 String_default_constructor
It looks like something is going on in the decal manager clipping code...
Please let me know if there is any other information I can provide to help fix this issue.
Thank you very much in advance for any help you might be able to provide.
Stephane
About the author
Recent Threads
#2
I'm going to try scaling the art asset outside of Torque and see what happens. I'll report back with some more information.
Cheers,
Stephane
09/07/2009 (8:22 pm)
Hey Ross. Thanks for the quick response. I have a suspicion that more is going on here than just a larger area needing to be clipped. I would have thought that the framerate drop associated with a bigger shadow would have been roughly linear, whereas I'm seeing a massive exponential drop in framerate (in the above example I scaled the object up 5 times and saw a 150 times drop in framerate)...I'm going to try scaling the art asset outside of Torque and see what happens. I'll report back with some more information.
Cheers,
Stephane
#3
Also go ahead and try setting the scale on the player to 10, 10, 10 in the blank mission, as the framerate was okay for me when I did that. Although I do have a lot of performance improvements in trunk that aren't in beta 5 (such as not setting up lights/materials etc. in order to render an object's shadow, it increased the speed by a lot).
09/07/2009 (9:53 pm)
Well, as it's scaling, it will of course be slower. However, I suggest seeing how many verts you're trying to clip. And turn on the player collision rendering, as it can give you an idea of how many verts it's grabbing.Also go ahead and try setting the scale on the player to 10, 10, 10 in the blank mission, as the framerate was okay for me when I did that. Although I do have a lot of performance improvements in trunk that aren't in beta 5 (such as not setting up lights/materials etc. in order to render an object's shadow, it increased the speed by a lot).
#4
As Ross mentioned there are improvements in the shadow projection code, but don't expect a dynamic shadow cast across 1000s of triangles to perform really well.
09/09/2009 (6:08 pm)
Quote:I would have thought that the framerate drop associated with a bigger shadow would have been roughly linearIts not... its exponential.
As Ross mentioned there are improvements in the shadow projection code, but don't expect a dynamic shadow cast across 1000s of triangles to perform really well.
#5
I finally got some time to scale the asset by the exact same amount in Maya and then brought it into the game and that had zero effect on the framerate... I'm kind of confused. Shouldn't that cause the exact same drop in framerate since the object is the same size??
I'll post again as soon as I have some more information.
Cheers,
Stephane
09/09/2009 (11:48 pm)
Thank you for the feedback Tom and Ross.I finally got some time to scale the asset by the exact same amount in Maya and then brought it into the game and that had zero effect on the framerate... I'm kind of confused. Shouldn't that cause the exact same drop in framerate since the object is the same size??
I'll post again as soon as I have some more information.
Cheers,
Stephane
#6
Original unscaled object: 282 verts
Maya-scaled object: 364 verts
Torque-scaled object: 987 verts
Stephane
09/10/2009 (12:20 am)
I checked out the clipper structure to see how many verts it was trying to clip against. Here's the verdict:Original unscaled object: 282 verts
Maya-scaled object: 364 verts
Torque-scaled object: 987 verts
Stephane
#7
I'm not entirely sure this is correct, but it seems like something like the following would make more sense:
The above code would make objects of the same size (regardless of whether they were scaled inside torque or not) more consistent yet it does slightly change the behavior of shadowLen. shadowLen becomes a scaling factor for the height of the object rather than an actual length.
What are your thoughts?
Stephane
09/10/2009 (1:00 am)
It looks like the issue I'm seeing is the following line of code:Point2F clipParams( shadowLen * mParentObject->getScale().z,
(boxExtents.x + boxExtents.y) * 0.25f );I'm not entirely sure this is correct, but it seems like something like the following would make more sense:
boxExtents.convolve(mParentObject->getScale());
Point2F clipParams( shadowLen * boxExtents.z,
(boxExtents.x + boxExtents.y) * 0.25f );The above code would make objects of the same size (regardless of whether they were scaled inside torque or not) more consistent yet it does slightly change the behavior of shadowLen. shadowLen becomes a scaling factor for the height of the object rather than an actual length.
What are your thoughts?
Stephane
Associate Ross Pawley
if ( clipper.mVertexList.empty() ) return false;around line 233 and see how many verts it got back (it's probably going to be a lot).
One thing you can do to easily tone down the performance hit of clipping decals/shadows for big objects is to set up the type mask for the projected shadow to be suited to your project. Possibly you might want to set it to only clip against TerrainBlock. You'll have to set the mask in C++ for now, as it seems it's not exposed to script at the moment. Or if that doesn't work (and that's kind of lame anyway) you could just expose it by setting up the addField call for the clippingMasks like so (normally if it wasn't set up at all you'd have to set up the pack/unpackUpdate etc. but I believe that should all be setup):
addField( "clippingMasks", TypeS32, Offset( clippingMasks, DecalData ), "The mask flag which specifies which types of objects DecalInstances using this DecalData will clip against." );then set up your clippingMasks field to be $TypeMasks::TerrainObjectType (edit, in the corescriptsclientlightingbasicinit.cs file, on the DecalData BL_ProjectedShadowDecal datablock :P).In the next release you'll also be able to specify how many ms you want the shadow updates to be bound to per frame (the default right now is 4-5 with which it can do about 6-7 shadows in one frame I think, depending on the complexity of the objects being rendered (if they have a lot of submeshes it will be slower, I reckon) and of course that general target is for normal size players, and thus relatively small decals.
Also keep in mind that your settings for TSStatics and such will affect how your clip performs. I suggest looking at the player collision render option in the visibility settings dropdown and running around with your scaled player and seeing what sorts of stuff it might be clipping (if you see lots of complex meshes there, you'll likely want to change your TSStatic collision settings not to use the visible geometry, and add a collision mesh if you don't already have one). Also in the next release, the projected shadow will try not to clip when it doesn't need to, such as when an Item is rotating, but not translating, or a player is standing still.
Further, you'll want to make sure your player doesn't go outside his bounds when he animates (see Gideon for an example, esp the swim anims), or his shadow will go outside the bounds of the clipped geometry. Though you can use the ShapeBaseData shadowSphereAdjust to artificially increase the bounds for the purposes of making sure the shadow never goes outside the decal bounds (but really, if your art is right you shouldn't need to use it).
Edit: Let me know if this helps, or if you need more info, less, better description of how stuff is working or whatnot, thanks :)