• Content count

  • Joined

  • Last visited

  1. Billboard Particle Sorting

    As far as culling goes ... what I've got working is a simple sleeping mechanism Each emitter has a uint sleep counter, while processing the particle system I do a min max on all points to generate a AABB. The AABB is checked against the view frustum. If it's visible I reset the counter to zero... otherwise I increment. If the counter is above lets say 30 I just stop updating it and wait for the last bounding box to become visible again before resuming. This works well for environmental emitters (working on a waterfall at the moment) but other uses might need to time out destroy themselves.
  2. Billboard Particle Sorting

    Not sure what you mean about "occluded in screen space".... A rough outline of what I have right now. Solve particle system (does a lot but it's basically an ubershader-esque design of different functions to transform the particle data. sizeOverLife() colorOverLife() etc etc etc One of the most important things to get right here I feel is the "swap deletion" method of maintaining a contiguous list of particles in an array. Helps with allocation from a pool. Sort the particles. I do this with a key rather than sorting the actual particle data. I have a simpler struct that contains an {index,depth} pair and I qsort them.   I now have a list of active particles and their attributes. One thing to note is I solve this system at a fixed time step of 30 FPS. I also double buffer all attributes related to rendering (position, rotation, color, etc) this allows me to tween the particle for rendering at an fps higher than 30 and still get smooth consistent results.   Using the sorted key list I iterate over all the particles and build a vertex buffer (dynamic) to send to the GPU. I submit one vertex per particle that contains both frames of the double buffered data. This allows me to only update that GPU buffer at 30 FPS as well. ON GPU: vertex shader - to expand the packed particle data and tween it for the current delta time geometry shader - turn the one vertex into 4 verticies of a quad pixel shader - sample textures and output I also have a lighting system now built for the particles that decouples lighting from screen size much the same way as mentioned in the latest DOOM tech papers.  
  3. Billboard Particle Sorting

    Thanks for the replies. I looked through billboard code (I wrote it a few years ago) and I am aligning them to be (0,0,-1) in viewspace so I guess that answers my question. I will use the plane equation for sorting.   "Do you even need to sort them? Have you already tried just disabling depth-writing (but still depth-test), and see how it looks? Sure, it won't be accurate, but it might look good enough to satisfy you." In this case I do need to sort them because I am lighting and shadowing the particles. Thanks,  
  4. What is the proper way to sort billboard particles? A - Distance to eye (pythagoras) or B - Distance along cameras forward axis? (plane equation) Thanks,
  5. Hi there... If you have shaders up and running this should be relatively simple. I've written a quick example on shadertoy for you.   You can do something like that ... you'll probably want to run something like this as a fullscreen quad after you're done rendering your scene. And run the reverse logic of setting the pixel black if inside the radius and using the glsl discard instruction on anything outside the circle. Hope this helps!
  6. Particles in idTech 666

    I've been thinking about lighting our particles in this manner as well.  Anyone have idea on a fast way to: - Allocate a location for the quad in the atlas. I can easily see how this would be done on the CPU. But lets say you want to do it while rendering out the atlas itself. Ideas? - If you want to have a normal map for the particle you'd probably still have to render out something like the HL2 basis. They don't seem to do this ... it seem like the lighting resolution would be too low. Thoughts? Thanks!  
  7. Directional lighting trouble.

    Looks like you're putting the light's POSITION into your constant buffer CPU side. This is correct for a point light. But in the case of a directional light you just need a DIRECTION! (If you normalize the lights position as you're doing here you'll get a directional vector form the origin to the lights position as your directional light direction.)
  8. Directly access XMMATRIX ellements

    LHLaurini: 1) The OP is asking why he's getting an error trying to access "members _11 _21 _31" etc. I have correctly answered why this is occurring. You have not. 2) While I do assume OP is using Visual Studio as we are dealing with the DirectX Math library here the advice of "going to the definition" of XMMATRIX is sound and teaches the OP how to get to the root of the problem. 3) I have not recommended disabling SIMD. But it appears to be the only way to access elements NAMED _11 _21 _31 if you need to do so for learning purposes.   4) There are additional ways to access the individual components of the matrix including the one you pointed out.  
  9. Directly access XMMATRIX ellements

    Hi there, Seems like you need to get a little more familiar with C++ and your dev environment. I assume you're using Visual Studio... if so you can right click on any class name and select "goto definition" If you do that for XMMATRIX it will bring you to this bit of code    #ifdef _XM_NO_INTRINSICS_ union { XMVECTOR r[4]; struct { float _11, _12, _13, _14; float _21, _22, _23, _24; float _31, _32, _33, _34; float _41, _42, _43, _44; }; float m[4][4]; }; #else XMVECTOR r[4]; #endif As you can see ... if _XM_NO_INTRINSICS_ is defined you have access to "float _11, _12, _13, _14;" etc via the union. otherwise the data for the structure is defined as XMVECTOR r[4]; So the simple answer would be to define _XM_NO_INTRINSICS_ if you NEED access to those members for learning purposes. However I assume from the definition name that you will lose all SIMD optimizations! Good luck!  
  10. Temporally Smoothing SSAO ?

    Hi, I ran across this blog post today so I thought I'd link it here for you. It discusses temporal reprojection of SSAO.
  11. Just a quick semi answer whilst glancing over your question..... Here's the GDC presentation by Robert Cupisz And a link to his website he's reposted the slides and a video with some more info.  
  12. Verify my GGX + Lambert Directional light

    In conclusion I'm just doing what looks good.... I've combined various formulas for D, F and G from this Brian Karis page until I was happy with the look! Thanks!
  13. Verify my GGX + Lambert Directional light

    Thanks for the input so far everyone. I'm going to dive back into it here this morning and see if I can get some better results out of my specular. I still feel a scalar value to control the specular contribution would be helpful with my high sun light environments.  
  14. Verify my GGX + Lambert Directional light

    My sun is currently a yellowish white multiplied with a slider ..... I've got that slider pumped up to exp2(3.5) ..... so it's at ~11.31 That's where it starts to feel hot enough but not blow everything out to white. The specular is WAY overpowering though. Thank you! Edit: The roughness is about 0.75 on the ground!
  15. Verify my GGX + Lambert Directional light

    I guess you're right as I already want to scale the specular... in fact when I hardcode a constant of (0.25 * specular) I get quite a good looking result. Would this material param be a 3 component color or a simple single scaler? Thanks,