PDA

View Full Version : I desperately need help with animation in OpenGL!



anthonya
06-13-2005, 06:11 PM
I guys, I'm Anthony . I'm a student at the University of Guyana and I'm doing a final year project in OpenGL but I'm in trouble interms of getting the animation part. I'm constructing a model with has Corticospinal tracts. It's a model with spinal cord and the brain. I would like to get an effect that when you press a key for instance R, you get an animation going up .Like how the blood travels around the
body. You know, like a red color moving from the bottom of the spinal cord to the brain. I hope you guys understand. I don't know what exactly to use , can you guys please tell me what to use. well, I tried something with curves but I didn't get it. I'm using OpenGL with C programming. I would like you guys
to see the picture of the model but I don't how to put it here.Someone please tell me how to put up a picture. Anyhow ,looking forward to early replies........bye
Here is the link to the picture.

http://gmail.google.com/gmail?view=att&disp=inline&attid=0.1&th=1040fa0fb94ece91

uruk
06-13-2005, 08:03 PM
You can upload your image here (http://www.imageshack.us/) , then use the IMAGE button when posting a reply.
As for your problem, hmmmmm... I guess you could move a bright red cylinder over the blood vessel.
Like this:
http://img76.echo.cx/img76/8260/red6nj.jpg

anthonya
06-13-2005, 08:50 PM
Here is the picture of the model I want to create
http://img60.echo.cx/img60/6725/scan18he.jpg

dorbie
06-13-2005, 10:57 PM
You need to learn some basics of OpenGL.

I would suggest drawing the pathways to the stencil buffer and then stencil testing a textured polygon with scrolling texture coordinates that cover the paths. This assumes it's just a 2D image you're dealing with.

bansheeogl
06-14-2005, 10:34 AM
why stencil? you guys are retarded a little I think

you should simply modell everything, and when you want to feature the circulation of blood, illuminate the focused part (change its material attributes) and use a textured quad to emulate the red dot, so you can move it up by having some waypoints pre-defined.. you'll just interpolate them, move from one to the other. its not hard at all.. but stencil buffers? what else? fragmentation programs, per-pixel shaders and what else?? thats stupid, he just needs to show the path of blood in a model. not win a competition for no-life kiddies on wannabe programming with ogl...

Aeluned
06-14-2005, 11:11 AM
lol. Banshee, do you even have any idea what you're talking about? dorbie's suggestion is much simpler than your approach. The blood pathways are etched into the stencil buffer. Then a full screen quad with an animated texture is rendered using stencil test. and what do you end up with? that animated texture in only the areas that pass the stencil test (i.e. the pathways).

The entire thing can be done without even using comlex geometry at all.



its not hard at all.. but stencil buffers? what else? fragmentation programs, per-pixel shaders and what else??
just to amuse us all, why don't you give us a little pseudocode outlining your approach. I'm sure it'll give us all a good laugh.
FYI: It's 'fragment' program, which *is* a per-pixel shader, so you're being redundant.

anthonya
06-14-2005, 08:13 PM
Thanks guys for your ideas, may be if you guys show me some codes in C programming that will probably help me have a better understanding.Or if there are websites please tell me ..thanks again

dorbie
06-15-2005, 10:16 PM
@bansheeogl, "retarded"?!! I resemble that remark! "No life kiddies"?!! Hey! :-) Seriously dude, tone down the rhetoric, stencil buffer ain't that mysterious and is almost ubiquitous. I think nothing of using stencil, you should try it, and overcome your resistance to great features. The whole point of doing projects like this is to learn & apply graphics features.

@Aeluned, exactly! Although I got to thinking that if you draw to the stencil buffer you could just texgen on that same geometry and eliminate the need for stencil buffer, an animated texgen in eye space could be cool for this (and no bansheeogl, texgen is not a scarey monster ether ;-)).

@anthonya, you'll have to write your own code :-), this isn't that difficult. You've been given an answer or two, please don't repost/crosspost in the advanced forum. You will not get code there either. Make an attempt and ask specific questions either about the solution suggested or about additional implementation problems you have. If people see you make an effort they will help you understand & solve your problem with more enthusiasm.

Good Luck.