Reputation
1,943
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
4 9
Newest
 Yearling
Impact
~44k people reached

  • 0 posts edited
  • 1 helpful flag
  • 80 votes cast
Apr
10
comment How should I structure VBOs for my 2d world data?
We are discussing the introduction, rather than simple position updates, of game entities, right? Instancing and vertex shader uniforms can be used to efficiently deal with simple updates.
Apr
10
answered How should I structure VBOs for my 2d world data?
Apr
10
comment OpenGL 2.1 vs Modern OpenGL
2.1 is considered by some modern. It's all in how you use it. The stuff that 3.2+ core requires you use instead of deprecated functionality is (mostly) available in 2.1 (with the exception of stuff like Vertex Array Objects, though they are probably available in extension form on a good many 2.1-based systems). If you steer clear of the stuff that core profiles do not allow, then you are using modern GL even in a version as old as 2.0 or 2.1.
Dec
8
comment GPU usage below 90% = poorly optimized game
GPU load% is a pretty useless metric. It does not tell you if the problem is a memory bottleneck or compute, or simply no problem exists at all and the workload is just not particularly demanding. Better to actually measure frametime consistency and ignore load%.
Sep
3
comment Why is shadow mapping the standard?
Doom 3 was years ahead of its time when development started (at least given the choice of graphics API). It had several backends to handle generations of hardware pre-Shader Model 2.0 and that meant about 1/4 of the engine is barely portable (it pre-dates even GLSL) and the remaining 3/4 are codepaths for ancient NV and ATI hardware extensions that were irrelevant by the time the game shipped. Its choice of stencil-shadow volumes were perhaps the least of its problems.
Sep
3
comment Write depth value to a render target
That's another thing that happens with floating-point depth vs. fixed-point. It can be desirable though, as weird as this sounds. If you reverse the depth range you can use that to your advantage in certain scenarios that need more even distribution of precision far away (e.g. reconstructing position from depth). Ordinarily you get more precision than you need up close and not enough far away. This is discussed at length here
Sep
2
comment Write depth value to a render target
As I recall, clip-space in D3D is -w <= xyz <= w just like OpenGL. After division by w, your depth for anything visible on screen is going to be in the range [-1, 1]. You still need to apply depth range or the math doesn't work, so that means multiply z by 2.0 and add 1.0. Your Z coordinate will then be in window-space (which is what the depth buffer stores). Otherwise, what is generally going to happen is that the negative half of your coordinate space is clamped to 0.0 (unless you are using a floating-point render target).
Aug
31
comment How do I prevent raycast car wheels sliding sideways?
Yeah, I didn't really think that was going to give you the answer you needed, but it was much too long to put in a comment ;)
Aug
30
comment SSAO, depth buffer linearization (?)
Given window-space depth (the depth you sampled from your depth texture) [0.0,1.0], linearizing it should be as simple as return n / (f - z * (f - n)) * f;
Aug
28
answered How do I prevent raycast car wheels sliding sideways?
Aug
25
comment How to wrap textures inside shader GLSL
Oh wow, I have never seen anything like that before. I really don't know what that is. That's not at all what I was discussing. There might be a floating-point error somewhere, you should try outputting the texture coordinates in your GLSL fragment shader to see if they behave sensibly (they should be a smooth red-green gradient). While you're at it, it might help if you added your vertex and fragment shaders to the question so I can see what you have tried.
Aug
25
comment How to wrap textures inside shader GLSL
Oh, really? Can you link to a screenshot illustrating your problem? Those artifacts almost certainly come from linear texture filtering, when you use linear filtering you have to be extremely careful with coordinates at the edges, especially if the texture is a spritesheet / atlas.
Aug
24
awarded  Yearling
Aug
24
comment How to wrap textures inside shader GLSL
fract (tex_coord.st) will do the same thing, this is not particularly useful knowledge but I thought you might like to know ;)
Aug
21
comment OpenGL strange lighting/model problem
Also, does your view matrix contain scaling? I think you may need to transform your normals a little bit differently, but I can't tell without your vertex shader code or how the view matrix is computed.
Aug
21
comment OpenGL strange lighting/model problem
Are you aware that VAOs track the currently bound IBO? Something funny may happen due to the order you unbind VAO and IBO. The VAO retains the IBO you bound several lines prior, then after you unbind the VAO you unbind an IBO from the global scope (not relative to any VAO). I doubt this is your problem, but you shouldn't be doing it in that order. Frankly because VAOs track IBO, you can probably get away with binding the IBO one time when you setup your vertex pointers and never touching that state again.
Aug
20
comment How to debug a DirectX crash on client machine?
Investigate the code around your swap-chain presentation. That's how those overlays work, they inject some code every time you swap buffers.
Aug
19
comment OpenGL: How to map point inside frustrum to normal device coordinates (NDC)?
The bottom row is necessary to flip the z-axis between view-space and clip-space. This is illustrated in the following diagram. See how Z points in a different direction pre- and post-projection? Everything else about that diagram is wrong though =P That's Direct3D's NDC and screen-space convention.
Aug
19
comment Strange SSAO effect (wrong position/normal textures in view space?)
That is all good, actually. The code completely takes care of this for you right now. The normals are stored in the range 0.0 - 1.0 in the texture, but rescaled to -1.0 - 1.0 after sampled; your position is also. However, the 1 - depth part looks odd to me. I think it should be depth - 1, otherwise your depth range is inverted.
Aug
19
comment Strange SSAO effect (wrong position/normal textures in view space?)
No, you can't store negative values in DXGI_FORMAT_R8G8B8A8_UNORM. You would need the SNORM version of that, or half of your vector space will be clamped to 0. I actually see now that this is taken care of already by multiplying by 2 and subtracting negative 1 in both the normal and position code. However, I strongly suggest that before outputting these colors to screen for visualization, you make a habit of doing * 0.5 + 0.5 (so you can see the negative parts of your coordinate space). As for 0.5 + 1.0 that would not work, your colors would go 0.5 to 1.5 (clamped to 1).