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
That demo is awesome! Is this also called "tessellation"? Because I think I saw it called that when looking at something from Crysis 2
@Ben Tessalation is something you could compare with a subsurf + displace modifier. Tessalation is more dynamic and hardware accelerated, though.
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.
In 2:44 and above (the smiley example), why doesn't the shadow cast in the right direction?
wow this is great it's more better than the other one... which is done 2.49 era like
http://www.youtube.com/watch?v=9j9oGMDto2I
@Aldi - Because you're looking at it wrong. The black parts on the texture sink into the surface while the white parts stick out.
Isen´t this like bit mapping? Well it looked cool so cheers.
You're a node sorcerer! This is amazing. Thanks for sharing this.
@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?
@Tansunn - Oh, I get it.. after looking at the smiley image at the top... so it's engraved...
Amazing effect. The nodes setup is huge ! Impressive.
p.o.w.e.r.f.u.l
man the results are exceptional but at the same time node network just gave awe! feeling.
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!
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.
@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
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
Awesome, man!!!!
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.
Has this been upgraded to Cycles 2019?
Thanks
URL to the file is broken.