Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8633425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:29:19+00:00 2026-06-12T09:29:19+00:00

Summary I’m trying to apply a displacement map (Height map) to a rather simple

  • 0

Summary

I’m trying to apply a displacement map (Height map) to a rather simple object (Hexagonal plane) and I’m having some unexpected results. I am using grayscale and as such, I was under the impression my height map should only be affecting the Z values of my mesh. However, the displacement map I’ve created stretches the mesh across the X and Y planes. Furthermore, it doesn’t seem to use the UV mapping I’ve created that all other textures are successfully applied to.

Model and UV Map

Here are reference images of my hexagonal mesh and its corresponding UV map in Blender.

Hexagonal Model and UV Map

Diffuse and Displacement Textures

These are the diffuse and displacement map textures I am applying to my mesh through Three.JS.

Hexagonal Diffuse and Displacement Textures

Renders

When I render the plane without a displacement map, you can see that the hexagonal plane stays within the lines. However, when I add the displacement map it clearly affects the X and Y positions of the vertices rather than affecting only the Z, expanding the plane well over the lines.

Hexagonal Plane Renders -- With & Without Displacement Map

Code

Here’s the relevant Three.js code:

    // Textures
    var diffuseTexture = THREE.ImageUtils.loadTexture('diffuse.png', null, loaded);
    var displacementTexture = THREE.ImageUtils.loadTexture('displacement.png', null, loaded);
    
    // Terrain Uniform
    var terrainShader = THREE.ShaderTerrain["terrain"];
    var uniformsTerrain = THREE.UniformsUtils.clone(terrainShader.uniforms);
    
  //uniformsTerrain["tNormal"].value = null;
  //uniformsTerrain["uNormalScale"].value = 1;
    
    uniformsTerrain["tDisplacement"].value = displacementTexture;
    uniformsTerrain["uDisplacementScale"].value = 1;
    
    uniformsTerrain[ "tDiffuse1" ].value = diffuseTexture;
  //uniformsTerrain[ "tDetail" ].value = null;
    uniformsTerrain[ "enableDiffuse1" ].value = true;
  //uniformsTerrain[ "enableDiffuse2" ].value = true;
  //uniformsTerrain[ "enableSpecular" ].value = true;

  //uniformsTerrain[ "uDiffuseColor" ].value.setHex(0xcccccc);
  //uniformsTerrain[ "uSpecularColor" ].value.setHex(0xff0000);
  //uniformsTerrain[ "uAmbientColor" ].value.setHex(0x0000cc);

  //uniformsTerrain[ "uShininess" ].value = 3;
  //uniformsTerrain[ "uRepeatOverlay" ].value.set(6, 6);
    
    // Terrain Material
    var material = new THREE.ShaderMaterial({
        uniforms:uniformsTerrain,
        vertexShader:terrainShader.vertexShader,
        fragmentShader:terrainShader.fragmentShader,
        lights:true,
        fog:true
    });
    
    // Load Tile
    var loader = new THREE.JSONLoader();
    loader.load('models/hextile.js', function(g) {
      //g.computeFaceNormals();
      //g.computeVertexNormals();
        g.computeTangents();
        g.materials[0] = material;
        
        tile = new THREE.Mesh(g, new THREE.MeshFaceMaterial());
        scene.add(tile);
    });

Hypothesis

I’m currently juggling three possibilities as to why this could be going wrong:

  1. The UV map is not applying to my displacement map.
  2. I’ve made the displacement map incorrectly.
  3. I’ve missed a crucial step in the process that would lock the displacement to Z-only.

And of course, secret option #4 which is none of the above and I just really have no idea what I’m doing. Or any mixture of the aforementioned.

Live Example

You can view a live example here.

If anybody with more knowledge on the subject could guide me I’d be very grateful!

Edit 1: As per suggestion, I’ve commented out computeFaceNormals() and computeVertexNormals(). While it did make a slight improvement, the mesh is still being warped.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:29:19+00:00Added an answer on June 12, 2026 at 9:29 am

    In your terrain material, set wireframe = true, and you will be able to see what is happening.

    Your code and textures are basically fine. The problem occurs when you compute vertex normals in the loader callback function.

    The computed vertex normals for the outer ring of your geometry point somewhat outward. This is most likely because in computeVertexNormals() they are computed by averaging the face normals of each neighboring face, and the face normals of the “sides” of your model (the black part) are averaged into the vertex normal calculation for those vertices that make up the outer ring of the “cap”.

    As a result, the outer ring of the “cap” expands outward under the displacement map.

    EDIT: Sure enough, straight from your model, the vertex normals of the outer ring point outward. The vertex normals for the inner rings are all parallel. Perhaps Blender is using the same logic to generate vertex normals as computeVertexNormals() does.

    vertex normals

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Summary I am after some advice on the easiest way to analyze simple data
Summary: I'm having some svn trouble, and after debugging it for a while, I'm
Summary For some reason, git commands don't work the same when I am logged
Summary: I'm trying to write a text string to a column of type varchar(max)
Summary: We're having problems with EF4 query compilation times of 12+ seconds. Cached queries
Summary: exporting pixel data from NSOpenGLView to some file formats gives incorrect colours I
Summary When I execute a very simple program using Perl's Benchmark utility. I get
SUMMARY: an embed with 100% width and height pushes its parents size to be
Summary: I am trying to determine the easiest way to mask the output of
Summary : I want to do some basic error-handling Problem : When I step

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.