• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Akitsune

Image-Space 3D Metaballs

9 posts in this topic

After coming across this thread, I had an idea - if this technique can be applied to a 2D game, why haven't I seen it in a 3D one? So, I set out to create a demo of it in 3D this morning. Click me to download. The technique is described in that thread, however, I apply it to 3D: -Create a plethora of billboards with a texture that represents the metaball's charge. -Render all the billboards using additive blending to a render target. -Combine said render target to the scene using a shader. The shader checks if the metaballs charge is > than the threshold - if so, it is rendered. (I actually cheat and use saturate(Charge - Threshold) / (1.0f - Threshold) to smooth it out instead.) -Color the metaballs. In the demo I provided, it's slowed down significantly by physics, but the technique is very fast, and is basically dependent on your fill rate. However, your metaballs may appear different depending on camera angle. If someone has the performance to spare, I'd imagine that a really good looking water simulation could be made out of this and a low threshold. Also, someone far more intelligent than me can probably figure out how to extract world-space normals from the billboards, allowing for cubemap reflections and a million other fancy effects. Tell me what you think!
0

Share this post


Link to post
Share on other sites
It's not too hard to add normals. Basically when you're rendering your billboards, you need to calculate xy values such that x and y are of the range[-1, 1] (where (-1, -1) is the bottom left corner of your quad, and so on). Then you output these x and y values along with your weight value (height), and you scale x and y by the weight.

float dist = length(xyPos);
float weight = CalcGaussianWeight(dist);

xyPos *= weight;
return float4(xyPos, 0, weight);


Then in your final pass where you sample the summed weights, you can calculate a normal like this:

float3 normal = normalize(float3(sample.x/sample.w,
sample.y/sample.w,
max(sample.w - 0.08f, 0)));


Of course you may need to negate your Z depending on your coordinate system.

This is a screen from a little demo I made with this technique a while back:


1

Share this post


Link to post
Share on other sites
Awesome - helpful as always, MJP.

I decided to use cubemap reflections, a non-spherical (paint splat) heightmap/brush, with normals:



[Edited by - Akitsune on March 10, 2010 3:59:09 AM]
0

Share this post


Link to post
Share on other sites
this is awesome! I currently used raycasting combined with spatial hashing on the GPU to make realtime 3D metaballs but this is so much simpler :)

I will give this a try for sure!

edit:
anyways I am curious what happens if you move the camera? does that look weird?
0

Share this post


Link to post
Share on other sites
[indent]Quote: [i]Original post by mokaschitta[/i]
this is awesome! I currently used raycasting combined with spatial hashing on the GPU to make realtime 3D metaballs but this is so much simpler :)

I will give this a try for sure!

edit:
anyways I am curious what happens if you move the camera? does that look weird? [/indent]


Thanks! No, not like you'd expect from a billboard method - that's what makes it pretty neat.

Updated the demo, WASD to see for yourself:

[url="http://frontierworlds.com/gpu/Meta.zip"]http://astraios.net/test/Meta.zip[/url]

I'd share the source, but I'm using 3D middleware and it's horribly organized. If someone REALLY wants it, just ask.

PS: Try changing the Drop.png texture to any other grayscale picture.

edit: fixed to new link, source included Edited by Akitsune
0

Share this post


Link to post
Share on other sites
Hey,

I am on a mac, so I cant test your demo. Anyways I thought about the method a little more and correct me if I am wrong:

this method interprets all metaballs having the same z value right? I could move one metaball in front of all the others.

An also no matter how far away a metaball is, it will contribute to the current pixel due to the additive blending.

Did you solve that anyhow or is that a limitation you have to take when using this method?
0

Share this post


Link to post
Share on other sites
Right. I render the billboards using back-front sorting, so the z position is proper.

Correct - metaballs contribute from any distance. This is a limitation, but it isn't a huge one and is barely noticeable - this is what the threshold and billboard size should be adjusted to minimize artifacts. I'm working on adding depth so I can retrieve the world position from the metaballs and eventually use triplanar texturing which like likely have artifacts due to this.
0

Share this post


Link to post
Share on other sites
cool, let us know how it works out. if you get correct depth to work somehow this is a neat method.
I want to be able to move metaballs in front of each other without resulting in one big blob (as it would be with this method).
0

Share this post


Link to post
Share on other sites
I tried your demo on Windows 7 x64 and it gives me an error saying that is is not a valid Win32 application.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by maspeir
I tried your demo on Windows 7 x64 and it gives me an error saying that is is not a valid Win32 application.


Looks like I forgot to build in x86 mode, sorry! Uploading a fixed version.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0