Jump to content

  • Log In with Google      Sign In   
  • Create Account

Representing interval set with values for pixel values

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1   Members   -  Reputation: 439


Posted 19 March 2012 - 12:59 PM

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

Posted Image

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, 19 March 2012 - 01:43 PM.

#2   Members   -  Reputation: 1819


Posted 19 March 2012 - 01:21 PM

What Are You Doing, Really™? 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.

#3   Members   -  Reputation: 439


Posted 19 March 2012 - 01:35 PM

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.

#4   Members   -  Reputation: 1304


Posted 19 March 2012 - 09:22 PM

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:

#5   Members   -  Reputation: 439


Posted 19 March 2012 - 11:05 PM


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:

Posted Image


#6   Members   -  Reputation: 1304


Posted 20 March 2012 - 12:15 AM

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.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.