Aressera

Members
  • Content count

    444
  • Joined

  • Last visited

Community Reputation

2925 Excellent

About Aressera

  • Rank
    Member

Personal Information

  • Interests
    Art
  1. 3D Transparent Shader problem

    You can get face normals using the derivatives of the interpolated surface position: varying vec3 lerpPosition; // surface position, interpolated from vertex positions void main(void) { vec3 faceNormal = normalize( cross( dFdx( lerpPosition ), dFdy( lerpPosition ) )) }
  2. 3D Transparent Shader problem

    That trick to cull backfaces won't work in all cases with vertex normals because the interpolated normal isn't consistent with the planar geometry. I notice similar artifacts when using that trick for 2-sided lighting. You will need to use face normals, since these are consistent with the underlying geometry, or just tolerate the artifacts.
  3. Extracting face/hit data after a GJK step

    You can't really use GJK to get the contact info unless you combine it with some other approach such as EPA (expanding polytope algorithm), or add a margin around the objects. The problem is that GJK only determines if the objects are intersecting, but not the exterior points on each object. If you try to use the final simplex to generate contact info, you will find that objects tend to sink into each other over time. The simplex does not necessarily lie on the surface of the minkowski difference. In my engine, I use EPA to push the simplex boundary out to the edge of the minkowski difference. Then, the contacts can be determined from the nearest point on the minkowski difference to the origin in configuration space. EPA produces a convex hull made up of triangles and the contact lies on the closest triangle to the origin. Find the barycentric coordinates of the closest point on the triangle, then use those barycentric coordinates to find the point on each object (you need to store {pointOnA, pointOnB, pointOnB-pointOnA} for each convex hull vertex). This gives you 1 contact on each frame. You would then need to combine it with contact caching over multiple frames to get multiple contacts that are needed to achieve stable stacking.
  4. Why does GraphicsDevice need to know anything about Game? The game should be responsible for configuring the device. Any parameters, etc needed by the device should be passed into the device (e.g. pass GraphicsDeviceInfo* instead of Game* to init()). Try to think of your system design as a hierarchy/tree of complexity, with low level modules at the leaves and high level modules (e.g. Game) at the top. Each level in the tree should only know about its direct dependencies (its children). As for forward declarations, I use them as needed whenever you have circular dependencies, or when you want to hide the implementation (PIMPL idiom). Keeping includes in source files and forward declaring in headers can also reduce build times and public dependencies (e.g. I keep all <windows.h> includes in the source files to avoid polluting the global namespace).
  5. In the last few days I have noticed that whenever I visit a post topic the CPU usage suddenly goes up from 1%-5% to nearly 100%. In activity monitor the process is shown as "safari web content". This doesn't happen when viewing a forum or when creating a topic (e.g. right now it's fine), but as soon as I read a post, the insane CPU usage begins. As soon as I close the window, the CPU usage drops to normal. My system specs: Mac OS X 10.8.5, Safari 6.2.3
  6. C++ derived class template D:

    You need a typedef: class AComponent : PComponent<...> { public: typedef PComponent<...> Base; AComponent() : Base(...) {} };
  7. For any sort of acoustic source, I first try the Shure SM81. It has an extremely flat frequency response without the BS "enhanced" high end that most condenser mics have, hence its ubiquitous use for overheads/hi-hat, string instruments, etc. It will capture exactly what you are hearing without any kind of coloration. I'll use it over any high-dollar Neumann for this specific reason.
  8. 3D Shadow Shimmering When Moving Objects

    Maybe you could quantize the positions of objects to texels when rendering the shadow map (but only the shadow map)?
  9. Fifth Engine

    Maybe the Retro Encabulator can make some sense of this thread?
  10. Turns out I was right - you have to call OleSetClipboard() from the main event thread to get the correct behavior. Once I made that change everything worked fine.
  11. That's a good idea, I will try to see if it can pinpoint the problem.
  12. I understand that, but for right now I'm using the built in format (CF_UNICODE_TEXT). Could it be an issue with the thread I am calling OleSetClipboard from? I call the function from another thread than the main windows message pump thread. It seems unlikely though, since this problem doesn't cause my app to hang, only the external one.
  13. I am implementing copy/paste functionality within my editor and I have encountered a problem when implementing the feature on windows. I'm using the OLE API, and creating a custom IDataObject subclass to provide the data to the clipboard. For now I have been testing with just text data. My IDataObject and IEnumFORMATETC subclasses look like this: To copy some text onto the clipboard I use this: // global DataObject data; void copy() { OleSetClipboard( &data ); } This should copy the static text "Hello dude!" into the clipboard. I can then paste that text within my application without any issues by calling GetClipboardData(CF_UNICODETEXT). However, if I try to paste the copied text into another application (e.g. visual studio or wordpad), it causes that external application to freeze until my application quits. If I follow OleSetClipboard() by a call to OleFlushClipboard(), the string is rendered to the clipboard (GetData is called), and everything works as expected. However, I can't take this approach in general because it's wasteful if I render large objects (e.g. images, sounds) to the clipboard every single time, rather than deferring rendering those objects until another application requests a particular format. This seems to imply that some mutex/lock is not being properly released, but I can't seem to figure out where. Any leads?
  14. AI will lead to the death of capitalism?

    This recent well-researched article gives a good overview of the current state of affairs. Absent any significant human action (abandon fossil fuels immediately, stop eating meat, start injecting SO2 into the arctic stratosphere, CO2 removal, etc.) we're lemmings headed off the climate cliff. The timescale is uncertain, mostly because the climate is a complex chaotic system (e.g. butterfly effect), and the current modeling does not account for all variables and various self-reinforcing feedback effects. My guess (as an informed hobbyist) is that we'll start to see some significant negative effects on food and water supplies within the next decade (the Arab spring was a preview of things to come). Notably, the areas most heavilly affected by climate change drought are also the areas where most of our food is currently produced (california, the midwest). Drought alone could be enough to destabilize global civilization. Climate change warms the arctic much more than the rest of the globe, and therefore reduces the temperature gradient between the equator and poles, thereby reducing the speed of the jet stream and producing stationary weather (drought, flooding).
  15. DX12 SkyBox Depth Troubles

    I don't know the correct way to do it in DirectX, but in OpenGL I draw the skybox last with the depth range set to [1.0,1.0] instead of [0.0,1.0], with depth test less-than-or-equal. This way, all output fragments of the skybox are at the furthest depth value (the clear depth), and won't overdraw any foreground objects.