Usage of Displacement Map using PBRs

I took a look at the project files and in your “displacement9.vp” you have a sampler named “displacementMap”:

attribute vec4 position;
attribute vec2 texcoord0;
uniform mat4 view_proj;
uniform sampler2D displacementMap;

varying vec2 var_texcoord0;

void main() {
	float displacement = texture2D(displacementMap, texcoord0).r;
	vec4 displaced_position = position + vec4(0.0, displacement * 0.1, 0.0, 0.0); // Adjust multiplier for displacement strength
	gl_Position = view_proj * displaced_position;
	var_texcoord0 = texcoord0;
}

In order for the program to work you also need to add the corresponding sampler to “displacement9.material”:

As soon as you add a sampler to a .material file it will show up as a new property in the properties view of any model which uses the material. In your case it is the “PlaneMesh.model”:

3 Likes