Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Entheogen
Aug 30, 2004

by Fragmaster
I am trying to do some volume rendering using OpenGL and Java.

here are some preliminary results (there are 6 million triangles in each):





The frame rate is not that great. I use display lists right now. The volume data itself doesn't change. If anyone can suggest a better method, please do.

Adbot
ADBOT LOVES YOU

Entheogen
Aug 30, 2004

by Fragmaster

SuperFurryAnimal posted:

I've been developing techniques for the realtime procedural animation of assorted creatures for my Ph.D. The idea is that all animation is driven by the creature's embodiment in the environment, taking a lot of inspiration from AI, robotics and ethology.

Most of the work has concentrated on Spiders, although I'm currently extending the simulation to cover creatures of similar morphology (body close to ground, legs in parallel), such as insects and lizards.

This is really cool. Any chance of you publishing your thesis here after you are done?

Entheogen
Aug 30, 2004

by Fragmaster

Adhemar posted:

It's volume rendering but you're rendering millions of triangles? Do explain.

cheap trick, since i didn't want to do ray casting algorithms or volume finding ones. I just draw cubes that connect each data point with its neighbors, and then use GL_SMOOTH to interpolate between vertices on same triangle. What i do exactly, is draw a triangle fan for each point that covers 3 faces of a cube.

It actually worked out pretty well for rendering actual data i was given by my boss so far. What i am working on next is making a function that takes data point and produces new alpha point in vertex shader. So far I have implemented a simple linear one and Gaussian distribution one.

quote:

Vertex Buffer Objects (VBO's) are what you want. WAY better than display lists.

I thought about that, but i fail to see how it would be faster than display list? Both are on video card and as far as i understand VBOs are like vertex arrays but they reside on actual video memory instead of normal RAM. I don't really need to change any visual information on a fly. Would they really be faster for rendering static stuff, than display lists?

Entheogen
Aug 30, 2004

by Fragmaster

Thug Bonnet posted:

Yeah, depending on the card they can be significantly faster. I'm not sure what you're writing in but I have a bunch of VBO C code I can give you if you're interested.

I do not understand. Display list is compiled list of commands, VBOs on the other hand still have to be rendered using some primitive? How could it be faster?

I am using Java, but it is pretty close to the way OpenGL is used in C, so your example code could be very useful for me.

Entheogen
Aug 30, 2004

by Fragmaster

Screeb posted:

Read this: http://www.spec.org/gwpg/gpc.static/vbo_whitepaper.html

However, after looking at your screenshots again, I see that you get much better FPS when further away from the volume - i.e. when it only takes up a portion of the screen. That means that the bottleneck is actually the fillrate, which makes sense given you're rendering millions of semi-transparent triangles. In that case, I don't know what to suggest to be honest.

What kind of performance do you get rendering it as a point cloud instead?

It is much higher, but the visual quality is much suckier, because there are a lot of empty spaces between points that don't get filled. Thanks for the link!

quote:

My understanding is that volume ray casting is considered to be the way to go these days. Still, even if you decided to do it the "easy" way, why not just use view oriented quads that slice through the volume rather than millions of triangles?

You mean i can sort of calculate the "voxels" i need to display to approximate "real" view then render it using quads?

I have seen some real time ray-casting demos and the performance didn't seem that much higher than what I have right now. Also ray-casting is usually for rendering solids and semi-transperent layers that cover them, as far as I understand. With this project its more that I need to look "inside" the volume at all levels and be able to isolate different features inside.

The linear and gaussian function in vertex shader has worked fine to that end so far.

I believe I can use VBO or at least vertex arrays to cut on the amount of data I am sending to the video card because right now it is 6 times bigger than it needs to be. Perhaps the frame rate will improve as well when I do not repeat glVeretx needlessly.

Entheogen fucked around with this message at 13:25 on Jun 30, 2008

Entheogen
Aug 30, 2004

by Fragmaster
http://giga2.cs.ohiou.edu/~neiman/anim1.gif

Same program as I posted the SN's of above, but this time I am walking through the data set using gaussian distribution function done in vertex shader.

Entheogen
Aug 30, 2004

by Fragmaster

Thug Bonnet posted:

I'm pretty sure the display lists are stored outside the GPU's memory whereas VBOs/PBOs are stored in GPU memory. Another nice thing about VBOs/PBOs is that you can read from and re-write to them whenever you'd like (incurring while a performance hit of course).

PM me and I'll send the code (there's more than I should probably dump in the thread)

