Jump to content


Photo

Surface Explorer


  • Please log in to reply
19 replies to this topic

#1 KC LC

KC LC

    Ex-Administrator

  • GMC Elder
  • 5309 posts

Posted 01 April 2009 - 10:50 PM

This is my version of a 3D equation plotter for mathematical surfaces. It also includes an option to use a "mesh" instead of a solid surface. I included some of my favorite equations as a demo.

Some screenshots:

sin( r ) / r in surface form
Posted Image

cosine( r ) in mesh form
Posted Image

Actually, the GUI may be neater than the surfaces. You can control frequency, amplitude, and animation speed. And you can select 3 different surface-plot-types: solid, mesh, and mixed (half and half). There are five different equations to choose from: cosine, sin( r )/r function, gaussian, hyperboloid, and Wigner oscillator.

Here's the download:
Download (1.2 Mb zip file containing GM7 executable)

I wrote this to learn how to use the d3d_vertex_normal functions. I never really bothered with these, but they are REALLY powerful once you master them. The only real challenge is getting the normal vectors right. Without those, the lighting is all messed up.

And of course there's an Easter Egg.
  • 0
Geometricks 3D Rendering Demo / In Silico 3D Kinematics Simulation
Warped Space 3D Gravity Simulation / Surface Explorer Animated Surface Demo
Oscilloscope Animated Lissajous Figures

Featured Games at YoYo: Drop in the Bucket, Tut's Test(3rd place competition winner)

Older games at: Flying Banjo Games

#2 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 01 April 2009 - 11:04 PM

Wow, impressive. I'll poke around some more. :)

Found the Easter egg, it was quite slow on my (old) computer, but was nice. :)

Edited by GMREC1111, 01 April 2009 - 11:13 PM.

  • 0

#3 wiiowner

wiiowner

    Absolute Zero Team

  • New Member
  • 685 posts

Posted 01 April 2009 - 11:09 PM

I don't know any of those equations or much about advanced math but it looks cool (if that means anything :) ). It's also fun to mess around with and change the settings. Nice!
  • 0
Completed Projects: Eco-Chrome || Conway's Game of Life - Update that triples framerate!
Scripts: Grid Based Lighting (With Dynamic Soft Shadows) || Mud Physics


#4 Tepi

Tepi

    GMC Member

  • Global Moderators
  • 4248 posts
  • Version:GM:Studio

Posted 01 April 2009 - 11:13 PM

Wow, this is cool.

It runs fast, looks very good and is easy to use. Good job.

One thing I'd like though, is that since it's 3D, the user should be able to change the viewpoint. I'd also like if there were more different functions, and most importantly, ability to customize the function (but I do understand that implenting such system might be difficult, not to mention slow real time).

Haha I knew what was leading to the easter egg as soon as I looked at the screenshot. What a really nice easter egg indeed. Beautiful! :)
  • 0

#5 Southman

Southman

    I simply am not here

  • GMC Member
  • 1662 posts
  • Version:GM:Studio

Posted 02 April 2009 - 02:19 AM

You should make a screensaver and put the easter egg in it :)
  • 0

#6 kake_fisk

kake_fisk

    GMC Member

  • GMC Member
  • 2392 posts
  • Version:GM7

Posted 02 April 2009 - 05:58 AM

Found the secret. :)
  • 0

#7 KC LC

KC LC

    Ex-Administrator

  • GMC Elder
  • 5309 posts

Posted 02 April 2009 - 08:59 AM

One thing I'd like though, is that since it's 3D, the user should be able to change the viewpoint. I'd also like if there were more different functions, and most importantly, ability to customize the function (but I do understand that implementing such system might be difficult, not to mention slow real time).

I thought about allowing the user to "drag" the viewpoint/orientation of the display. Just never got around to it. But it's trivial to do, and it wouldn't slow things down.

I may add a "custom function" input. The only drawback would be the display limited only to "mesh". That's because the solid surface display requires an array of surface-normal vectors. For the built-in functions, I get those analytically by calculating the x- and y-partial derivatives. But I can't do that for user-entered functions.

EDIT: Never mind, that's dumb. I can calculate the normal vectors from the cross-product. Since I have the vertices, it's easy to form two non-parallel tangent vectors for each facet. In fact, that's what I'm going to start doing instead of calculating the normals analytically. That makes more sense, and it's more general.

What a really nice easter egg indeed. Beautiful!

Thanks. Those are left over from an evolution sim I was making once. My favorites are the swimming jelly fish thingies.

