Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

2 Neutral

About ajweeks

  • Rank

Personal Information


  • Twitter
  • Github

Recent Profile Visitors

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

  1. If your normals are changing as your camera moves then your world positions must be in view space. Regardless, I don't think ddx(WorldPos), ddy(WorldPos) will rerturn a valid normal.
  2. I don't think it's possible to interleave indices like that, however you can save yourself some work still by programmatically interleaving the position and texture coordinate data. That might look something like this: struct Vertex { glm::vec3 pos; glm::vec2 uv; }; std::vector<Vertex> vertices; for(int i = 0; i < indices.size(); ++i) { vertices.emplace_back(positions[indices[i]], tex_coords[tex_indices[i]]); }
  3. The reason you're seeing artifacts is that you're attempting to calculate the normals based on what's called the "gradient" of the world position at the current pixel, which is a measure of how quickly it is changing from pixel to pixel. At the edges of objects, the gradient is very steep because the position changes abruptly across two pixels. So rather than calling ddx on the world position, I would sample the depth buffer two more times (like the examples you linked to do) with small offsets up and to the left for example, and calculate the normal from that.
  • 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!