Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

491 Neutral

About hupsilardee

  • Rank

Personal Information

  • Interests
  1. hupsilardee

    Advanced Terrain Texture Splatting

    Thanks Andrey, this technique is beyond fantastic!
  2. Hi all. I've been using item templates with a custom build tool and it's working fine. However, the item template only gets applied if I select "Create New Item". Ideally I want to be able to use "Add Existing Item", and customise the object type rather than using custom build tool and manually setting the properties. Is there a way to do this with VC++ 2012 Express? (I might upgrade to 2013 if required)
  3. Thanks for the alternative! Your method actually looks faster. (While we're here, would anyone mind reassuring me that this HLSL code to calculate the normal from the heightfield is actually correct?)   float hxm = Heightmap.Load(int3(iPos.x-1, iPos.y, 0)).r; float hxp = Heightmap.Load(int3(iPos.x+1, iPos.y, 0)).r; float hzm = Heightmap.Load(int3(iPos.x, iPos.y-1, 0)).r; float hzp = Heightmap.Load(int3(iPos.x, iPos.y+1, 0)).r; float h = Heightmap.Load(int3(iPos.x, iPos.y, 0)).r; float3 t1 = float3(2, hxp - hxm, 0); float3 t2 = float3(0, hzp - hzm, 2);      float3 n = cross(t2, t1);
  4. (solved)   Hi all, I'm working on normal mapping for my terrain. My terrain system calculates a normal map on the fly when a heightmap is loaded (or generated), which means I can use per-pixel normals. This makes distant terrain look a lot nicer. However, I am wondering if there is a clever way to calculate the tangent space for normal mapping, given some extra information   1. You are given the normal for a pixel, and this is already normalized 2. The first tangent is guaranteed to have X component = 0, because it's just a straightforward texture-splattedgrid geometry 3. Similarly, the second tangent has Z component = 0 4. Tangent space should be orthonormal   How can I fill in the unknowns in the most performance-friendly way possible?   Normal: (nx, ny, nz) Tangent: (0, ?, ?) Bitangent (?, ?, 0)   EDIT: Solved it. // tangent known to be perpendicular to normal dot(n, t) = 0 nx*tx + ny*ty + nz*tz = 0   // x component is 0 ny*ty + nz*tz = 0   // length of tangent is 1 ty*ty + tz*tz = 1   Now I have 2 equations for 2 unknowns which gives the z component as solution to a quadratic, where I'll take the positive answer! and I can work out the bitangent similarly, or use a cross product
  5. I've been looking through the DXGI_FORMAT so I can familiarise myself with everything D3D11 has to offer. Now I have a few questions about some of the formats I didn't understand...   1. What the hell does XR_BIAS mean? There was a wealth of Google results, none of which I could even begin to understand. Could someone explain this in small words?   2. Why are there no formats with 16 or 8 bits per channel (BPC) and 3 channels? Eg, R32G32B32_FLOAT exists but R16G16B16 does not. Seems like they'd be very useful for G-buffer organisation alone.   3. Why do some formats have 2 identical components? Eg R8G8_B8G8?   4. Some formats have a lot of wasted space marked as X - what's the point of this?   I think I know the answer to question 4 though. The X32 or X24 formats accompany the depth formats, so you can create a Texture2D with the R24G8_TYPELESS format, then create a DSV for it with D24UNORM_S8UINT to use as a depth buffer, and a SRV with R24UNORM_X8_TYPELESS to read the depth back in another shader (eg SSAO shader), am I right? 
  6. float2 vec; sincos(radians(angle), vec.y, vec.x);   :D
  7. hupsilardee

    Distance field font artifacts

    Off topic tip: Instead of an alpha threshold, you could try a steep gradient outside the threshold, which will give nice antialiasing :)
  8. Hi all. I'm very happy with the way Visual C++ 2012 Express can auto-compile your shaders at build time to save loading time, so I'm looking at doing the same with other game assets. At the moment I'm making a custom build tool for sprite fonts, using the DirectXTK MakeSpriteFont command line. I got the custom build tool working for one file, with the Custom Build Tool property page looking like this:   Command Line:    "$(OutDir)FontTool.exe" "%(Filename)%(Extension)" Description:          FontTool is compiling a font... Outputs:               $(OutDir)\$(Filename).csf Additional Dependencies: Link Objects Treat Output as Content   FontTool is a quick command tool I whipped up in a separate project that reads the font attributes from a lua script in the text file and calls MakeSpriteFont based on those.   The problem is, when I tried to make an item template out of this file, new files made with the template don't have the custom build tool specified, they have reverted to "Doesn't participate in build". How can I include the same custom build in the item template?
  9. hupsilardee

    MSAA in WinRT

    You could try a post-process AA, but it might damage performance. There are many options out there because lots of research went into it after deferred rendering became popular a few years ago
  10. hupsilardee

    Reflection/refraction map edges

    I don't understand, why can't you clamp or saturate() the texture coordinates?
  11. I suggest you use the SimpleMath library that's part of the DirectXTK. It's a wrapper above DirectXMath, that provides Matrix, Vector2, Vector3, Vector4, Quaternion etc types, that make it much easier to write expressions intuitively.   The downside is a slight performance hit due to the way some data has to be unloaded and reloaded more times than necessary into the CPU registers, but it's extremely fast nonetheless.   My bottleneck is and will always be the scripting engine rather than the CPU math anyway :)
  12. hupsilardee

    Compute project triangle's area

    Replace "linear" with "affine" in that sentence, and then it makes sense.   Oops. An affine transform is a linear transform followed by a translation.
  13. hupsilardee

    Compute project triangle's area

      Slightly incorrect. If you take the cross product of two points as position vectors, the magnitude of the resulting vector will be equal to the area of the triangle formed from the two points and the origin, which you don't want.   To calculate the area of the triangle formed by the points A, B and C, calculate the normal to the triangle by n = (B - A) x (C -A). The area is the length of that normal.   Pointless but interesting extra maths fact: if A, B, C are transformed by a linear transformation represented by matrix M, the area will be multiplied by the determinant of M. (Note projection matrix is NOT a linear transform ;))
  14. hupsilardee

    Enhancing graphics

    Download Blender and fix your gun. Ewww...   Reduce the graininess with mip-mapping and linear filtering A bit more colour variation in the textures would look great. I think the normal scale has turned out alright in this case, whether that's by luck or coincidence. You could do with a little ambient light - a light in that enclosed space wouldn't leave the away-facing parts of the wall pitch black.
  15. Grow/shrink the circle using 1D perlin noise? Make the radius a function of the angle, something like this:   // PerlinNoise1D(x) returns a value in [0, 1]   radius = radius * (PerlinNoise1D(angle) + 0.5);
  • 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!