aAVis
Processing Based Visualsation Tool
Navigate/Search

Archive for October, 2007

Motion Blur and Accumulation Buffer.

Monday, October 29th, 2007

I spent the day today doing two things :
1) I spent the morning trying to get motionblur working.  Trying to use multiple textures to simulate a blurring effect ( Basically using lots of drawtotextures ).
2) Went to uni to check the room in which aAVis will be presented.

After heading into uni and spending 3 hours there trying to get it to work on the uni computers, I found that the machines there just don’t work well with the way I’ve got it set up ( As it’s been designed on my machine, it tends to freak out on others - plus I hadn’t tested it on modern radeon video cards yet, which seem to be what the macs at uni are running ).

So I’ve decided to just go with the best possible option I *know* will work, and that’s me bringing in my home computer.  It’s heavy, but it will work!

While relaxing and playing some TF2 tonight ( and admiring their amazing motionblur they’ve added to that game ), I realised … “Well, if I’m bringing my home machine, I know *exactly* the kind of system I’ll be running it on”.  And then it hit me, I can use the Accumulation Buffer!
I ditched the idea in the early stages, because my laptop does not support it, and originally - that was my presentation machine.  However, it works perfecly on my desktop computer and provides brilliant motionblur!

And the best thing is ?
It’s only about 6 lines of code.
How about that eh ?

Changes before the Expo

Monday, October 29th, 2007

The end of year exhibition is coming up, and even though I’m not being marked on aAVis at it ( I’ve already been assessed, marks yet to be delivered ), I’ve got a few things I’d like to change so it’s more impressive for the people moving through.

I sat down today and re-wrote the ‘frame saving’ code for the “party mode” I’ve introduced. I was using processings in-built ’saveFrame()’ function to save a .jpg of the current scene, then using this - it loads that frame as a texture onto a 800×600 ( stage size ) QUAD, and fades that quad out. Quite simple really - but very effective. The only problem is, that processing takes a bit to process ( haha ) this ’save frame’. So I’ve re-coded it in opengl. The save frame takes absolutely no time whatsoever anymore, the only pause is the loading of the new preset, which at the moment is unavoidable.

I also sat down and attempted to build a really nice motionblur out of a similar technique, but I’m having problems with it, and there’s a big storm outside so I need to turn the desktop off. So no more of that tonight.

EDIT - On another note, I’m glad wordpress saves posts as drafts while you work through them! As I was typing, that “big storm” blew the power in my house.  Fortunately nothing was damaged and my computers are still functioning perfectly! ( yay ! ).

The Future.

Thursday, October 25th, 2007

So, Post Presentation Roundup.

Before the presentation, I managed to modify the cube and osciloscope elements so that they too were able to be edited by entering in mathematical formulae ( yay ).  I decided that for my presentation it would be best to focus on what makes aAVis stand out from the other visuals tools out there which is this customisability. You can take one thing, and turn it into a host of other things.  Yay.

Obviously it’s still at the early stages, hence why I’ve decided to call this a prototype.  Future versions would obviously be more complicated.

It’s been a crazy last few weeks.  Don’t really have the time to sit down and write out a detailed post.  Interesting bit of news though, that small video I posted the other day caught the attention of a VJ, he wants to use it this weekend at a show! hah, obviously doesn’t know how unstable it is ;).  Still though, Cool.

 - Anthony

Post Presentation

Wednesday, October 24th, 2007

I’ll be writing a post-presentation blog entry a little later on.

For now, enjoy this :

Two Days til Marking…

Saturday, October 20th, 2007

So I’ve got two days left ( well, one night, and a day ) until I have to present aAVis to my lecturers. I’ve done the best I can given the data that I’ve lost from my laptop crash, and I’ll just have to hope it’s enough! I’ve decided this is more of a prototype / proof of concept rather than a finished product ( Although, it is fully-functional, albiet with a few bugs ). Each element that you can add offers a different example of data and how it can be added / displayed.

The biggest addition since my last post is my evaluator.

In flash, it’s possible to parse a string as a mathematical function. So for example, say you’ve got the following setup :

var myFunction:String = "2+2";'
var theAnswer:int;

You can use eval() to evaluate the string “2+2″, and print out the value 4. However Java ( and therefore, processing ) does not have this functionality. So I’ve had to code one myself. My evaluator understands simple functions ( +/-* ), random(value), and low / medium / high FFT values. I will prolly add Sin, Cos and Tan for movement functions tommorrow.

Why am I adding these ? Simple, so the user can enter in functions as the properties of an object. They can specify the size of a particle be ‘random(200)’. This gives the user a lot more control, as I will be showing during my presentation, when I use my ‘particles’ in various ways to produce a different effect each time.

I still have a lot of work to get done, so no sleep for me. I just hope it’s enough for my lecturers.
After this, I’ve got a week and a half to tidy it up for the presentation.

Boy was this assignment a handful!

- Anthony

Lost Data

Thursday, October 18th, 2007

