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

Materials Blending a'la UDK

8 posts in this topic

Hey,

I've just stumbled upon an interesting video showing off materials blending in UDK (http://www.3dmotive.com/training/udk/advanced-mesh-paint-with-udk/) and I was wondering how such an effect could be implemented.

There are two ways that this could be accomplished I can think of.
First is to render the mesh twice and use alpha blending. One mesh would be rendered on top of the other one with alpha blending turned on.
The second way would be to render mesh once, with both materials computed in a single shader and lerped at the end. That would however require some materials generation system.

Which solution do you think UDK uses? Does it render mesh twice, or does it use its internal material system to combine component materials?
0

Share this post


Link to post
Share on other sites
Neither, it's all the same material. You're really just dinking with opacity values and shader constants to create variety.
0

Share this post


Link to post
Share on other sites
Are you completely sure of that? An artist told me that he could blend separate materials in UDK and asked me if I could do the same in Unity. Of course, "material" is quite a high-level concept which differs in UDK and Unity, so I was wondering how this could actually be done technically in UDK.
0

Share this post


Link to post
Share on other sites
I'm not sure how Unreal implements it, but in our engine we do all of the material layer blending in a single pass. To make it nicer for the artists the tool supports having a layer derive its properties from a separate material, and then we build a shader with all of the seperate material properties specified for each layer. This obviously requires some pretty complex tools and build pipeline support.

IMO this is really the only way to do it, because rendering in multiple passes is expensive. It also prevents you from blending together the material properties from multiple layers...for instance a lot of times you want to blend the normals from multiple layers and [i]then[/i] apply lighting to the surface (imagine a layer of water running over some bricks). With deferred rendering you can blend G-Buffer properties, but of course only if your G-Buffer uses blending-friendly texture formats and packing. And of course you have to blend multiple render targets, which may not be very cheap. Edited by MJP
1

Share this post


Link to post
Share on other sites
[quote name='MJP' timestamp='1337194707' post='4940733']
I'm not sure how Unreal implements it, but in our engine we do all of the material layer blending in a single pass. To make it nicer for the artists the tool supports having a layer derive its properties from a separate material, and then we build a shader with all of the seperate material properties specified for each layer. This obviously requires some pretty complex tools and build pipeline support.

IMO this is really the only way to do it, because rendering in multiple passes is expensive. It also prevents you from blending together the material properties from multiple layers...for instance a lot of times you want to blend the normals from multiple layers and [i]then[/i] apply lighting to the surface (imagine a layer of water running over some bricks). With deferred rendering you can blend G-Buffer properties, but of course only if your G-Buffer uses blending-friendly texture formats and packing. And of course you have to blend multiple render targets, which may not be very cheap.
[/quote]
What about shader instructions or textures limits? For instance, in our engine we right now have quite a simple shader that blends 4 diffuse maps. If we added normal maps that is as much as 8 textures (not counting others, like shadow map[s?]). I don't remember exactly the limits for this in Shader Model 3.0 for instance, but that is quite a lot of texture data to sample in a single shader. A good thing about that is that we could afford many ALUs without sacrificing much or any performance :).
0

Share this post


Link to post
Share on other sites
To get around blending 8+ textures (or at least get around the increasing performance hit for such) more people are going for baked blending using Megatextures. All your blending baked into one texture, a good trade off between performance and disc space if you've got the latter to spare.

Of course I wouldn't consider this a silver bullet. Odds are digital distribution will become momentously more popular for the next generation of consoles, and the less disc space you use the easier it is for people to get. Edited by Frenetic Pony
1

Share this post


Link to post
Share on other sites
[quote name='maxest' timestamp='1337196726' post='4940738']
What about shader instructions or textures limits? For instance, in our engine we right now have quite a simple shader that blends 4 diffuse maps. If we added normal maps that is as much as 8 textures (not counting others, like shadow map[s?]). I don't remember exactly the limits for this in Shader Model 3.0 for instance, but that is quite a lot of texture data to sample in a single shader. A good thing about that is that we could afford many ALUs without sacrificing much or any performance [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img].
[/quote]

SM3.0 is limited to 16 textures. I don't remember the instruction count limit, but I think it's in the thousands and you could possibly get around it using loop instructions. Either way I don't work on SM3.0 platforms, so I'm not too worried about that. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

If you want to look at it from a performance point of view then blending in the shader is always going to win. With multiple passes you end up doing the same amount of work per-pixel, except you have to pay for alpha blending and processing/rasterizing your triangles for a second time.
0

Share this post


Link to post
Share on other sites
[quote name='Frenetic Pony' timestamp='1337200950' post='4940758']
To get around blending 8+ textures (or at least get around the increasing performance hit for such) more people are going for baked blending using Megatextures. All your blending baked into one texture, a good trade off between performance and disc space if you've got the latter to spare.

Of course I wouldn't consider this a silver bullet. Odds are digital distribution will become momentously more popular for the next generation of consoles, and the less disc space you use the easier it is for people to get.
[/quote]

Yeah that is one of the really nice things about unique virtual texturing...it must be nice to not have to use vertex painting or decals to get some surface variety. Personally though the combination of LOTS of disc space + crappy runtime texture compression + lower peak texel density aren't very appealing.
0

Share this post


Link to post
Share on other sites
[quote name='maxest' timestamp='1337191364' post='4940714']
Are you completely sure of that? An artist told me that he could blend separate materials in UDK and asked me if I could do the same in Unity. Of course, "material" is quite a high-level concept which differs in UDK and Unity, so I was wondering how this could actually be done technically in UDK.
[/quote]
No, for realz. There may be other approaches, but the specific materials used in the video you linked to were all designed explicitly to support vertex color-based blending. Unreal lacks the concept of multipass rendering for materials outright.

EDIT: In fairness, I think lighting is done multipass, but this is not something you work with as an artist. The material compiler generates a lightmap-lit shader for 'ambient' and point light additive shaders. Edited by InvalidPointer
1

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