Representing interval set with values for pixel values

Started by
4 comments, last by Digitalfragment 12 years, 1 month ago
Edit: Here's an image that visualizes what I'm trying to do here...

imagecpm.png

If you need to store some regular values (like R/G/B intensities) for your pixels, it's quite easy. Just use a colour framebuffer.

vec3 ThisPixel = (value0, value1, value2); // Easy

Now, I want to store an interval set with values for my pixels. How can I do something like that?

The process of storing an interval set in memory is tricky to begin with. Because there could be a various number of intervals in the set.

// Here's how you can do it in RAM

struct IntervalWithValue
{
float IntervalStart;
float IntervalEnd;
vec3 IntervalValue;
}

std::vector<IntervalWithValue> IntervalSet;

IntervalSet.push_back(IntervalWithValue(0.1, 0.3, vec3(255, 0, 0)));
IntervalSet.push_back(IntervalWithValue(0.5, 1.0, vec3(0, 255, 0)));

auto ThisPixel = IntervalSet;


I know it's probably really confusing what I want...

Let me explain it this way. Right now, it's easy to store and manipulate colour values in a colour framebuffer for each pixel.

But what if I want to store and later manipulate interval set with value (as defined in code above) for my pixel values? How can I store that in some sort of framebuffer on the GPU?

One of my thoughts was... if I know my interval sets will contain no more than 4 intervals, then perhaps I could use 4 framebuffers (or 4 textures, whatever). And define some sort of notation, like:

framebuffer(Number).r = IntervalSet[Number].IntervalStart;
framebuffer(Number).g = IntervalSet[Number].IntervalEnd;
framebuffer(Number).b = IntervalSet[Number].IntervalValue;


Any other ideas? Thank you!
Advertisement
What Are You Doing, Really(tm)? GPUs are in general not very well-suited to variable-length data like that. Bad for concurrency.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
I was afraid of that, but I thought it'd be worth asking anyway.

I've made an image to demonstrate what I want; added it to original post.

What I'm doing... is an experimental way of rendering non-standard images. Sure, I can go into details, but atm I want to see if this abstract graphics problem generates any interesting discussion/ideas on its own.
Its a shame this is marked as OpenGL, because its quite easy to do in DirectX11 (albiet you wouldnt be writing to a framebuffer, but a UAV). Check out the "Linked List OIT" examples.

Actually, a quick google search returned this which is OpenGL:
http://blog.icare3d.org/2010/07/opengl-40-abuffer-v20-linked-lists-of.html
Amazing!

Thanks for that info Digitalfragment, it looks very relevant and promising; I'm gonna look more into its details soon. I assume you were referring to this in the DirectX 11 world.

To those curious what I need this for, it's to extend my Non-Zero Exposure Time (i.e. Motion Blur) Rendering technique/demo. Right now, it does simple single-colour shaded non-overlapping triangles with a regular framebuffer, but if I wanna do overlapping geometry properly, I need something akin to Order-Independent Transparency. They've even mentioned Motion Blur as one of their potential future works, hehe.

You can see a WebGL version of my current Motion Blur demo here:

Motion%20Blur%20Demo.png

http://www.cse.yorku...onBlurTest.html
Yeah, thats the demo I was referring to - it's a pretty awesome lead in to the things that can now be done with gpgpu.

I can see the use for it in motion blurring. Another use for it is resolving subpixel triangles without aliasing.

This topic is closed to new replies.

Advertisement