-
Notifications
You must be signed in to change notification settings - Fork 178
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
Parallax Mapping with self-shadowing implementation solution here ? #1009
Comments
Source :Ihor Dykhta – Rendering Engineer (dykhta.ihor@gmail.com) sunandblackcat.com [21 Mar 2013] | Parallax Occlusion Mapping in GLSL This lesson shows how to implement different Parallax Mapping techniques in GLSL and OpenGL (same techniques are used to implement Parallax Mapping in DirectX). Following techniques will be described: Parallax Mapping, Parallax Mapping with Offset Limiting, Steep Parallax Mapping, Relief Parallax Mapping and Parallax Occlusion Mapping (POM). Also this article shows how to implement self shadowing (soft shadows) in combination with Parallax Mapping. Following images depict results of Parallax Mapping techniques in comparisson to simple lighting and Normal Mapping: The main task of Parallax Mapping techniques is to modify texture coordinates in such a way that plain surface will look like 3D. Effect is calculated in fragment shader for each visible fragment of the object. Look at the following image. Level 0.0 represets absence of holes. Level 1.0 represents holes of maximum depth. Real geometry of the object is unchanged, and always lies on level 0.0. Curve represents values that are stored in the heightmap, and how these values are interpreted.
Parallax Mapping and Parallax Mapping with offset limiting
Offset of the texture coordinates is done in the following way. As vector to the camera V is in tangent space, and tangent space is built along gradient of the texture coordinates, so components x and y of vector V can be used without any transforamtion as direction for offset of the texture coordinates along vector V. Component z of vector V is normal component, and it's perpendicular to the surface. You can divide components x and y by z component. This is the original calculation of texture coordinates in Parallax Mapping technique. Or you can leave components x and y as they are, and such implementation is called Parallax Mapping with Offset Limiting. Parallax Mapping with Offset Limiting allows to decrease amount of weird results when angle between vector to the camera (V) and noraml (N) is high. So if you will add x and y components of vector V to original texture coordinates you get new texture coordinates that are shifted along vector V. You have to take into account depth H(T0) at the original texture coordinates. Simply multiply V.xy by H(T0).
The following image depicts how depth value H(T0) from the heightmap is used to determine amount of shift of texture coordinates T0 along vector V. In this case the result TP is wrong, as Parallax Mapping is only approximation that isn't intended to find exact location of intersection of vector V and the surface. The main advantage of this method is that it performs only one additional sampling of the heightmap and this leads to great performance of GLSL shader. Here is implementation of shader function for simple Parallax Mapping:
Here is implementation of Steep Paralax Mapping:
Here is implementation of Relief Parallax Mapping:
Parallax Occlusion Mapping produces good results with relatively small number of samples from heightmap. But Parallax Occlusion Mapping may skip small details of the heighmap more than Relief Parallax Mapping and may produce incorrect results for abrupt changes of values in the heightmap.
Following code snippet contains shader function with implementation of self-shadowing:
|
Parallax mapping will be developed by Blender-BF directly. We will support it. |
the code to apply the self shadow on parallax is joined here ...
Hi, basicly i'm trying to use lamp data node but I can't find a logic way to use it to apply shadow inside shader with parallax mapping...
only baked map shadow inside shader
It is possible to add this soft shadow option ??
in this case if we shade the shadow we need to remove the first real shadow or we have 2 shadow on screen ... but it's to complex for me i'm a simple user not a dev...
Best regards ;)
The text was updated successfully, but these errors were encountered: