-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Something wrong with Depth/Parallax Mapping in Spatial Material #15934
Comments
I had the same problem, I thought it was a problem with my parallax maps at first. Good to know there's a workaround for now. |
Looks like parallax also affected by this #16009. I did some tests and I see that different inbuilt geometry (planes, quads) shows different parallax behavior. For example material with fix in test scene from this issue will work for inbuilt Plane, but will not work for Quad and for imported geometry. |
Unfortunately, this fix does not work with all meshes. I wanted to submit a pull request (Calinou@fd54b81) also incorporating changes from #15794, but while it looks good on a cube exported from Blender, it looks broken on the test mesh from the Material Tester demo. |
Tangents are different for various importers/formats and inbuilt geometry. They affect how normal maps and parallax works. I've tried to unify tangents in my fix #16096 (not merged) to match those from Material Tester and to work correctly with OpenGL style normal maps, like in Material Tester. (But maybe something was changed since then?) |
I am not really sure about this because, as mentioned before, it really depends on the application, Maybe options to flip binormal/tangent should be added.. |
After doing a lot of experimenting with parallax maps in Godot, I also could only get them to work using the same method as @wlodeqp , by removing the minus from the binormal code. As noted by @Biliogadafr in #16009 parallax mapping will not work on Godot's native primitives. Also, care must be taken to use an actual depth map with white as the furthest depth, as Substance and other engines/renderers use a height/displacement map which has white as the closest depth. I have attached a project file with 2 parallax materials using the aforementioned steps. Since I posted this on twitter and my website, I have heard no feedback that this approach doesn't work on various hardware configurations. Hopefully this easy fix (removing the negative sign) can be added before 3.1 is released. |
Note that in 3.1 alpha and later, you can invert the color of an image directly in its Import settings without having to modify it manually. I still think it would lead to a better user experience if depth maps were inverted to work like in most other software though. |
I am not quite sure what to do with this one. Technically, it can fail completely depending on the geometry and how it was created, given tangent space is not warranted to be universal. I will add an option to flip x and y in tangent space to make sure it can work with everything, but it needs to be done manually. |
Godot version:
Godot 3.0 RC 2
OS/device including version:
Ubuntu 16.04 64-bit
Issue description:
The default parallax mapping change bump angle when you rotate scene view.
I changed this line of code:
vec3 view_dir = normalize(normalize(-VERTEX)*mat3(TANGENT,-BINORMAL,NORMAL));
to this one (removed minus)
vec3 view_dir = normalize(normalize(-VERTEX)*mat3(TANGENT,BINORMAL,NORMAL))
and it works but I don't know it is real fix.
Steps to reproduce:
Open the project and slowly rotate scene view above the planes
Minimal reproduction project:
Test5.zip
The text was updated successfully, but these errors were encountered: