Re: Ocean Simulator: The research continues...

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

trogdor
Posts: 0
Joined: Mon Aug 02, 2004 2:30 am

Post by trogdor »

wow, this rocks! waves just doesnt cut it when you want oceans! keep up the good work.

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey »

Well, my frustration at trying to debug a CPLD has granted me some time to write an update on my progress - but unfortunetly no screenshots.

Over the last several weeks I have managed to get some programming time in here and there, in that time I have managed to get translational displacement working (which is required to make choppy water) and to have another go at the GUI.

I have also added a 'Disable' toggle button (where the 'Regen' button used to be). This is because when you have big FFT's it takes 10-20 seconds to calculate the displacement for one frame which is unacceptable espacially when dealing with animation. Unfortunetly when it is depressed there is no effect shown which is not what I want - it has to be still instead.

Currently I am trying to make an 'Arrow' popup widget (similar to the popup colour dialogue box) however it is taking alot of time since blender's widget code is somewhat difficult to follow.

After reading a post on Slashdot - do do with lucas arts and other CG studios taking years to perfect their ocean simulators it made be feel that taking a year or so to perfect the effect wasn't a bad idea. This probably stemming from the fact that once the Ocean FFT effect is released in the wild it is going to be very difficult to make any changes without upsetting people.

Kind Regards
Simon Harvey

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey »

I have been talking with one of my Lecturers/friends and he was asking about what kind of minimum functionality would be needed to commit the effect to CVS (either BF or evil blender).

His idea was that the first release (v1.0) would have basic functionality: it would work and be easy commit to CVS and also be easy for the artists to learn.

The second version (v1.1) would have ocean spray, dispersion, etc...
(I am not really sure where the choppy effect goes in here - i.e. in v1.0 or 1.1).

I would like to hear from somebody who does have an idea of what the process is and what reasonable functionality would be acceptable.

It would be great to hear from anybody that makes decisions regarding CVS.

Kind Regards
Simon Harvey

jesterKing
Site Admin
Posts: 207
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing »

simonharvey wrote:I have been talking with one of my Lecturers/friends and he was asking about what kind of minimum functionality would be needed to commit the effect to CVS (either BF or evil blender).
It should be bugfree, fit into the existing workflow, look clean codewise and such things. Before it would be committed to either it is good practice to send a patch to either list, bf-committers or tuhopuu-devel, for evaluation.

/Nathan Letwory

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey »

Well here is a small update with a couple of developer questions thrown into the mix.

As my prevoius post had said I had added some more code to the GUI as well added translational displacement which can be shown in the following screenshot:

Image

I have a couple of questions regarding this:
I am thinking of putting in a popup arrow widget where the WindX and WindY widgets are, is this OK ? or would it be better just to have standard numerical text entry (this arrow widget could also be used for the wave effect as well)?

The reason why I want to have it in there it because it would take up less UI real estate and is more intutative than just typing values into text boxes, however it is more complicated and takes up more precious widget ID's (i.e. HSVCUBE, etc...)

The second is relating to scaling: In the current version you can scale and offset along the X and Y axis however if I was to put in a "wind" button that would scale along the wind coordinates then the current method would be obsolete (except for lowerspec machines) The questions are:

1. should I include this kind of scaling and offseting?
2. If I do follow it through: should I then remove the current implementation?

The neigh and bspline buttons are going to be removed and replaced with the single "blinear" button, since the bicubic spline interpolation isnt needed however sometimes bilinear interpolation comes in handy.

It would be great to hear what people think
Kind Regards
Simon Harvey

trogdor
Posts: 0
Joined: Mon Aug 02, 2004 2:30 am

Post by trogdor »

i would prefer numerical text entry


nice work. do you ahve a link to a build with this?

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey »

trogdor wrote:Do you ahve a link to a build with this?
No, I have a linux box and so windows builds arnt really an option, also the effect uses FFTW that needs its own setup (./configure, etc...). and I not really sure how well FFTW will build on windows...

trogdor wrote:i would prefer numerical text entry
OK people we have 1 data point!!! lets keep the opinions coming!!!

kencanvey
Posts: 0
Joined: Mon Jun 02, 2003 7:54 am
Location: Smethwick West Midlands UK

Post by kencanvey »

http://www.fftw.org/install/windows.html

I found this site to do with FFTW (if its the right one? ) to do with windows.

Also as far as your questions go : 1: YES 2: Could it be kept as an option, would there be a need for it?

I really hope this can be made to work on Windows.


Great work so far. :)

Ken

Dani
Posts: 143
Joined: Fri Oct 18, 2002 8:35 pm

Post by Dani »

i thought i had posted something about the entry method, and i'd go for a helper, not everybody is confortable with vectors.

It could be some helper drawn in 3D View ala Particles Force Fields...

No?

Dani

trogdor
Posts: 0
Joined: Mon Aug 02, 2004 2:30 am

Post by trogdor »

hey, can you post a demo animaiton? im really pumped about this project and would like to salivate on my keyboard.

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey »

Well, I am just taking a break from masters to have another crack at the OceanFFT effect.

