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.
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…
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.
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.
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.
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.
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).
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!
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.
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