The game I am working on allows the player to read and create magic books. Because of this, I decided it would be useful to create different effects that look liked they were happening on the book's pages.
To do this I needed a normal map. I figured a book would not be too hard to model so I made this model in blender.
Book Model |
The model didn't have to be perfect, because I only need it to render a normal map viewing it from the top.
Normal Map |
Everything that I wanted to appear on the pages I put on a separate layer, that I will be referring to as the page layer. This way I could render that layer with a separate camera. I ended up rendering that to a render texture that was applied to a quad that I put over the book. I could go over the distortion effect but it's basically copied straight from here. So credit to Alan for that tutorial and all of his other ones, they are definitely worth checking out if you haven't. A tldr is that a shader uses the normal map of the book to distort everything on the page layer to be bent to the book. I also add some stencil buffer stuff so that things on that layer would be masked by the shape of the page.
Eventually I want to experiment with particle effects and more shaders to try to make it look like some magic is happening on the pages.
Great
ReplyDelete