Dark Bit Factory & Gravity

GENERAL => Projects => Topic started by: taj on February 17, 2008

Title: real time wada basin effect
Post by: taj on February 17, 2008
WARNING: PS3.0 required.
I hope this works on Nvidia platforms...please let me know. Oh there is no timer so on slower cards it may go SLOWLY.

This is a real time zoom on a wada basin fractal, complete with moving light. I'm not sure if this has ever been seen before properly. Its correct up to 10 bounces of light.

If you can't run it, you can see some images at my blog: http://sizecoding.blogspot.com/ . Not sure what to do with this but maybe it will end up in a 4k sometime. As an effect is pretty cool.
Title: Re: real time wada basin effect
Post by: zawran on February 17, 2008
It runs perfectly smooth on my nvidia 8800gt sli setup. It would be cool if it was possible to change the resolution, just to see if it can handle it. I am running at 1920x1200, but even the 800x600 resolution that it looks like you are running this on, looks great on my large screen.
Title: Re: real time wada basin effect
Post by: taj on February 17, 2008
Quote from: zawran on February 17, 2008
It runs perfectly smooth on my nvidia 8800gt sli setup. It would be cool if it was possible to change the resolution, just to see if it can handle it. I am running at 1920x1200, but even the 800x600 resolution that it looks like you are running this on, looks great on my large screen.

Has anyone got any simple pop-up code I could add to allow someone to chose resolution? If so I'll try to add it. If not I'll write some.
Title: Re: real time wada basin effect
Post by: Rbz on February 17, 2008
The shaders code works fine, exactly like images on your blog, but it's slow...

I suggest you to use it as background image for your 4k, and apply some distort effect or other simple and fast effect on the top, because few people will be able to see it in full speed as main effect.

Title: Re: real time wada basin effect
Post by: taj on February 17, 2008
Quote from: rbraz on February 17, 2008
The shaders code works fine, exactly like images on your blog, but it's slow...

I suggest you to use it as background image for your 4k, and apply some distort effect or other simple and fast effect on the top, because few people will be able to see it in full speed as main effect.



Its too many bytes for just a background I'm afraid Rbraz. Guess Ill have to make sure the compo machine is relatively new if I get around to 4k. Heres an exe for you, smaller res, less bounces and faster movement.
Title: Re: real time wada basin effect
Post by: Jim on February 17, 2008
That's pretty damn cool!  And if you stare at it long enough and then quit back to the desktop, the desktop looks like it's rotating back the other way - spooky!

Jim
Title: Re: real time wada basin effect
Post by: Voltage on February 17, 2008
Looks fantastic, a very nice effect.

The first version was too slow for my PC running at about 4-5 frames/sec.

The rbraz version was more like realtime at something like 25-30 frames/sec.

Nvidia GeForce 7300 GS.
Title: Re: real time wada basin effect
Post by: taj on February 18, 2008
Quote from: Jim on February 17, 2008
That's pretty damn cool!  And if you stare at it long enough and then quit back to the desktop, the desktop looks like it's rotating back the other way - spooky!

Jim


Jim do you have any code for setting resolutions etc in win32 API? Basically I thinkI want to open a dialogue box, add radio buttons or a list and thats it. However I want the code to be as minimal as possible so maybe it could be used in a 4k. Anything to work from? Information on the net is mainly based around ... Open a project, use the resource manager...which leads to unacceptable code.
Title: Re: real time wada basin effect
Post by: taj on February 18, 2008
Quote from: Voltage on February 17, 2008
Looks fantastic, a very nice effect.

The first version was too slow for my PC running at about 4-5 frames/sec.

The rbraz version was more like realtime at something like 25-30 frames/sec.

Nvidia GeForce 7300 GS.

Thanks for the info. 4-5 frames a second is awful :-(. Yet thats a very common level of card today. It shows how much shaders are improving in speed as your card (and Rbrazs) are entry level and 2-3 years old. The code is hitting the part thats changing performance fastest in time (fragment shader). I suppose the lesson here is when doing such heavyweight shaders, the best option is to put it in a part of the screen, not full screen (eg as a texture wrapped on an object). I hope shaders stabilise within the next few years so performance becomes more predictable, but it doesnt look likely. The 8800 is way faster than my card which was top end 2 years ago.  BTW for reference I am getting 50-60 frames per second so it shows how much cards change.

Title: Re: real time wada basin effect
Post by: benny! on February 18, 2008
@taj:

Wow ... that production is cool like lemonade. Very good.
Rbraz versions runs better here, too. Although the speed
also changes and is not constant.

About setting new resolution - are you speaking about
desktop resolution ? If so - I am not sure if this is the way
to go - because users can be upset whnen the icons on
their desktop are un-ordered after changing their resolution.

Nevertheless, maybe this function would do the trick:

http://msdn2.microsoft.com/en-us/library/ms533260(VS.85).aspx (http://msdn2.microsoft.com/en-us/library/ms533260(VS.85).aspx)
Title: Re: real time wada basin effect
Post by: Jim on February 18, 2008
If I'm right, I think Taj is asking for code to open and create the dialog boxes for selecting the res.  And using the resource editor is making things too large.  It is possible to generate these dialogs from data structures in your code - the API call is CreateDialogIndirect.

Jim
Title: Re: real time wada basin effect
Post by: benny! on February 18, 2008
Ahh I see. Stupid me  ::)
Title: Re: real time wada basin effect
Post by: Shockwave on February 18, 2008
That looks really great :)

There's nobody else making these nice small intros with shaders. I think I prefer the high res version, even though it happens more slowly, it still runs nice.
Title: Re: real time wada basin effect
Post by: taj on February 19, 2008
Quote from: Shockwave on February 18, 2008
That looks really great :)

