Jump to content
  • Advertisement

powly k

  • Content Count

  • Joined

  • Last visited

Community Reputation

657 Good

About powly k

  • Rank
  1. Upload them only once just before rendering - though the driver will probably already do this for you behind the scenes.     The more important point you might want to consider is how you measure your performance. If you get >1000fps with those various effects, your scene is probably too small to test on. If your rendering is not the bottleneck, then your memory lanes are. So you could probably throw a way more complex scene at the program and it'd run at the same speed. Another point is that measuring with fps can be deluding - a drop from 1200fps to 170fps is not that massive, the render times went from 1ms to 6ms - you should maybe measure which parts take how much time, opengl has time query objects for this.
  2. For 1: the default context is a compatibility profile, it should let you mix up any and all OpenGL extensions and versions your graphics card supports. This often makes writing it less nice; I'd recommend to stick to either the core 3.3 or 4.3 profiles, depending on what hardware you have. That way you'll have way less driver dependent behaviour to debug.
  3. powly k

    Path tracing - Direct lighting

    This is all about the probability of each path. As with all monte carlo integration, you have to compensate the values of each sample with the probability of choosing that sample. The probability of hitting a point or directional light with a random chance is exactly 0; they're a single point on a continuous hemisphere. On the other hand, such lights act as dirac functionals; their contribution is only non-zero at a single point and infinitely large there. This, when integrating over the hemisphere, means that you can just pull them out of the integral and sum them with the approximation of the integral; the indirect lighting.   In a mathematic sense all surfaces and lights are equal (which makes sense, secondary or tertiary light sources are just as much light sources as primary ones) but when actually tracing the scene it makes sense to try to focus on the important stuff; this also leads to importance sampling of materials and multiple importance sampling of materials and lights together.   A lot of these approaches result in the exact same results - you can trace two bounces per incoming ray, for example, just keep track of your probabilities and you'll be fine as in the result will be unbiased. The vast majority of the ideas and research on the subject don't really focus on getting the result right, but reducing variance (which is visible as noise). With bidirectional path tracing using multiple importance sampling and materials that are importance sampled accurately, you can save a lot of rendering time (orders of magnitude) and get the same level of noise in your results.
  4. powly k

    Display Loop with Win32

    glFlush() is a signal to the driver that you want to have all the submitted rendering ready before you go on with the code. And you're correct, as far as I know the wait occurs on SwapBuffers() and there's nothing you can do about it - why precisely would you, though? The best you can do is probably to measure frame time and if your frames are consistently shorter than your desired frame rate, do some extra stuff. It would also kind of fight the nature of VSYNC to be able to control it - the display works on a specific rate, it cannot be altered by programs.
  5. powly k

    Some ideas for a tic tac toe

    There are languages that index arrays defined for N elements in [1...N] (matlab comes to mind) or even [0...N] (Blitz Basic).   There is a good reason for the typical choice of [0...N-1], but it goes somewhat deep. You need to remember that the end result of the code is meant to run on actual hardware. In this case you want to access memory, but memory itself doesn't know the concept of an "array". It knows what data it holds and what index it's at. The most important thing is that an array is actually some index to the memory, and more precisely it's the index of the first member of the array. To access this, there is the typical array[j] syntax, which pretty much means "give me the j:th element of array 'array' " which is the same as finding the bit of memory that's at array+j. Since array is an index in the global memory and j is the index inside that array, we can just sum them to find the location of j in the memory.   Now, it (hopefully) makes sense to choose that the first element of "array" is at memory address "array", not at "array+1", so the first element should be at array[0] instead of array[1], since it gets translated to an actual memory address. Why it ends at N-1 instead of N is because we still want to have N elements - and if we count from 0 and go forwards until we have N elements, we reach element N-1.   This is, of course, only a chosen convention but it implies other nice things, like for(int i = 0; i<N; i++) /*operate on array; */ instead of for(int i = 1; i<N+1; i++) /*operate on array*/; the length of the for loop can instantly be seen from the ending condition instead of having to remember to take one out - it's a simple thing, but would cause (I believe) even more headache, especially for beginners or less enthusiastic programmers.
  6. powly k

    Programming a "TV"

    Bump mapping is a lighting effect and completely unrelated. You just want to add some offsets to where you read your texture from in the GLSL shader - where you have something like texture(textureUniform, uv); try uv*=strength; texture(textureUniform, vec2(uv.x*sqrt(1.0-uv.y*uv.y*.5),uv.y*sqrt(1.0-uv.x*uv.x*.5))/strength); or some other similar mapping from square to disc instead.
  7. What? Last time I checked the red book was about what people did in the 90s.   http://www.opengl-tutorial.org/ should be a nice introduction to OpenGL if you already generally know what's going on but want to learn the API.
  8. powly k

    Is SSAO view dependent?

    The last few paragraphs of this post explain the reconstruction from Z buffer quite nicely, but go ahead and show a bit of your code if you're still having troubles. Your second picture looks just like a typical SSAO, so your problem is indeed most likely in the reconstruction.   The real problem here is that corners don't look like that. SSAO is a fakey trick and doesn't really resemble real world lighting too much. If you tone it down enough so it's not black noisy bars but a slight darkening at some places, it can be a nice artistic touch.
  9. Just do more draw calls then, that really is the simplest and very probably most efficient solution. Keep all the fully opaque stuff in one batch, though. You could reorder your objects otherwise (read their coordinates and texture atlas IDs from an attribute buffer or a lookup texture or something). There are tricks to do actual order independent transparency too, but they need relatively new hardware and/or are very computationally demanding.
  10. I would definitely try adding 0.5*PixelSize to your UV coordinates - sampling at texel edges tends to be problematic. I'd also play around with the size of hpix, at least halving and doubling are usually good candidates to fix sampling artifacts.
  11. Things faster than A* include, for example, summing two numbers, calculating a dot product or doing nothing at all. Most problems have many good solutions, and the best one must be picked by you depending on the specifics. And even better than a good solution is avoiding the problem altogether, which is also sometimes possible.
  12. powly k

    OpenGL won't render anything

    Winding is probably not it - if you don't specifically enable backface culling, it's not on. What I'd try is first negative z values for the vertices and then ditching the matrix multiplication to see if the matrix is really okay.
  13. powly k

    Poly Count for a Standalone game?

    What you do in your shaders tends to matter a lot more than how many triangles you rasterize. The only actual way to know these is, like you said, to test it yourself.
  14. powly k

    Motion Blur with FBO

    That very much seems to be the issue, if averaging 4 images that should be different doesn't produce a blurred result. Can you actually somehow verify that the 4 samplers have different textures attached?
  15. powly k

    Motion Blur with FBO

    Okay, since you can't actually read from an FBO but only use an FBO to render to a texture and then read that texture, here's the question: do you set up the active textures, bindings and uniforms correctly? How this should go is like this:   set active texture to N bind your texture[N] to GL_TEXTURE_2D glUniform1i(uniform N location, N)   N loops through 1...4, obviously. What this sounds like is you forgetting to call the gluniform1i - all the uniforms samplers are texture unit 0 unless you specify otherwise.   And please, do "uniform sampler2D Blur1, Blur2, Blur3, Blur4;" instead of what you do now. And to be extra sure, always set the alpha to something.
  • 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!