Advertisement Jump to content
Sign in to follow this  

Representing interval set with values for pixel values

This topic is 2496 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Edit: Here's an image that visualizes what I'm trying to do here...


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! Edited by shurcool

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites
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:

Share this post

Link to post
Share on other sites

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:



Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!