Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

462 Neutral

About Lutz

  • Rank
  1. Also wanted to mention, I used GetFileSize before, but that seems to be equally slow if not slower (some people say it's slower, I didn't get a big difference). My thread that calls [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][background=rgb(250, 251, 252)]GetFileAttributesExA is already a background thread, so it's not stalling the game or anything, but it stalls the whole async pipeline. I could put [/background] [/font][color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][background=rgb(250, 251, 252)]GetFileAttributesExA into its own thread, that's an option, but it seems like using a pak file is a much more elegant solution.[/background] [/font]
  2. A colleague of mine actually suggested the same thing, use a pak file. I think that's the way to go. Thanks, guys!
  3. Hey, I'm using OVERLAPPED IO for asynchronous file IO (Win32, C++) to read files to a buffer in one go and that part works fine. The problem I'm having is to know how big the buffer has to be, i.e. I need to know the file size. I'm using GetFileAttributesExA right now because it's my understanding that this is the fastest way to do it, but it's still a blocking command. Especially when loading data from a network drive, that's a total killer as it can block for a long time for remote access. Is there any way to get the file size asynchronously? Thanks, - Lutz
  4. Wow, first of all a huge huge thank you for your answer. I really appreciate it. A lot of it sounds very familiar (like artists crying for more). I'm still digesting your post, but I'm going to have some questions. One is, what do you mean with "[color=#1C2837][size=2]render the gun with a viewport set to a range of 0/0.0000001 in order to get the gun to occlude the world". That range, is that the depth range? So you basically force depth=0? One thing I can add: It is possible to read directly from the depth buffer in DX9 (NVidia 8xxx series and ATI 4xxx series I think). You have to create an INTZ texture ((D3DFORMAT)MAKEFOURCC('I','N','T','Z')), then get surface 0 from it (GetSurfaceLevel) and pass the surface into SetDepthStencilSurface before rendering. If you read from that texture, the value is going to be between 0 and 1 in homogeneous device coordinates. To get back view-space depth, you have to unproject it. This burns down to // inverseRenderTargetSize = float2(1/renderTargetSizeX, 1/renderTargetSizeY) float2 normalizedDeviceCoords = (VPos+ 0.5) * inverseRenderTargetSize; float rawDepth = tex2D(DepthBufferTex, normalizedDeviceCoords).x; float2 gamma = rawDepth * InverseProjectionMatrix._33_34 + InverseProjectionMatrix._43_44; float viewDepth = gamma.x/gamma.y; This is shader model 3 and up and VPos is the pixel position (as provided by SM3). - Lutz
  5. @Danny02: The problem is in a deferred engine you don't do the lighting per object, but write lighting information to the g-buffer and do the lighting afterwards in a pixelshader. At that stage, I don't know anymore which pixel was rendered with which view matrix. @Hodgman: That's an interesting idea, but unfortunately I don't store xyz in the g-buffer, but only z and then I reconstruct xy from z and the view-proj matrix.
  6. Hey, I was wondering what people do for the first person weapon in a deferred engine. I know that some engines render the first person weapon with a different field-of-view, so the artists can make it look exactly the way they want. Now I was thinking of doing the same thing for a deferred engine. In the lighting pass, I have to get back from pixel coordinates to view space. Now the view space is different for normal pixels vs FP weapon pixels. So unless I store the view information in the g-buffer as well, it should be technically impossible to calculate the correct pixel position, right? What do other deferred engines do? Hybrid approach (render weapon with forward renderer and everything else deferred)? - Lutz
  7. Hey, I know how to handle a lost device and recovering it. I have a method CheckDeviceCooperativeLevel that calls TestCooperativeLevel and handles D3DERR_DEVICELOST and D3DERR_DEVICENOTRESET properly. It returns true only if TestCooperativeLevel succeeds. My main render loop that gets called once a frame looks like this: if (CheckDeviceCooperativeLevel) { // Do all the drawing } The question I have is at what times can a device get lost? Assume I lock a buffer inside the drawing loop. Can I assume that locking that buffer always succeeds or can the device get lost between TestCooperativeLevel and the locking operation? Are there only certain instances when a device gets lost or can it happen any time? So for instance if I upload my textures inside the drawing loop, do I have to try again next frame if uploading fails or can I assume that it will always succeed? Similarly for CreateQuery - do I have to handle the case when that fails? - Lutz
  8. Thanks for the answer. The polygons are fairly small, so memory is not a concern. My containment test shoots a horizontal ray from the first vertex of polygon 1 and counts the intersections with polygon 2. Polygon 1 is contained in polygon 2 if and only if the number of intersections is odd. So that's not a symmetric test (i.e. I don't know afterwards if polygon 2 is contained in polygon 1). That test could be accelerated by sorting all edges by their y-coordinates, so I can sort out edges quickly that can't intersect with the horizontal ray. The brute force method iterated through all polygons Pn, found the root (the one that contains Pn, but is not contained in any polygon), then found all the descendants of root (all polygons contained in root), and then iteratively built the graph from there. This method is at least O(N^2) in the number of polygons. In the mean time, I've found a somewhat better way to find the graph than the brute-force method. It's like qsort. First I pick some pivot polygon P, e.g. the first one. Then I find all children C of P and the "non-children" NC, which is simply the rest. I call the method recursively for the set C and NC of polygons. The tree resulting from C is the children of P. P might be a child or a root-level sibling of NC, so I just insert it there. If the number of children per level is bounded, this method should be about N (log N)^2. Here's the pseudo code: struct Tree { Polygon Root; List<Tree> Children; } List<Trees> CreateTrees(List<Polygon> plist) { Polygon pivot = plist[0]; List<Polygon> children, nonChildren; for each Polygon p in plist (without pivot) { if (p is contained in pivot) children.Add(p); else nonChildren.Add(p); List<Hierarchy> childTrees = CreateTrees(children); List<Hierarchy> nonChildTrees = CreateTrees(nonChildren); Tree pivotTree = new Tree() { Root = pivot, Children = childTrees }; InsertChild(nonChildTrees, pivotTree); } } InsertChild just iterates through each level of the tree, finds the polygon that pivot is contained in, and adds pivotTree as a child at the leaf that's found. If pivot is not contained in any polygon, pivotTree is added as a sibling (then pivot itself is a root).
  9. Hey guys, I have come across a nice computer science problem. I have a bunch of 2d polygons and I know they don't intersect each other, but they can be contained inside each other. Think of a box contained in a box contained in a box. I have a method IsContained(p1,p2) that tests whether polygon p1 is inside polygon p2. I know want to reconstruct the tree structure of the containment of the polygons. For instance, if box b1 is contained in box b2 and b2 is contained in b3, IsContained(b1, b2) == true and IsContained(b2, b3) == true, but also IsContained(b1, b3) == true. I'd like to have a tree that tells me that the parent of b1 is b2, not b3, and that b3 is the root. There could possibly be many roots, so strictly speaking I want to get a list of trees. I already have a fairly brute-force method doing that, but I'd like to know if there's a clever way of doing that. Some sort of Dijkstra algorithm maybe? Thanks, - Lutz
  10. Thanks for the info. It is indeed 64 bit Windows 7. Your post looked very promising, but unfortunately even dxdiag /t c:\users\<username>\test.txt /64bit doesn't work :-( No file is being created.
  11. Sorry, I wasn't clear enough. -t doesn't work for me on Windows 7. Can you guys test it at your computers and tell me if it works for you?
  12. Not it. Actually both /t and -t work on XP. The help (dxdiag /?) says /t is the proper option. Some more details: Tried it on Vista today and it works. So it seems to be a Windows 7 only issue and it's unlikely a permission issue since from my understanding Vista and 7 use a similar permission system, right?
  13. Hey, I'm trying to get a text file from dxdiag with dxdiag /t dxdiag.txt. Everything works fine on Windows XP, but I can't seem to make it work on Windows 7. Haven't tried it on Vista yet. Here's the different variants I tried, all of them didn't work. In all cases, the task manager shows that dxdiag is running for a few seconds until it quits without writing the output file. 1) Simple way Run cmd dxdiag.exe /t dxdiag.txt 2) Maybe a permission issue? Run cmd in admin mode dxdiag.exe /t dxdiag.txt 3) Maybe the output file needs to be in a directory we can write to? Run cmd dxdiag.exe /t C:\Users\<username>\dxdiag.txt Any ideas? - Lutz
  14. Hi, I'm trying to reference the Microsoft.DirectX and Direct3D assemblies in a managed C++ project in .NET framework 3.5. I've verified that those files are located in C:\windows\assembly\gac. The version it shows for both assemblies is 1.0.2902.0. I use DirectX from another C# project all the time, so I'm absolutely sure DirectX is installed properly. When I add #using <Microsoft.DirectX.dll> to a header file in the managed C++ project, I get fatal error C1107: could not find assembly 'Microsoft.DirectX.dll': please specify the assembly search path using /AI or by setting the LIBPATH environment variable I can reference other assemblies, for instance #using <System.Windows.Forms.dll> works fine, so I think the path is fine. Apart from that, wouldn't it always look in the windows path? I also tried editing the project properties, Common Properties -> Framework and Properties -> Add New Reference, but the only tab I see there is Projects, but no .NET tab. What the heck is going on? - Lutz
  • 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!