Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 02 Nov 2012
Offline Last Active Yesterday, 03:48 PM

Posts I've Made

In Topic: GLSL, Blending with Framebuffer Fragments via Shader?

21 October 2016 - 12:40 AM

"Programmable blending" is the magic keyword for what you want. It's available via extensions on some hardware but you won't be able to do it in the general case.


In portable code, it's common to render to an offscreen target (a render-to-texture), then sample from that texture to implement whatever fancy blending equation you need. In some cases this might involve 'ping-ponging' between two offscreen targets as you apply multiple layers of custom blended stuff.

In Topic: CPU + GPU rendering with OpenGL

15 October 2016 - 05:18 AM

Is there a memory trick that I can use in OpenGL to avoid stalling on sampling an uploaded texture? Right now I just upload the software rasterized result to an existing texture ID using glTexImage2D.


Maybe try triple buffering, so that you round-robin rotate between 3 different texture IDs on different frames. It's possible that the current usage is creating a sync point where the GPU has to wait for it to finish with the previous texture before it can upload the new contents.

In Topic: Billboard Particle Sorting

14 October 2016 - 12:12 AM

I doubt the quicksort is really a bottleneck, but if you want to try something out, then this is a perfect opportunity to implement a radix sort - it'll be faster. You don't even have the slight headache of negative float values to worry about (assuming you sort with distance along z, anything negative can be culled as out of view).

In Topic: texture still show line between vertices

13 October 2016 - 12:09 AM

The trick might be to stop using "points that sit in the same position" and start using indexed rendering so that there is a single shared vertex instead of a bunch of vertices that happen to be in the same spot. That said, it might be hard to do that for an entire huge mesh, e.g. if you have multiple height map textures.


Using vertices that sit in the same spot can work, but only if you're very careful to eliminate the possibility of floating point error. e.g. If your patches have different world matrices to one another, or they sample different height-map textures, or they calculate their UVs differently, then you're going to see artifacts like this.


Maybe if you post the whole vertex shader and provide detail about any differences in position calculations between patches, then that'd be useful.

In Topic: Billboard Particle Sorting

07 October 2016 - 02:28 PM

I'd have thought whichever one you align your particles perpendicular to. I'd imagine it's B.