armory3d / armory

3D Engine with Blender Integration
https://armory3d.org/engine
zlib License
3.08k stars 316 forks source link

[$100 Bounty] Parallax Occlusion Mapping #2609

Open Naxela opened 2 years ago

Naxela commented 2 years ago

A working implementation of Parallax Occlusion Mapping (POM) with self-occlusion/self-shadowing will release the bounty of $100 on Bountysource.

Suggested implementation (Optional):

Implementation material (Inspiration):

Bountysource Link: https://app.bountysource.com/issues/111898135-100-bounty-parallax-occlusion-mapping

Simonrazer commented 1 year ago

Hi! I tried doing this, but Im not able to finish it all the way. I'll share the status here: Not implemented are Self-Occlusion and Shadowing.

I first made a custom shader for parallax, then then exposed this Mapping using a new Material node: grafik

The Shader works almost perfectly, but it shows some glitches when viewed at from steep angles. I dont know why. To get it to work I had to force Armory to export tangents for all Meshes. It does not let you turn this on for Custom Materials (change in exporter.py) https://youtu.be/zv1MGA2F9Hk

The Node works as stated the exact same way. But it is really broken. I can't figure out why, the closest I am is that globalPixelDir seems to bounce to another value when moving the camera in the Node version, but not in the shader. grafik

Also, using a normal map as shown in the first picture makes Armory crash very frequently. I have no idea weather this is because of my Node.

The parallax-occlusion-mapping logic is adapted from https://learnopengl.com/Advanced-Lighting/Parallax-Mapping , an amazing site!

My fork of armory, with the exporter-"fix" and the new Node: https://github.com/Simonrazer/armory A testing .blend, including my Shader: ParallaxTestin.zip

If this is usefull for anyone to finish this bounty, please use it! A small cut would be very appreciated ^^