Soooo

Quick update.  My Laptop died, and I lost about 3/4 days of work.  Boo to that.  Fortunately I had a backup on my desktop computer, but I’m still annoyed.  I’m now behind schedule for my due-date.  Sigh.

Doing my best to catch up.

    - Anthony

Wednesday Night Progress Update

Thursday, October 4th, 2007

Current Lines of Code : 1049
[Not Including Particle/Motion Blur System which is aprox : 323 lines]
Days til Pre-Crit : 4

Oh our presentation is getting VERY close. We’ve got a Pre-Critique on Monday, then the final presentation a week after that. Am I ready to present ? far from it. I’ve still got a fair amount to do, but I should manage to get it all done ( I hope ).

This is my plan for the next few days :

WED : Audio
THURS : Audio + Integration
FRI : Movement
SAT : Adding Elements
SUN : Adding Elements
FINAL WEEK : Adding more Elements and Graphic Effects, Tweaking Audio Integration

I’m actually ahead of this schedule. I’ve finished the audio, and integrated it into the whole project. It’s not that sophisticated, and the beat detection is still off, but it will do what it is told, which is what’s important. This means I can push EVERYTHING forward, and focus on Adding Elements and Movement. What are elements you ask ? Elements are things that can be displayed. Currently they are a Sphere, and a Cube. But they will include a particle array, stereogram, and whatever else I feel like coding and adding. As the framework GUI is complete, it’s relatively easy to add new elements as they should slot right in to the existing framework! ( Hopefully! hah ! )

What can go wrong from here ? *EVERYTHING*.  But I’ve dedicated the rest of the week to this, so fingers crossed it all goes according to my wonderfully planned plan.

Presets, and Array Questions

Tuesday, October 2nd, 2007

A quick status update for all of you listening out there.

I’ve now created a simple load/save preset system. It’s not pretty, but it works perfectly! ( wish I could say the same for that bloody remove option…More on that later )

I’m using simple .txt file exporting and importing to do the preset saving/loading. When the ’save’ button is pressed, all the current elements are saved into a ‘.aav’ file, Which is simply a sneaky .txt file in disguise. for example :

0*default sphere*72.0*300.0*0.0*100.0
1*default cube*400.0*300.0*0.0*100.0
0*default sphere*720.0*300.0*0.0*100.0

This preset file will created 3 objects. Two Spheres, and a Cube ( oh yeah, I added cubes ). It’s fairly simple, each value is separated by a *, and each new line is a new element. The object “type” is dictated by the number at the front of the line. 0 for sphere, 1 for cube, etc. This text file is imported back into the program, the current element list is cleared ( though, in the final version I hope for a fadeout, but for now, it just vanishes like my social life while completing this assignment ), and is replaced by our new friends there.

So that’s rad.
Now I need some help.

I’ve been puzzling over this stupid remove function all day, and just when I think I’ve got it working again, I manage to break it. It wouldn’t be so complicated, however the GUI library I’m using is still in the early stages of development ( especially with the MultiList system I’m using ) and so it’s still missing some things ( such as items that remove properly … ). This is how my remove system works :

REMOVE BUTTON IS SELECTED.
REMOVE BUTTON TEXT IS CHANGED TO -REMOVED-
ELEMENT CORRESPONDING TO REMOVE BUTTON IS REMOVED

Seems simple enough. And it is for the *first* item. However I’m storing the elements in an ArrayList, which means if I remove one, the rest cascade through the list and fill in the spots, which means I have to keep an array which holds the relative button positions for the elements place in the elements ArrayList.

Confused yet ? So Am I.
SO

ArrayList elements = new ArrayList();
int[] currentElementPos;

and the remove code :

// set "edit" label to "-removed-"
gui.controller(Integer.toString(theEvent.controller().id()+1000)).setLabel("-removed-");


// set "removed" label to "-removed-"
gui.controller(Integer.toString(theEvent.controller().id())).setLabel("-removed-");


// remove item
elements.remove(currentElementPos[theEvent.controller().id()-1000]);


for (int i=theEvent.controller().id()-1000;i<=elements.size();i++){
currentElementPos[i]=currentElementPos[i]-1;
}

Yes, there are some magic numbers there, and that’s where the GUI Issues come in to play. Each button is assigned an ID number. the ‘remove’ buttons I’ve assigned incremental ID’s from 1000 upwards. ( to 2000, so don’t add more than 1000 elements :P ). so “theEvent.controller().id()” is the ID of the button that was pressed. so, 1000 would be the first element created, hence 1000-1000 = 0. Which means it is element 0. However, once I delete element 0, element 1 should now be element 0, element 2 should be element 1 etc. That’s what the for loop *should* do. But it’s … not. Maybe with a fresh mind in the morning I can work this out, but right now - I’ve tried 4 different solutions, each one works for a bit, then falls apart.

Any Ideas ? Even if it’s not in java, psuedocode is fine.

Thanks
- Anthony