• 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
FredrikHolmstr

Force field around a model and pushing vertices outwards in shader.

9 posts in this topic

I've been working on a pretty simple "Force Field" shader which is supposed to wrap a model inside a slightly larger version of it self which is render using some alpha transparent material. My current progress looks like this:

[img]http://dl.dropbox.com/u/19877504/2012-08-06%2016-54-27.jpg[/img]

My current approach looks like this:
[source lang="cpp"]
vertex_output o;

float4 world = mul(MATRIX_MVP, v_in.vertex);
float4 normal = mul(MATRIX_MVP, v_in.normal);
o.pos = world + (normal * 1.05f);

return o;[/source]

It's pretty obvious what it does, it offsets the vertex by a fraction of it's normal it works reasonably well for objects that don't have a lot of duplicate vertices to create sharp edges, like the blue around the solider for example. But it does not work at all around the weapon due to the sharp edge/duplicate vertices.

Now, my question is pretty simple: Is there a better way of achieving this effect, and more specifically offsetting the vertices in the shader.
0

Share this post


Link to post
Share on other sites
I saw a nice talk on this on the [url="http://www.bungie.net/Inside/publications.aspx"]Bungie website[/url], because Halo has a LOT of force fields. I can't remember the exact talk but it's on that page somewhere sorry!
0

Share this post


Link to post
Share on other sites
It looks preety decent for me. You can also add more glow to it and maybe some subtle distortion (like heat haze), It will make it more lively :)
(I know it's only 'visual' opinion which you weren't after :) )
0

Share this post


Link to post
Share on other sites
You could try to move all vertices a little bit towards the camera. Though that won't cause model to look a little bigger.
0

Share this post


Link to post
Share on other sites
Try something like this instead:[code]float4 world = mul(MATRIX_MVP, v_in.vertex + v_in.normal * 1.05f);[/code]
Although you way want to try a value > 1.05, it's basically what Quake 2 did back in 1998, so it should work.
0

Share this post


Link to post
Share on other sites
[quote name='Tasaq' timestamp='1344276729' post='4966739']
It looks preety decent for me. You can also add more glow to it and maybe some subtle distortion (like heat haze), It will make it more lively
(I know it's only 'visual' opinion which you weren't after )
[/quote]Thank you! I've been thinking about putting other effects on top of this, but both glow and heat haze would require a post-processing effect if i'm not mistaken?

[quote name='Ripiz' timestamp='1344277505' post='4966744']
You could try to move all vertices a little bit towards the camera. Though that won't cause model to look a little bigger.
[/quote]Hmmm, I will try this and see what I come up with.
[quote name='Daniel Wilson' timestamp='1344267481' post='4966698']
I saw a nice talk on this on the Bungie website, because Halo has a LOT of force fields. I can't remember the exact talk but it's on that page somewhere sorry!
[/quote]I can't find the text you're talking about in any of the articles, you sure it's there?

[quote name='mhagain' timestamp='1344281162' post='4966768']
Try something like this instead:[code]float4 world = mul(MATRIX_MVP, v_in.vertex + v_in.normal * 1.05f);[/code]
Although you way want to try a value > 1.05, it's basically what Quake 2 did back in 1998, so it should work.
[/quote]I've done the vertex movement in both local and world space without any major difference in end result.
0

Share this post


Link to post
Share on other sites
[quote name='fholm' timestamp='1344283223' post='4966785']
Thank you! I've been thinking about putting other effects on top of this, but both glow and heat haze would require a post-processing effect if i'm not mistaken?
[/quote]
Yes, as glow shouldn't be a problem but heat haze can be more complicated :)
I am not a pro, more of a begginer, I still am more 'artist' than a graphics programmer :) (hope that will change soon :D )
0

Share this post


Link to post
Share on other sites
I think you could achieve something similar with a rim lighting pixel shader.
You just highlight the pixels that are almost perpendicular to the view direction.
0

Share this post


Link to post
Share on other sites
Okay I found it, sorry it wasn't on the publications page hope I didn't waste your whole night!

[url="http://www.gdcvault.com/play/1014348/HALO-REACH-Effects"]This link[/url] contains the ppt presentation, it's a whopping 433mb so thank goodness for broadband.
An overview of the talk is discussed [url="http://www.beyond3d.com/content/articles/116/1"]here[/url] as well, with the shield stuff on page 3.

Pretty nice ideas about colorizing it with tiny colour palette ramps, and fading out the effect as a function related to the depth buffer.
0

Share this post


Link to post
Share on other sites
Thank you for that presentation! That was great. As it turns out I was on the right way (using vertex normals to push the vertices outwards). I'm working on implementing the fading part of the technique they talk about it the presentation, more specifically this is said:

[quote]To make the character more visible, we sample the depth buffer and fade the shield as a function of the distance to the shell.
So the nearby areas (likely the character) become more transparent, while the farther areas (which are probably the background) get the full effect.[/quote]

The shield here is the enlarged mesh.
The shell means the original model (I assume).

I am well familiar with sampling the depth buffer, but how would I calculate the distance to the shell from my current pixel based on the value from the depth buffer? there is no way (I can think of) to know if the depth value comes from the original model or from another player, a wall, etc. ?
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