tweaked parallax mapping with silhouette clipping

Hey guys,
greatel did great job implementing steep parallax mapping to BGE.
It picked my interest to look at other parallax techniques. I am also planning to implement relief mapping in near future…
But first… I noticed that old parallax mapping has a flaw called texture swim - when viewed from sharp angles - textures starts to distort… swim around surface. I kinda fixed that, not sure if i did right, but at least it works.
Also i messed around with UV and i came up with silhouette clipping - cheap technique, but effective.


and a blend.

parallax_silhouette.blend (281 KB)

Mouse/WASD - move/rotate camera
left mouse button - move light along with camera

edit: also done as part for Twilight22 project.
have fun!

wow martinsh very nice as always… keep up good work :yes:
working flawlessly here (onboard nvidia 9400)

looking forward to another parallax mapping techniques… hoping for ‘iterative’ one :slight_smile:

(still can’t believe all those goodies and optimalizations for BGE last weeks… guys I’m stunned, bravo)

I get

Fragment Shader failed to compile with the following errors:
ERROR: 0:25: ‘+’ : wrong operand types no operation ‘+’ exists that take a left-hand operand of type ‘undefined interpolation 2-component vector of float’ and a right-hand operand of type ‘3-component vector of float’ <or there is no acceptable conversion>

Then it repeats it with 0:30, 0:35 and 0:40…

This is some magnificent work! :yes:
I think this is the best parallax shader I’ve ever seen for Blender.

You bonnovasitch XD :stuck_out_tongue: First picture left corner, it even renders it as if it intersects with a high poly model… XD How is it performance wise?

Thanks, this is good reference, and not to mention pretty. Also, thanks for hosting the .blend here, on the forums (makes the downloads easier).

Now, show me a big scene, with real-time global illumination. :wink:

PS: You should really try this in 2.49; there are several deprecation warnings.

Is this really happening, the BGE actually surpasses Blender’s own Internal Renderer on something!?

If this is to be hardcoded, it should not only be for the BGE, but for the Internal Renderer as well, would be a useful trick for Durian.

Cooooool. I’ll have to take a look at the coding and learn the master :slight_smile:

I tested it with various textures and I found an excellent reason why this needs to be hardcoded, you need programming knowledge to change its intensity and you can’t scale the texture in the material settings.

This will be used a lot more if it can be hardcoded into Blender so it’s very accessable to artists who don’t have the time to mess with GLSL code.

Very nice work! But yeah, from a novice point of view, hard coded would be nice and easy(er). :slight_smile:

les contours des briques en relief c’est fabuleux, l’image est littéralement extrudée de sa face, un pur régal!:p:)

the contours of brick relief is fabulous, the picture is literally extruded its face, a pure delight!:p:)

very helpful post… thanks for sharing…

to ops: i know i’m resurrecting an old thread, so shut up.

martinsh: that looks OK, but it’s not parallax occlusion. i found someone else’s parallax occlusion at, however it runs slower than i expected (not sure if this can be avoided or not) and it falls apart at the edges too, just now it’s along the view xy plane, not the UV. i made my own texture to test it, and boy it’s bad at the edges. you know why this might be?

also, i could use a little help adding silhouette clipping to that shader.

Be carefull with this parallax mapping, i try to open the file and when i pressed P, puf, the screen got black and after some seconds my windows informed me that my video card crashed!
Not the martinsh one the linked one by blendmaster.

that’s not the shader’s fault, that’s your graphics driver’s fault. i’ll bet you’re on an intel graphics card, aren’t you?

It doesn’t work on my ATI card. It runs OK ,the planes stay textured and normal-mapped, but no effect occurs. Oddly enough, your earlier “relief map” file did. I wonder what the difference was.

P.S. This Twilight22 is really going to be something, isn’t it? :slight_smile:

pretty sure twilight 22 was called off. and I’m pretty sure martinsh still hasn’t looked at this thread.

That parallax shader worked for me like 2 seconds and then crashed my GPU driver. :slight_smile:
well from what I saw in these 2 seconds, it looked OK.
I see what I can do with the shader to make it work properly and faster.

Also the shader in first post is parallax mapping not parallax occlusion mapping. Both are very different in terms of technique.

i am aware they are different in implementation, but they’re fairly similar in what they do. the only thing that differs in a parallax occlusion from straight parallax is that occlusion deletes pixels that are out of view, instead of just squishing them.

and seriously? your gpu driver crashed? i hope only blender was affected :confused:

seems that i did something wrong…

parallax occlusion mapping = relief mapping
and I did relief mapping a while ago.

GPU driver crashes pretty often for me as I experiment with shaders quite alot and it affects the whole PC, reboot is the only way to recover :).

Anyway: here is “Curved Relief Mapping” shader.

buttons 1 and 2 changes mesh from Sphere to Cylinder