Edited by KC LC, 02 April 2009 - 11:19 AM.

  • 0
Geometricks 3D Rendering Demo / In Silico 3D Kinematics Simulation
Warped Space 3D Gravity Simulation / Surface Explorer Animated Surface Demo
Oscilloscope Animated Lissajous Figures

Featured Games at YoYo: Drop in the Bucket, Tut's Test(3rd place competition winner)

Older games at: Flying Banjo Games

#8 Tepi

Tepi

    GMC Member

  • Global Moderators
  • 4248 posts
  • Version:GM:Studio

Posted 02 April 2009 - 11:35 AM

I may add a "custom function" input. The only drawback would be the display limited only to "mesh". That's because the solid surface display requires an array of surface-normal vectors. For the built-in functions, I get those analytically by calculating the x- and y-partial derivatives. But I can't do that for user-entered functions.

Yeah, that's what I meant by saying it would be slow and difficult to implent.

But I believe you could calculate the normals for user-defined functions. You could treat partial derivatives in the sense of numerical differentiation. However, it's likely to become quite slow when refreshed such model.

On the other hand, surface explorers like this which allow customized functions are found online... <_< ... >_>. They are just not as pleasing graphically.

EDIT: Never mind, that's dumb. I can calculate the normal vectors from the cross-product. Since I have the vertices, it's easy to form two non-parallel tangent vectors for each facet. In fact, that's what I'm going to start doing instead of calculating the normals analytically. That makes more sense, and it's more general.

Be careful; smoothing those normals will probably be even slower.

Edited by Tepi, 02 April 2009 - 11:50 AM.

  • 0

#9 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 02 April 2009 - 01:47 PM

Crap, as all your games are! (quite the opposite, just having some fun).

Nice work, pretty stable too.


Edit: Ow, wait a sec. I definately want to see the source. How the heck did you produce such fast 3D graph rendering?!

Edited by uuf6429, 02 April 2009 - 01:51 PM.

  • 0

#10 PickleMan

PickleMan

    Programmer

  • New Member
  • 995 posts
  • Version:Unknown

Posted 02 April 2009 - 08:33 PM

Very Very nice... I love it. You should include the ability to have a Make your own equation!
I especially like the mesh.

I found the Easter Egg too.
  • 0

#11 DarkFlame

DarkFlame

    GMB Member...wtf?

  • GMC Member
  • 2167 posts

Posted 06 April 2009 - 01:32 AM

Gui has a weird light source angle.

Easter egg was easy to find like usual.

Interesting principle, but not much depth. I don't know maybe the view can be rotated but it wasn't obvious and if it cant be it should be.
  • 0

#12 MMORPGguy

MMORPGguy

    MMORPG guy

  • GMC Member
  • 2208 posts
  • Version:Unknown

Posted 06 April 2009 - 02:42 AM

That didn't look like something I thought GM could do. Especially the Easter egg... Wow.
  • 0
My blog.

"Let the guarantee of free speech be in every man's determination to use it, and we shall have no need of paper declarations."
- Voltairine de Cleyre

#13 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 06 April 2009 - 02:43 AM

Nice. Now for your next project, how about a frequency interference graph? Inputing 2 wave forms...
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#14 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts
  • Version:Unknown

Posted 06 April 2009 - 01:38 PM

Again, what's the code for 3D rendering of the graph? My old code took a whole second to render a single 2d graph, yours does it dynamically on-the-fly.
How?

Regards,
Chris.
  • 0

#15 NakedPaulToast

NakedPaulToast

    GM Studio/Mac/Win

  • GMC Member
  • 8808 posts
  • Version:GM:Studio

Posted 06 April 2009 - 04:21 PM

I really liked the Jelly fish surfaces. Would like to see them rendered in solid instead of wiremesh, with some alpha.
  • 0

If the Bible truly is inspired by God, you would think that somebody as omnipotent and all-knowing would have known to get his message out using TCP instead of UDP.

 


#16 Yourself

Yourself

    The Ultimate Pronoun

  • GMC Elder
  • 7352 posts
  • Version:Unknown

Posted 13 April 2009 - 12:06 PM

One thing I'd like though, is that since it's 3D, the user should be able to change the viewpoint. I'd also like if there were more different functions, and most importantly, ability to customize the function (but I do understand that implementing such system might be difficult, not to mention slow real time).

