Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

255 Neutral

About KaiRohmer

  • Rank
  1. Hi, I encountered an issue I can’t really understand so I’ll try to explain it here to get a reasonable explanation of what’s happing. I modified the tiled deferred rendering code by Andrew Lauritzen (http://software.intel.com/en-us/articles/deferred-rendering-for-current-and-future-rendering-pipelines) to have shadows maps for each light. To be able to turn on and off shadows I’m using shader classes that look this: interface iBaseVPLShadow { bool IsEnabled(); float GetVisibility(Texture2DArray shadowBuffer, float3 receiverWorldPos, float4x4 lightViewProjection, uint lightIndex); }; The lighting is done in a compute shader. Basically like this: #define TILE_DIM 8 [numthreads(TILE_DIM, TILE_DIM, 1)] void main( … ) { // Read GBuffer at current Texel // Calculate Tile Frustum GroupMemoryBarrierWithGroupSync(); for all lights { // each thread of the block culls one light // if the light intersects the tile frustum add it to the tiles light list } GroupMemoryBarrierWithGroupSync(); float3 luminance = float3(0,0,0); for all lights in the tiles light list { // shadow test float visibility = 1.0; if (SlotVPLShadow.IsEnabled()) visibility = SlotVPLShadow.GetVisibility(VPLShadowBuffer, worldPosition, VPLViewProjectionData[tileLightIndex], tileLightIndex); // light amount of the light arriving at the surface float3 irradiance = visibility * SlotVPL.GetIrradiance( … ) // light amount reflected by the surface (visible to the observer) luminance += irradiance * SlotDiffuseMaterial.BRDF( … ) } // write luminance to output target } As stated by that pseudo code I’m using multiple interface. One class to describe the light source, one for the material brdf, and one for the shadows.  I implemented the iBaseVPLShadow interface to do a common shadow mapping with a Load in the shadow buffer and a comparison in light space depth. And I also implemented the interface for “no shadows” in which case the GetVisibility(…) method simply returns 1.0.   Now to the interesting part.   You may ask yourself why there is the IsEnabled() method. Actually I really don’t know^^ But if it is not there the execution time for the “no shadow” class is HIGHER than the “shadow mapping” class by factor 1.5. And there are shadow artifacts if don’t unroll the last loop in the latter case.   I think both problems might be related to the loop because it’s not clear how often to loop at compile time and number of lights easily goes beyond 100. But nevertheless it totally confuses my understanding on how shader classes work because everything is totally fine (and fast) with the IsEnabled() check to prevent the GetVisibility() call if the shadows are disabled.   Sorry for this vague description but I'm not able provide a mini sample because it's in a bigger system with lots of dependencies.
  2. KaiRohmer

    Using NVIDIA Nsight with SharpDX

    Seems that i ran into the next problem.. I'm working with WPF Hosts to get XAML based UI   now nsight shows the directx 9 calls that are used to render ui elements and the only thing i get of my call is the draw of the shared "backbuffer". any idea how to address that?   because of the host i don't have a present call. So think there is no chance for nsight to identify frames ...
  3. KaiRohmer

    Using NVIDIA Nsight with SharpDX

    Sorry it took me a while to look into this again..   i checked all your points.. now it works! thanks! for those who are interested in the future: select x86 in the build settings and remove the Debug flag during the creation of your device.
  4. Sorry to bother you with a lot SharpDX questions but since their forum is closed this seems to be the place to find the people ;)   Is anybody using Nsight with SharpDX? I'm not able to get it running. .even for SDK samples. I read that managed code is not officially supported, but SharpDX is just a wrapper. The GPU calls are quite the same.   So please let me know if you've made other experience ;)   Thanks - Kai
  5. thanks. i'll try linking against 8.1 sdk and if thats not satisfying i''ll go for MJPs offline reflection approach ;)   Edit: I'll managed to switch to 8.1.. visuals studio can make life complicated sometimes^^ Nevertheless i also compiled SharpDX to get the latest build and together with 8.1 it works fine.. even without deploying he compiler dlls.
  6. Hi, I'm working with sharp dx (without the toolkit) and I'm trying to get dynamic shader linkage working. There is no real sample for dynamic shader linkage but looking into the dx sdk samples helps ;). as you can see there you need shader reflection and this is a part of the d3d compiler. While building for windows desktop everything works fine (at least if the native dlls are present d3dcompiler_4x.dll).   When building for windows store apps the application crashes as soon as i create the a shader reflection object. The message says: d3dcompiler_46.dll is missing. My solution to that: add the dll to the application content.. works fine, too.. but is dirty because i have to add this dll to each application   so i started a thread in the developer forum: http://social.msdn.microsoft.com/Forums/windowsapps/en-US/b2e6e1c4-f1aa-4b6f-bf56-e2096cb97e73/load-a-dll-that-is-contained-in-the-content?forum=winappswithcsharp#a75c40a8-3f63-4698-a607-476000720204   and one guy there got furious ;) he says my solution is not legal ..  now there is no response so i decided to post this here again and ask for a better solution ;)   maybe there is a better way to get shader linkage working with sharp dx..   thanks - Kai
  7. KaiRohmer

    Frustum Box Intersection (again i know)

    Thanks for the confirmation, eppo ;) to not increase the computation costs i decided to fit a bounding sphere around the frustum and test agist this first.   @raigan these are a lot of tests per box.. maybe there is a more optimized version of that method (i'll look into it if there is time and keep you posted)
  8. hi, im currently working on frustum culling and looked for frustum-box intersection tests. i found a tutorial appearing all the time: http://www.lighthouse3d.com/tutorials/view-frustum-culling/geometric-approach-testing-boxes-ii/ even here in the forum: http://www.gamedev.net/topic/512123-fast--and-correct-frustum---aabb-intersection/   during debugging some objects that should be culled were rendered so i looked deeper into it.. i made a picture to visiualize my problem..   [attachment=18629:FrustumBoxTest.png]   is it possible that the algorithm misses that case? what is the common solution to address this? I'm fine with AABBs ;)   thanks - Kai
  9.   okay.. here you see the number of uv coords is 3 times the number of faces.. this is very typical for textured models.. i've never seen separete index lists per semantic. i guess all your index lists are of the same size (3 * 628) if thats so you may allocate your vertexbuffer (or buffers if you don't want interleaved vertexbuffers), iterate over the index lists and fill your buffer with the data at the given indices: positionBuffer[faceCount*3] tecCoordsBuffer[faceCount*3] for(int i=0; i<faceCount*3; i++) { positionBuffer[i] = positionData[positionIndices[i]]; texCoordBuffer[i] = texCoordData[texCoordIndices[i]]; } this will flatten you buffers (you don't need the indexbuffer for drawing) for a interleaved buffer you will create a struct containing fields for position and texcoords and an array of these structs in a similar way
  10. I think there are a few possible reasons for the problem you describe. 1. The easiest.. you have multiple sets of texture coordinates and this should be easy to figure out by checking the counts ;) 2. You misunderstood the concept of the index buffer. The number of elements in the position buffer has nothing to do with the vertex count. It possible that you need different vertices at the same position (in the worst case one per adjacent triangle). You should think about the relations of the different buffer sizes and counts. E.g. IndexCount = PrimitiveCount * 3 (for triangles). If your model consists of multiple meshes you need to consider the offsets too. You may post the different buffer sizes and counts here and I’m sure that we will find out what’s wrong. 3. your model is messed up ;)
  11. KaiRohmer

    Fastest learning path to spherical harmonics?

    I started with this article, too. It's pretty good to see how it's used and what the coefficients do before getting deeper into the math behand.
  12. KaiRohmer

    (C++)Cross Platform Audio API?

    Have you considered fmodEX? It's my personal favorite because it's low level, easy to use and offers a huge amount of features (if you need them) http://www.fmod.org/download/
  13. Thanks for this nice discussion! I just wondered what would happen if have two branches with heavy usage of the texture units. E.g, Different shadow tests for standard shadow maps and hemispherical shadow maps.
  14. Hey, im wondering if there is a specified behavior for branches in shader code if the condition is not really dynamic. While searching the forum i found some hints that dynamic branching is not possible if some functions like Sample(...) are used. What if the condition is a value defined in the constant buffer? In this case all threads are following the same path and evaluating both paths is theoretically not requiered. Is this depending on the compiler and driver or are there any specified  and documented rules?   with shader i mean sharder in general rendering pipeline and compute shader or cuda.   Thanks - Kai
  15. Hi, I'm currently working with sharp dx and manage my GUI via WPF interop, whats not that nice.. one is not really able to debug using pix e.g. i'm looking for something like scaleform (to name to perfect solution ;).. but for C# and not inside unity ;) what are you using? Thanks!
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!