• 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

How should I do environment reveal/texture blending?

2 posts in this topic

At the moment I am trying to research possible ways to go from a solid black screen and then slowly reveal/hide the world to the player. This is not a short fade in at the end of a load but would take place over the length of a "round" which would be anything from 1-20minutes long. It would also need to be quite stylistic, allowing for highly creative reveals. Imagine a model transitioning from a wireframe into a fully textured model, only it doesn't just transition from bottom to top but instead, text is slowly written or paint splatter marks are projected to reveal the texture of the model. I guess it's something along the lines of multi-texture blending similar to what is done with terrain but I'm not positive, maybe masking? Anyway...

At the moment I have 2 or 3 different ideas that are floating around in my head.

1; UV map the environment and have a regular colour texture but also have a greyscale reveal texture (Revealing the colour texture underneath), black areas would be visible immediately and then whiter areas would slowly get revealed as the game progressed. This could allow for all sorts of creative reveals. The problems I currently see with it is that I don't know if there would be discontinuity between different parts of the UV map. Also it mean a full extra texture for each environment, but I think this is reasonable and the bit-depth of the greyscale can be knocked down a little if needs be.

2; If the camera is static, then the reveal could be done in screen space but I think this would not give the most convincing effect overall. It would be good for screen transitions etc that are quick but not for a long reveal. Perspective would be quite hard to deal with. Although I suppose if the camera was static then I could take the first approach to generate the reveal texture and then take a 2D snapshot of the environment with the reveal texture to generate a screen-space reference which should save on memory, but restricts us to a static camera.

3; Do a geometry check for distance/intersection and then manipulate the edges of this using some reference image to match the concept style.

I'm avoiding a straight-up programmatic approach for now as an artistic approach would provide a much better feel.

I'm trying to find material and reference to better illustrate what I'm talking about but I'm having a hard time doing so.
Something like the following but without the bouncing/animated effects, just the spreading; [url="http://www.youtube.com/watch?v=uM9zNt8BJ-Q&feature=related"]Youtube[/url]
Or picture Peter Parker being taken over from Venom, Predator going from visible->invisible, etc.

If you have any references, papers, articles, videos or know the official name of the technique I'm trying to describe that would be great. I hope that I've done a reasonable job describing what I'm trying to achieve so if you have any suggestions then I would be glad to hear them.

Share this post

Link to post
Share on other sites
Well, you're mentioning several effects that can't be made with just a single shader. But as for the fade-in / out and the likes --> post-effect shaders are your friend.
1- Just render everything as usual
2- Take a snapshot of your results, OR, render step1 into a Texture (see renderTargets or FBO's) instead of directly on the screen
3- At the end, render a screen-quad (quad that fills the screen, exactly in front of the camera)
4- Apply a shader on this quad, and pass the snapshot/texture from step 2 as a parameter.

In the step4 shader, you can blend between the original screen contents(step2) and practically anything else. A black color, or another image. But you can also
- blur
- (Sobel) edge detection (requires an extra step that renders depth or positions into a texture)
- contrast / saturation / color enhancement

Just to name a few. For the more advanced stuff such as a model going from [b]wireframe to full-shaded[/b], you may want to render the scene multiple times:
1- render the normal scene to texture A
2- render the wireframe scene to texture B
3- apply screen quad with post effect shader that mixes between texture A and B depending on an elapsed time parameter
* Eventually render a texture C that contains the elapsed time per surface / object / pixel so you can blend the objects on different timings

[b]The Youtube movie[/b] is yet something different again, as it is animated. A simple fade-in is not sufficient. What you could do (but this is pretty damn difficult to draw) is using the alpha channel to create a time-offset.
1.- Draw a texture A (the static part that doesn't change)
2.- Draw a (eventual transparent) overlay texture in its final shape
3.- Fill the alpha channel of texture 2 with a time offset. Black values means this pixel is directly visible, white value means the pixel becomes visible at the end of the movie. Gray values is everything in between.
4.- In the shader:
color.rgb = staticTexture.rgb + overlayTexture.rgb * ( currentElapsedTime > overlayTexture.a );

However, this is difficult to draw(for the artist), plus 32bit images only have 256 variations on the alpha channel so it won't work for longer animations (or very chunky). This can be improved by using 16-bit textures and eventually let a program compute the alpha values, but still...

A smarter way might be using some sort of floodfill that evolves step by step. In a background process, you must "expand" a texture with a few pixels each cycle:
1.- use the final version of the image as a reference paramter for a shader that does sort of a floodfill
2.- start with an almost empty texture. Fill in the lines/colors/shapes you like to start with --> pass a first version texture your artist draws
3.- render a screenquad to a renderTarget / FBO. This shader copies values from his neighbor pixels, but only if they are also filled in the reference texture from step 1. Eventually only copy the pixel partially so it takes multiple cycles before the target color is reached.
4.- Repeat step 3 until all pixels are filled. Do not clear the texture!

I would advise you to study:
- shaders
- image effects (take a look at the filters in photoshop for example)
- renderTargets / FBO's
- Rendering extra data in renderTargets / FBO's such as depth or other custom parameters
Once you master these 4, you can go banana's :)


Share this post

Link to post
Share on other sites
Cheers Rick,

While I'm not a master I have a good grip, both theoretically and practically, on all of the methods you've mentioned. I guess I was just looking for some suggestions as to how I could approach the problem and your post has certainly pointed out some new things for me to think about so thanks for the post, it's very much appreciated!

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