Jump to content
  • Advertisement

Aressera

Member
  • Content Count

    458
  • Joined

  • Last visited

  • Days Won

    1

Aressera last won the day on September 10

Aressera had the most liked content!

Community Reputation

2936 Excellent

2 Followers

About Aressera

  • Rank
    Member

Personal Information

  • Role
    Audio Engineer
  • Interests
    Audio
    Programming

Recent Profile Visitors

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

  1. Aressera

    Wrap macOS window using .Net Core 3.0

    It's not easy, take a look at how SDL works. The difficulty is that MacOS hides the main thread event loop in [NSApplication run], so it is pretty intrusive in your design. In my C++ wrapper, main() calls [NSApplication run], which blocks for the entire lifetime of the program, then gets a callback [applicationDidFinishLaunching], where I spawn a second thread which functions as the main thread of my engine, while the first thread handles event processing. You must also be very careful about what threads you are using. Most Cocoa windows/views require to be used from the main thread only, other threads must use [performSelectorOnMainThread] to run window/view methods on the main thread. I would use this approach: write a wrapper similar to SDL with a C interface, then pinvoke that library from your managed language. Good luck, this is not an easy task and can take a long time to get it working correctly (my wrapper is 12 years old and still has some problems). You're probably better off finding an existing library that does this for you.
  2. What you want is known as "importance sampling". A simple way to implement it is to interpret the densities as probabilities in the range [0,1]. Then, until your grass budget (e.g. number of instances) is met, pick a random 2D point on the surface. Generate an additional random number in the range [0,1], if that number is less than the density at that point, keep the point as a grass instance. Otherwise, discard that point and generate a new one.
  3. The order in which the euler angle rotations are composed is not consistent with your expectations of camera behavior. You would need to build the quaternions for each of the 3 euler angle rotations individually, then multiply them in the correct order for your axes/euler conventions. Usually you would use R=(Yaw)*(Pitch)*(Roll) for a first-person camera, where R*x rotates x from camera space to world space. If you always want the camera to have a consistent orientation, you can also fix the up vector to always point up by first forming the R matrix, then replacing the up column vector (usually either Y or Z) with (0,1,0), then orthonormalizing the matrix.
  4. You could also add some additional damping to your suspension to avoid the instability, if that works for your application.
  5. Aressera

    Updating Bounding Volume Hierarchy Leaves

    Usually this is handled by a 2-level BVH, where each lower level BVH have transformations associated. One BVH for the objects in the scene that is dynamic, and a second static one for each mesh that is nested within the scene BVH. When traversing the scene, you only transform what is necessary. For the case of ray casting, you would just transform the ray into the mesh's local BVH space, and then undo the transform for hit information (normals) when the information is returned. For mesh vs. mesh collision, it might not be so easy. In that case you would probably have to transform the node AABBs of one BVH on the fly during traversal into the other BVH's local space.
  6. A few tips: Avoid using shared_ptr or unique_ptr in interfaces because they force the user to wrap their objects in smart pointers to use your interface. Smart pointers in interfaces have a tendency to spread to other parts of your code like a disease. shared_ptr obfuscates object ownership and result in poorly designed systems that don't consider object lifetimes in their design. shared_ptr also has some overhead for copying (e.g. when you pass it by value in your function). Use shared_ptr only when the object is actually shared between multiple systems and has unknown lifetime. This should be a small minority of the objects in your program. If not, you need a redesign. Use unique_ptr for internal allocations (but not in interfaces). Everywhere else, use references (if arguments cannot be null), or raw pointers (if arguments can be null). Prefer passing shared_ptr by const reference rather than by value. Every time you copy shared_ptr it flushes the memory pipeline due to its atomic reference count, which takes about 100 cycles.
  7. What is going on is that XAudio (and WASAPI shared mode) has built-in dynamic range limiting. It is applying a dynamic range limiter/compressor to your audio to avoid the distortion that comes with clipping float data to [-1,1], by reducing the gain of the signal in a level-dependent way. When the signal level approaches -1 or 1, the limiter must reduce the signal gain in anticipation of clipping (this is the compression knee) to produce a smoother gain reduction. This causes loud transients such as your explosion sound to be softened or to lose impact/attack.
  8. Aressera

    Enemy Variants, Palette Swap in Photoshop for Pixel Art

    Couldn't you just use an indexed color image and replace the colors in the color map (assuming 256 colors is ok)? Seems like a better way because you could keep your layers intact.
  9. Aressera

    Performance testing with bit operations, SSE2 and asm

    You realize that aligned malloc is usually just a wrapper around regular malloc that enforces the alignment? and that malloc is a kernel call that requires context switch, acquiring a lock, and various data structure manipulation? You're doing like 1000x the work in that one call than the rest of the function. You should never return memory like that from a function, it'd bad form and requires the caller to free it (and know to use aligned free).    Slightly better code below, but the whole idea of this function is flawed in the first place. typedef union Float4 { __m128 v; float x[4]; }; inline float _sse2_min(float a, float b) { __m128 _a = _mm_set_ps1(a); __m128 _b = _mm_set_ps1(b); Float4 c; c.v = _mm_min_ps(_a,_b); return c.x[0]; } Generally, SIMD code is only an advantage when you layout your data in a vector-friendly format (structures of arrays), then you can directly load/store_ps and operate on multiple values at once and get close to 4x speedup.
  10. Aressera

    How about UNICODE and UTF-8

    I used UTF-8 in my engine/GUI and it works great. I don't really find myself needing to have random-access to characters, and instead use an iterator class to iterate over the characters in a string (returning 32-bit characters).
  11. Aressera

    more fixed-block audio...

    Sounds pretty good, based on the bitrates you posted earlier. It would be interesting to hear a recording of something sonically detailed with more varied dynamic range like a voice, acoustic instrument, or live orchestra.
  12. Aressera

    fixed block audio codec...

    How does this compare in quality/compression to A-law and mu-law encodings?
  13. Aressera

    Pipeline State Monitoring

    interesting read!
  14. Aressera

    Refactoring makes my brain hurt.

    I know your pain, I'm 3/4 of the way through the front end of the compiler for my scripting language Mir (similar to C#) and things can get pretty unmanageable if you don't have a clear design in mind. My parser alone is over 3000 lines of code. What kind of syntax are you using for generics? The <> style has proven to be hell to parse correctly in expressions because in my case it makes the grammar context sensitive. I ended up having to defer expression parsing until the contextual analysis phase. The parser just determines the set of tokens that correspond to each place an expression should be and passes those on to the next phase. The contextual analyzer then checks each identifier as it parses to see if it is declared as a template and then if so parses the '<' as the start of a template instantiation, rather than a less-than expression.
  15. Aressera

    Playing lego

    check out this guy's work: [url="http://graphics.stanford.edu/~pmerrell/"]http://graphics.stanford.edu/~pmerrell/[/url]
  • 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!