Parallax Occlusion Mapping node shader v1.1

Have you ever wanted to use parallax mapping in the vanilla BGE? are you sick and tired of people telling you to use UPBGE? Well here is this node shader that you can use instead! (You should totally be using UPBGE though)

I made it myself using my own method. I literally have a bunch of pieces of paper full of scribbles about how this is suposed to work on my desk right now.

This was made in v2.77 but i don’t see why it wouldn’t work on newer or older versions of Blender.


Let me know if you plan on using this shader or the textures, and credit me if you do.

Enjoy :wink:

version 1.1
Parallax Occlusion Mapping node shader.zip (541 KB)

version 1.0
Parallax node shader.zip (535 KB)
Previous version was based off this post.

2 Likes

I have a question, is UPBGE’s graphic handling better than normal BGE, or is it just better at the code and logic? I still use normal BGE as I haven’t gotten into a situation where I want something that only UPBGE can do. Unless UPBGE can set the normal of entire polygons, and not just vertices…

This is for normal BGE, right?

This is indeed for normal bge.

I am not sure how upbge “handles” graphics better than vanilla bge, i know for sure that the standard material is vastly superior though, it has stuff like subsurface scattering, parallax mapping and tons of neat features

By the way, this new version is basically a full remake, the way it used to work before was no good.

So basically UPBGE is better than BGE in everything?

It’s a really great effect but it has some serious issues near edges. The texture wraps around so you can see the other side.
I guess this is a drawback of parallax occlusion though… You’d just have to be careful where you use the effect. Avoid edges.

I get framerate 15 when i look at it upclose.On our hwelett packard desktop.When i look at it faraway it is sixty.That is crazy.

Upbge have optimized raster and clean code base, plus new features. So Upbge should be faster. My tests show it too. The new upcoming version have some more bug fixes and optimizations, as a result the animations are now faster. Some bge users have different results. Would you test the static batching features as you can see from this forum thread; link to my post -> https://blenderartists.org/forum/showthread.php?417598-Need-Help-about-the-Mesh-Batching-feature-of-UPBGE&p=3162539&viewfull=1#post3162539

It really shouldn’t, since I’m pushing the textures out instead of inwards, making it imposible to see textures from outside the UVs, this does mean that high parts will get clipped near the edges, but textures should not be flowing in from outside UV space.

EDIT: I did some testing and saw what you meant. Sadly, it seems this can’t be fixed. making textures pushed out will have clipping on high parts on edges away from you and uv inflow from high parts on edges near you. Making textures seem pushed in will have clipping on low parts on edges near you and uv inflow on low parts on edges away from you. You’re right it is a issue that’s an inherent part of POM.

Yeah, it’s a pretty expensive effect. It does a lot of texture samples and some matrix math, not heavy operations when done just once but it does stack up.

Is it my imagination but is this is a renderer within a renderer?

That would be a bit of an overstatement but i guess you could say that. I did my best to emulate a raycaster within this shader, but it doesn’t have the complexity to be called a full on renderer.

Nice work!

You can skip the double material approach all together, and replace the normal output you use for the cross product with a tangent space normal mapper node with a fixed color like you do in the normal map sample. You could also improve it a bit by having a floor in the middle of the height sample, so you push both “up” and “down”, at half the scale. Something like: height * Scale - (Scale * 0.5).

Keep it up!

The point of using two materials instead of a normal map node is having some backwards compatibility :P.

I guess having 0.5 be the ground point could be a good idea. I have some exams coming up so i can’t implement that right now but I’ll make sure i get it done eventually!

i test it and works pretty well … :cool:
I like it !!!

Come on…

This shader is good, but compared to the GLSL shader, it is too demanding on the resources of the computer.

parallax.blend (834 KB) - This is real parallax, if anyone had added an AO map and/or a lighting map - it would have been cool! About the shadow, I will not say …

@Nick Manchul i never claimed performance was any good haha. All i said is it works. If I find the time, energy, and will I’ll give turning this into a script material a shot

  • Come on man, I did not come from the standpoint of condemnation, but the statement of facts. Neither negativity.:yes:
    If you understand the shader language, write a script - so does the Blender community? Someone will do something, and share with everyone. I, too, have already brought a little into the common cause.

Can it works with cycles render? I’d like to use it with :confused:

You would have to tweak some stuff and the material won’t be shadowed properly (since this isn’t actual displacement) but yes, if you know your way around nodes you should have no problem adapting to cycles

Could we see a setup in Cycles, please?

No, sorry. I’m not interested in doing that. You should give it a shot, though.