Since the last I have posted I wrote away to Godfried Chen to get permission to use his code from CHENGINE to patch
my current implementation , since I was getting wave propogation in both directions and my choppy algorthym wasn't working.

I havent ported the features over yet however I have seen screanshots of Chens choppy water and it looks amazing:
Image

I have also decided to drop the compass widget. since I was getting,
"Error: attempting to deference a particially defined data type" (or something like it in):

Code: Select all

int ui_do_but_ARROW(uiBut *but)
{
	uiBut *bt;
	float x_mouse, y_mouse; 
	float x_coord, y_coord; 
	
	float angle, angle_rad = 1.0f;
	short mval[2], mvalo[2];
	
	mvalo[0]= mvalo[1]= -32000;
	
	while (get_mbut() & L_MOUSE) {
		
		uiGetMouse(mywinget(), mval);

		if(mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {			
			mvalo[0]= mval[0];
			mvalo[1]= mval[1];
			
			/* relative position within box */
			x_mouse = ((float)mval[0]-but->x1)/(but->x2-but->x1);
			y_mouse = ((float)mval[1]-but->y1)/(but->y2-but->y1);
			
			x_coord = x_mouse - 0.5f;
			y_coord = y_mouse - 0.5f;
			
			/* atanf() only returns a number from pi/2 to -pi/2 so we have to convert it,
			 * there will be a better way of doing this, but that will have to come later */
			
			angle_rad = calculate_inverse_tan(x_coord, y_coord);
			
			/* convert the angle to degrees for IPO etc... */
			if((x_coord < 0.0f) && (x_coord > 0.0f)) {
				angle = angle_rad  * (360.0f / TWO_PI);
			}
			
			/* save the angle to the button */
			ui_set_but_vectorf(but, &angle);
			
			/* should we update ?  - no */
			
			/* we redraw the entire block */
			for (bt= but->block->buttons.first; bt; bt= bt->next) {
				/* then we redraw the arrow */
				ui_draw_but(bt);
			}
			
			glFlush(); /* flush display in subloops */
		}
		else BIF_wait_for_statechange();
	}

	return but->retval;
The errors showed up where but was referenced. So now blenders users who want to use the FFT effect will have to
learn how to master vectors in 2D space.

I have also changed the GUI around:

Image


Unfortunetly the functionality dosent work but it is a hint of what is to come.


Kind Regards
Simon Harvey

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey »

Well Hi All!

It has been some time since I last posted an update, this has been due to my thesis - both the write up and debugging.

Anyway I have put in some hours here and there and now I have made the following progress:

1. Parts of CHENGINE have been integrated (the FFT wave code anyway)

2. I have figured out why the waves were propagating in both directions: a negative sign was in the wrong place!

3. The 'Disable' button is now working correctly, this means that animators can use the FFT effect with big array sizes and also test thir animations (using ALT-A) at the same time.

4. The 'Wavelet size' slider has been implemented (well, ported over) so users can control the FFT wave detail.

I do have a DivX videofile of the waves propagating but my FTP software just cant seem to upload it sucessfully to the FTP server so you will have to contend with a static image instead:

Image

As it turns out the CHENGINE code is slightly slower however it is more memory efficent - it requires one array less of memory.
This isnt that much of a problem for smaller FFT array grids however for larger (512x512, 1024x1024) it presents a problem especially when rendering with resource hungry scenes.

Now that the basic FFT sample code has completed the choppy algorthm can be added and wavelet size can be trimmed.

Kind Regards
Simon Harvey

ps. Congrats to the blender developer team for the great 2.35 release!!!

gabio
Posts: 0
Joined: Thu Jan 15, 2004 6:41 am
Location: Canada - Québec - Sherbrooke
Contact:

Post by gabio »

Welcom back.
glade to see new stuff.
so at this rate, will you make it for 2.36?
also have a look at this:
http://projects.blender.org/pipermail/b ... 08352.html

xeetstreet
Posts: 0
Joined: Sun Nov 21, 2004 7:52 am

Post by xeetstreet »

This stuff is great. If I didn't have a use for a realistic ocean before, I'll find one. If you need any help with the involved mathematics, feel free to drop me a line.

What are the possibilities of these to water effects being used together?

simonharvey
Posts: 0
Joined: Tue May 18, 2004 8:11 am

Post by simonharvey »

gabio:
so at this rate, will you make it for 2.36?
also have a look at this:
http://projects.blender.org/pipermail/b ... 08352.html

I dont think it will make it for 2.36, because of time constraints and also the politics of adding 3rd party libraries to the blender codebase.

may be sometime after.

xeetstreet:
What are the possibilities of these to water effects being used together?

I think what really needs to be implimented is an 'Effects Graph' that you can use to chain effects together, so that say the output from the ocean FFT effect simulator that dosent have any interactive I/O can pipe its data through to the surface wave effect that you see in the link (that was submitted by gabio).

However without such a graph I think that what you would do it just add the effects to the object in the order that you want them evaluated. This wouldnt work if you had more than 1 of the same type of the effect per scene, but people usually dont add lots of effects to one object.

Kind Regards
Simon Harvey

Post Reply