Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

866 Good


About _void_

  • Rank

Personal Information

  • Role
  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hey guys! I am not sure how to specify array slice for GatherRed function on Texture2DArray in HLSL. According to MSDN, "location" is one float value. Is it a 3-component float with 3rd component for array slice? Thanks!
  2. @SoldierOfLightExcellent! Then I need to fix it 🙂 Thanks!
  3. Hi guys! In a lot of samples found in the internet, people when initialize D3D12_SHADER_RESOURCE_VIEW_DESC with resource array size 1 would normallay set its dimension as Texture2D. If the array size is greater than 1, then they would use dimension as Texture2DArray, for an example. If I declare in the shader SRV as Texture2DArray but create SRV as Texture2D (array has only 1 texture) following the same principle as above, would this be OK? I guess, this should work as long as I am using array index 0 to access my texture? Thanks!
  4. @Hodgman Suppose, we have 128 shadow maps in the cache and 50 out of them require update. Say we can handle 8 shadow maps per frame and, currently, we have 6 lights visible in the camera with 1 up-to-date shadow map. So we need to update only 6-1=5 shadow maps. But since our budget for shadow map update is 8, I was under impression, they would pick 8-5=3 outdated shadow maps more from the cache so that to keep it up-to-date as much as possible. But if they do not want to update stale cache as soon as possible they would just update currently visible 5 shadow maps.
  5. Hey! What is the recommended upper count for commands to record in the command list bundle? According to MSDN it is supposed to be a small number but do not elaborate on the actual number. I am thinking if I should pre-record commands in the command buffer and use ExecuteIndirect or maybe bundles instead. The number of commands to record in my case could vary greatly. Thanks!
  6. @Hodgman Thanks for the input. They do use the first strategy I described trying to fill the stale cache asap, right?
  7. Hey guys! I am going through Rendering in Call of Duty presentation. I would like to double-check with you if I follow correctly their shadow caching scheme (slides 21, 22) . As the first step, they cull light view frustums against camera frustum. Then, they take from the stale cache all shadow maps which require update. Phrasing "DO NOT need update" sounds a bit odd to me in this context. Among these shadow maps from the stale cache, they pick 4-8 of them based on importance (detected as visible on the first step?, distance, projection size, etc) and update them. They are sort of trying to fill their stale cache as soon as possible. If I understand correctly, the stale cache is the one which drives shadow map update as they want to populate it as soon as possible? I guess, another strategy would be to pick 4-8 relevant shadow maps to the camera frustum. For each shadow map, check if it is in the stale cache and update if needed. Otherwise, do nothing. By doing this, stale cache gets populated not so aggressively. BTW, what does keyword "FIN" mean in the slide? Thanks!
  8. @JoeJ Great :-) Thanks for the links!
  9. Hi guys, I am implementing parallel prefix sum on DirectCompute and using GPU Gems 3 article as a reference for CUDA implementation. In the article, the authors add logic to handle shared memory bank conflicts. Mark Harris, one of the authors, claimed later at Stack Overflow that you do not need to handle explicitly bank conflicts in CUDA any more. How about DirectCompute? Do you need to manage this yourself? Is there a difference between D3D10/D3D11/D3D12 versions? Thanks!
  10. OK. I see what you mean now
  11. @galop1n At the moment, I am not doing VSM pre-filtering yet but planning to add this. I did not understand. Why wouldn't SampleLevel work with VSM mip-maps?
  12. @galop1nYou are absolutely correct. SampleLevel fixes the problem. Thanks a bunch!
  13. Hi guys! I am using tile based shading in my project. I am adding shadows contribution to the shading pass and I am getting strange errors when compiling the pixel shader. Below is a code snippet of the pixel shader. float3 pointLightsContrib = float3(0.0f, 0.0f, 0.0f); for (uint lightIndexPerTile = pointLightIndexPerTileStart; lightIndexPerTile < pointLightIndexPerTileEnd; ++lightIndexPerTile) { uint lightIndex = g_PointLightIndexPerTileBuffer[lightIndexPerTile]; float3 lightWorldSpacePos = g_PointLightWorldBoundsBuffer[lightIndex].center; // Plus rest of the code float3 lightContrib = CalcPointLightContribution(lightWorldSpacePos, lightColor, lightRange, worldSpaceDirToViewer, worldSpacePos, worldSpaceNormal, diffuseAlbedo, specularAlbedo, shininess); // Plus rest of the code float lightVisibility = CalcPointLightVisibility(g_VarianceShadowMapSampler, g_PointLightTiledVarianceShadowMap, lightViewProjMatrix, lightViewNearPlane, lightRcpViewClipRange, worldSpacePos); pointLightsContrib += lightVisibility * lightContrib; } And there are helper functions used from the pixel shader above. float VSM(SamplerState shadowSampler, Texture2D<float2> varianceShadowMap, float2 shadowMapCoords, float receiverDepth) { float2 moments = varianceShadowMap.Sample(shadowSampler, shadowMapCoords).xy; return ChebyshevUpperBound(moments, receiverDepth); } float CalcPointLightVisibility(SamplerState shadowSampler, Texture2D<float2> varianceShadowMap, float4x4 lightViewProjMatrix, float lightViewNearPlane, float lightRcpViewClipRange, float3 worldSpacePos) { float4 lightClipSpacePos = mul(lightViewProjMatrix, float4(worldSpacePos, 1.0f)); float3 lightPostWDivideProjSpacePos = / lightClipSpacePos.w; float2 shadowMapCoords = float2(0.5f * (lightPostWDivideProjSpacePos.x + 1.0f), 0.5f * (1.0f - lightPostWDivideProjSpacePos.y)); float lightSpaceDepth = lightClipSpacePos.w; float normalizedLightSpaceDepth = (lightSpaceDepth - lightViewNearPlane) * lightRcpViewClipRange; return VSM(shadowSampler, varianceShadowMap, shadowMapCoords, normalizedLightSpaceDepth); } When I compile the shader, I get the following warning and error. Warning: warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop Error: error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (210 iterations) or unrolled loop is too large, use the [unroll(n)] attribute to force an exact higher number The warning points to the line "float2 moments = varianceShadowMap.Sample(shadowSampler, shadowMapCoords).xy;" of VSM function and the error points to the line "for (uint lightIndexPerTile = pointLightIndexPerTileStart; lightIndexPerTile < pointLightIndexPerTileEnd; ++lightIndexPerTile)". If I change implementation of VSM function to simply { return 1.0f } it compiles fine. What is going on?
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!