Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actualshurcool

Posted 19 March 2012 - 01:43 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!

#3shurcool

Posted 19 March 2012 - 01:37 PM

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!

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

Posted Image

#2shurcool

Posted 19 March 2012 - 01:35 PM

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!

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

Posted Image

#1shurcool

Posted 19 March 2012 - 12:59 PM

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!

PARTNERS