I thought about allowing the user to "drag" the viewpoint/orientation of the display. Just never got around to it. But it's trivial to do, and it wouldn't slow things down.

I may add a "custom function" input. The only drawback would be the display limited only to "mesh". That's because the solid surface display requires an array of surface-normal vectors. For the built-in functions, I get those analytically by calculating the x- and y-partial derivatives. But I can't do that for user-entered functions.

EDIT: Never mind, that's dumb. I can calculate the normal vectors from the cross-product. Since I have the vertices, it's easy to form two non-parallel tangent vectors for each facet. In fact, that's what I'm going to start doing instead of calculating the normals analytically. That makes more sense, and it's more general.

What a really nice easter egg indeed. Beautiful!

Thanks. Those are left over from an evolution sim I was making once. My favorites are the swimming jelly fish thingies.


Why use the cross-product at all? Why not just numerically approximate the partial derivatives (using a central difference)? It's simpler, you can use values that have already been computed, you'll get smoothed normals, and no one will really be able to tell the difference.
  • 0

#17 KC LC

KC LC

    Ex-Administrator

  • GMC Elder
  • 5309 posts

Posted 15 April 2009 - 01:17 AM

I really liked the Jelly fish surfaces. Would like to see them rendered in solid instead of wiremesh, with some alpha.

Thanks. ;) I've just finished a new version of the jellyfish using a solid mesh that looks very "organic". I'll post it later in a separate topic along with some other biological sims I'm working on.

Why use the cross-product at all? Why not just numerically approximate the partial derivatives (using a central difference)?

Even simpler, I use spherical normals like +/- x/r and y/r. It's very fast and it works fine for most radially symmetric shapes like spheres (obviously) and sine/cosine, sin( r )/r, and Gaussian functions.

I'm working with more complex shapes now (knots, superquadratics, various polygons). And I find these approximations leave artifacts. So calculating the array of normals from the cross-product gives and best appearance -- and it's still pretty fast if you don't get carried away with too many vertices. It also makes it easy to flip the normals as needed, depending on the light direction.
EDIT: volume renders
  • 0
Geometricks 3D Rendering Demo / In Silico 3D Kinematics Simulation
Warped Space 3D Gravity Simulation / Surface Explorer Animated Surface Demo
Oscilloscope Animated Lissajous Figures

Featured Games at YoYo: Drop in the Bucket, Tut's Test(3rd place competition winner)

Older games at: Flying Banjo Games

#18 icicle.flame

icicle.flame

    CyntaxGames

  • New Member
  • 283 posts

Posted 28 June 2010 - 08:00 AM

dang!.... These are amazing... If at all possible I would like to see a .gmk

The jellyfish were my fav.
  • 0


:Secret Weapon (secret game):
:Programming: [][][][][][][][][][]
:Spriting: [][][][][][][][][][]
:Storyline: [][][][][][][][][][]
:Sounds: [][][][][][][][][][]

:Awsomeness:[][][][][][][][][][]

Posted Image .


#19 RamboFox

RamboFox

    Tainted Fortune

  • New Member
  • 992 posts

Posted 28 June 2010 - 11:41 AM

Looks cool, but your file host is immensely crappy - it took me 5 minutes just to connect to it.

Just downloaded it, and found the hidden Easter egg. Gawd, it looks so alien (And much like ocean plankton :D)

Edited by RamboFox, 28 June 2010 - 11:45 AM.

  • 0

#20 KC LC

KC LC

    Ex-Administrator

  • GMC Elder
  • 5309 posts

Posted 28 June 2010 - 02:40 PM

The jellyfish were my fav.

It took me a minute to realize what you were talking about. :lol: I'd forgotten all about this (and the Easter Egg). I've made better mesh versions of the undulators. Maybe I'll use them in a game someday.

Looks cool, but your file host is immensely crappy - it took me 5 minutes just to connect to it.

Just downloaded it, and found the hidden Easter egg. Gawd, it looks so alien

My host notified me they were slowed down for maintenance this AM. Guess you happened to catch them at that time. Sorry for the hassle. But everything's back to high-speed now. In future, I'll add mirror links.

Anyway, glad you liked the fish.
  • 0
Geometricks 3D Rendering Demo / In Silico 3D Kinematics Simulation
Warped Space 3D Gravity Simulation / Surface Explorer Animated Surface Demo
Oscilloscope Animated Lissajous Figures

Featured Games at YoYo: Drop in the Bucket, Tut's Test(3rd place competition winner)

Older games at: Flying Banjo Games