i dont have platinum. you can email me though. green.entheogen@gmail.com thanks in advance.

Entheogen
Aug 30, 2004

by Fragmaster
I followed your guy's advise and used VBO's. While I do not notice any rendering speed improvement, it did allow me to render more than with display lists, because i kept getting GL_OUT_OF_MEMORY exception with display lists when trying to render same amount of information with display list.

Here is a picture of some data set with linear vertex shader function:


and here is same data, same camera angle but with gaussian function:


It was surprisingly easy to get VBO's to work with Java OpenGL. I just made a version with vertex arrays first, made sure it worked and then made a couple of extra gl calls to put arrays into GPU memory.

Entheogen
Aug 30, 2004

by Fragmaster
Here is an animation of a walk through some actual data my boss gave me: http://giga2.cs.ohiou.edu/~neiman/wave.swf It is sort of low-res, but I will make a much nicer one soon.
EDIT: here it is: http://giga2.cs.ohiou.edu/~neiman/hi-def_wave.gif

He said it is solution to some partial differentiation equation that describes release of calcium or sodium in the cell. I am not quite sure what it actually is.

The data is visualized correctly. To generate the other screenshots, i just took an empty volume, filled it with random sized and random colored spheres, then did a few passes of averaging algorithm, that just takes each point and averages it together with neighbor. Then all of that is compiled into a VBO and what is rendered subsequently.

This is the source for gaussian filter implemented in vertex shader
code:
uniform float scale_factor; 
uniform float gauss_a; 
uniform float gauss_b; 
uniform float gauss_c; 
varying vec4 colorz; 
void main( void ) 
{ 
    gl_FrontColor = gl_Color;
    float e = 2.71828;
    float x = gl_FrontColor.w;
    float exponent = x - gauss_b; 
    exponent *= exponent;
    exponent /= -2 * ( gauss_c * gauss_c );
    gl_FrontColor.w = scale_factor * gauss_a * exp( exponent );
    colorz = gl_FrontColor; 
    gl_Position = ftransform();
}
I came up with this technique on my own, but it is pretty basic. The tricky part was getting it to run fast enough.

Entheogen fucked around with this message at 02:12 on Jul 5, 2008

Entheogen
Aug 30, 2004

by Fragmaster

Nomikos posted:

Ooh, walking spiders. I made a halfassed attempt at making exactly what you're working on, during senior year in high school. Except instead of actually thinking about ethology and balance and important things like that, I made an enormous blob of a neural network and hoped that reinforcement learning would solve all my problems :downs:.

In the end all my spiders succeeded in doing was curling up their limbs underneath them in a sad attempt to satisfy the minimum-height term of the reward calculations. I'd post a screenshot if it wasn't ugly and embarrassing compared to yours.

I'd love to hear more details about the algorithms you used :)

me too. is your dissertation publicly available?

Entheogen
Aug 30, 2004

by Fragmaster

monsterland posted:

cool poo poo

hey that's pretty cool man. how long did it take you to assemble all the sprites and put them in game like that?

Entheogen
Aug 30, 2004

by Fragmaster
I implemented marching cubes algorithm to generate iso surfaces for the data I am visualizing. Here is one screen shot



and there is more here: http://giga2.cs.ohiou.edu/~neiman/sn/iso_surface/iso_surface.htm

Entheogen fucked around with this message at 02:41 on Aug 11, 2008

Adbot
ADBOT LOVES YOU

Entheogen
Aug 30, 2004

by Fragmaster

Dr. Stupid posted:

Are you visualizing Autechre tracks?

What is that? I am visualizing the data that my boss has given me, which is a solution to some wave equation describing how cell releases some chemical from one of it's organelles, or something of this nature. It is same stuff that I have posted pics of on previous pages.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply