Advertisement

You're blocking ads, which pay for BlenderNation. Read about other ways to support us.

Parallax Mapping with Nodes in Realtime

20

Parallax mapping (also called offset mapping or virtual displacement mapping) is an enhancement of the bump mapping or normal mapping techniques applied to textures in 3D rendering applications such as video games. To the end user, this means that textures such as stone walls will have more apparent depth and thus greater realism with less of an influence on the performance of the simulation. (Definition from Wikipedia). Mokazon shows how to achieve this effect in the Blender Game Engine.

Mokazon writes:

Hey guys,

I've been working hard on making a way to achieve parallax mapping without using a GLSL shader. Shaders can run slow on older computers, and also some graphics cards dont support them.

I have attempted to do this effect with nodes, and i'm rather happy with the result. I have decided to share the file with you guys so that everyone can use this resource and improve the BGE games.

Features:

  • 10 Layers for extra realism
  • Self shadowing
  • Many options for advanced customization

How it works (in a nutshell) is this: You subtract the Normal output from the UV output of a Geometry node with a math node. That plugs into the vector input of your texture which is then plugged into a mix node. You also plug in a the same texture, although with UV vector, into the lower input of the mix node. Now add another texture node, with the UV output of the Geometry node plugged into the vector input of your texture. On this texture, you will need to put in your parallax/displacement map. The color output of this will plug into the factor input button of the mix node (the gray one on the top). Finally, the mix node outputs into the Output node. I have gone even more detailed and added 10 layers of this to make it look more 3d. I hope all this makes sense.

Here is a video demo to see what it is:

Download here:

http://dl.dropbox.com/u/1860288/ParallaxWithNodes.blend

If you have any questions regarding how it works, or how to customize it, please email me at [email protected]

Thanks!

-Mokazon

20 Comments

  1. That demo is awesome! Is this also called "tessellation"? Because I think I saw it called that when looking at something from Crysis 2

  2. @Ben Tessalation is something you could compare with a subsurf + displace modifier. Tessalation is more dynamic and hardware accelerated, though.

  3. ADEdge (alex) on

    Looks pretty nice. What's the performance like compared to other techniques for getting paralax into bge? I think there's a few scripts around which handel it ok. 10 layers for a texture seems like a lot for bge, that's why I'm asking.

  4. @Aldi - Because you're looking at it wrong. The black parts on the texture sink into the surface while the white parts stick out.

  5. @Tansunn - Yes, that's exactly my point. The white part is supposed to protrude out, right? Shouldn't the darker part be at the opposite direction from the light source?

  6. Nice! So glad to see this done with the nodes. I'm getting a better grip on using the nodes (because they're awesome power I've yet to master), and as an indie game developer, I highly appreciate parallax mapping. The results produced here were nice! Maybe soon, we'll have a parallax mapping feature developed right into Blender based on your good work. Thanks, Mokazon!

  7. Can this be used for ordinary rendering? Does it HAVE to only be used for the BGE? You would think that, making something like this, the first thought would be to use it for CGI, since Blender does not support parallax mapping anywhere. I'm blown away that nobody has even questioned that yet.

  8. @Lange
    I'd assume it works for rendering since it's just texture nodes. Also, parallax may be supported with blender if you use the game engine to render though that is not be ideal

  9. Lange: It works fine for rendering. You might want to tweak the nodes a bit however. You could also make the nodes much more complicated as you're not so worried about 60 frames per second ;) Some of layer lighting could be tweaked, as it might be too bright.

    rorkimaru: they are actually material nodes, texture nodes dont work in bge :(

    everyone else: thanks guys for the feedback, I really appreciate it :D

  10. Really nice, I'd like to see if the lighting would look better with normal maps.
    I guess I'll have to try it, cause the 3d effect is amazing, but the shadows seam to kill the it.

    I'm guessing there's not really any way to break that 45 degree barrier where the effect stops working and the plane looks like a regular texture. If anyone knows of a way, i'm very interested in hearing from you.

Leave A Reply

To add a profile picture to your message, register your email address with Gravatar.com. To protect your email address, create an account on BlenderNation and log in when posting a message.

Advertisement

×