There's nobody else making these nice small intros with shaders. I think I prefer the high res version, even though it happens more slowly, it still runs nice.

I think Loonies, tbc (mentor) and hitchhiker have all made 1ks with shaders. Still thats not bad company to be in :-). The high res one looks slow because I turn it 0.1 degrees each frame so even at 30 fps it only rotates 3 degrees in one second. I like slow stuff but realise that I'm an anomaly as most sceners prefer whoooom-bang-glooooow-in-yer-face.
Title: Re: real time wada basin effect
Post by: taj on February 19, 2008
Quote from: zawran on February 17, 2008
It runs perfectly smooth on my nvidia 8800gt sli setup. It would be cool if it was possible to change the resolution, just to see if it can handle it. I am running at 1920x1200, but even the 800x600 resolution that it looks like you are running this on, looks great on my large screen.

Zawran, I gave up on the dialogue box for now...heres a version in 1920x1200, 10 bounces per ray, plus more dramatic lighting. I can't test it here :-) so good luck. Let me know!
Title: Re: real time wada basin effect
Post by: Shockwave on February 19, 2008
That ultra high res version runs fine here :)
Title: Re: real time wada basin effect
Post by: zawran on February 19, 2008
The hires version still runs super smooth, but then again if those two 8800gt didn't perform somewhat decent, then I would have been dissapointed. It looks really great.
Title: Re: real time wada basin effect
Post by: Paul on February 19, 2008
That one is really cool, starts of stable at 60 fps, and then suddenly drops to 30.
I like the contrast between the red and white, really Good.
Title: Re: real time wada basin effect
Post by: taj on February 19, 2008
I'm jealous - I cant even see it here! Glad it works though.
Title: Re: real time wada basin effect
Post by: Rbz on February 19, 2008
My special version works fine  :P

I'll help you with a small window dialog if you like, I have all code for it
Title: Re: real time wada basin effect
Post by: taj on February 20, 2008
Quote from: rbraz on February 19, 2008
My special version works fine  :P

I'll help you with a small window dialog if you like, I have all code for it


Yes please!
Title: Re: real time wada basin effect
Post by: benny! on February 20, 2008
@taj:
Hmm ... never did a tiny sized window dialog. Here is
a un-optimized code example of a combo box. Maybe
this helps out.


#include <windows.h>

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

HINSTANCE g_hinst;

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
  HWND hwnd;
  MSG  msg ;   
  WNDCLASS wc = {0};
  wc.lpszClassName = TEXT("Application");
  wc.hInstance     = hInstance ;
  wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
  wc.lpfnWndProc   = WndProc ;
  wc.hCursor       = LoadCursor(0,IDC_ARROW);

  g_hinst = hInstance;
 
  RegisterClass(&wc);
  hwnd = CreateWindow(wc.lpszClassName, TEXT("taj"),
                WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                100, 100, 150, 80, 0, 0, hInstance, 0); 

  while( GetMessage(&msg, NULL, 0, 0)) {
    DispatchMessage(&msg);
  }
  return (int) msg.wParam;
}

LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{

  static HWND hwndCombo; //, hwndStatic;
  const TCHAR *items[] = { TEXT("800x600"), TEXT("1024x768"), TEXT("1280x1024") };
  int i;
  LRESULT sel = 0;

  switch(msg) 
  {
      case WM_CREATE:
            hwndCombo = CreateWindow(TEXT("combobox"), NULL,
                  WS_CHILD | WS_VISIBLE | CBS_DROPDOWN,
                  10, 10, 120, 110, hwnd, NULL, g_hinst, NULL);   

            for ( i = 0; i < sizeof(items) / sizeof(int); i++ ) {
                SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM) items[i]);
            }

            break;

      case WM_COMMAND:
           if (HIWORD(wParam) == BN_CLICKED) {
                SendMessage(hwndCombo, CB_SHOWDROPDOWN, (WPARAM) TRUE, 0);
           }
             
           if ( HIWORD(wParam) == CBN_SELCHANGE) {               
                sel = SendMessage(hwndCombo, CB_GETCURSEL, 0, 0);
//
// items[sel] holds the selected value !!!
//
           }

           break;

      case WM_DESTROY:
          PostQuitMessage(0);
          break;
  }
  return DefWindowProc(hwnd, msg, wParam, lParam);
}


items[sel] holds the selected value of the combobox.

Or do you need other controls like checkboxes, radiobuttons?
Title: Re: real time wada basin effect
Post by: taj on February 20, 2008
Thanks Benny, this seems like a VERY good start. This should really be a subject by itself but in essence:

* Open a dialogue box with a list of items
* Submit the list of options eg "640x480", "800x600" etc..
* Wait until OK button is pressed
* Get the selected item index (number-not text)
* Kill window
* Resize desktop using numbers in array indexed by the return value from dialogue
* Open Opengl window fullscreen

Your example is getting close if I can destroy that window and open the opengl window afterwards.
Unless anyone can think of a smarter way..

OK so I got your code compilingon the front of one of my demos. Really the only strange thing is that I have to exit the app before the demo starts (ie I dont press an OK button). However this is getting very close!!

Wrell done. I make it 330 bytes roughly after crinklering...hopefully we could get it below 200 ... hopefully.

Taj
Title: Re: real time wada basin effect
Post by: Jim on February 21, 2008
  wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
  wc.hCursor       = LoadCursor(0,IDC_ARROW);
Can just set both of these to NULL.
  wc.hbrBackground = NULL;
  wc.hCursor       = NULL;
Jim