Can I use a normal map to deform/reshape an actor's mesh?

Hello everyone! I am trying to create my own custom low-poly planet meshes for a solar system project. I want to try using a normal map to deform or shape each planet’s static mesh. I have the normal maps I want to use, but simply creating a material that plugs the normal map into the “Normal” pin doesn’t seem to actually change the shape of the planet sphere. Is there a way to do this using a normal map?

Why not? The texture is just information, it’s all in how you choose to interpret it.

Normal-maps are intended to be the facets of a surface, small details, but use it for something else if you want to.

In my landscape material, I have a macro normal I blend to at distance, but being the stickler for accuracy I am, I also want those nice deep crevaces I see in the distance to still show up close.

SO! I take the z-channel of the normal, and treat it like a heightmap that I can then add into my deformation math.

Do anything you want to if if makes sense for your project.

As for where you want to plug it in, try World Position Offset. The normal channel is used for lighting, and te WPO channel is used for deformation (offsetting the vertices).

Be sure to multiply the maths by the VertexNormalWS to make sure it’s properly-aligned with the surface. And heads up, I wouldn’t expect a straight-up plug-n-play and have it call come out nice. The normal map is intended for lighting so it might not translate directly to height/offset information. You might need to do a little math there…

2 Likes

Hi @Frenetic, thanks for your reply! Yeah, that’s the problem I’ve been running into, the normal map alone isn’t deforming the mesh. I’ve tried a few things, but it’s all turning out the same. I’m not entirely sure what kind of math goes into deforming the mesh. Is there an example out there I could use as a reference?

Here’s a quick reference how how to displace something with a texture-map: How2Displacement - Album on Imgur

What’s going on is that the black/white map (heightmap, or your Z-channel) is being treated as height information, like an elevation map. This is multiplied/LERP’d across some value(s) so that you can set black as 0 elevation and white (1,1,1) as whatever value for peak elevation, or whatever you need to push to.

This is then multiplied by the VertexNormalWS so that it’s pushed along the direction of the surface. This gives the push directionality vs just being a value.

Plug that math into World Position Offset so the vertices of the mesh can be deformed in that/those directions.

However, you need a fairly tessellated mesh, something with a lot of vertices b/c deformation is only on the vertex/vertices, not per-pixel. This is why enabling tessellation is desirable as the engine can insert ‘extra’ vertices and take a relatively low-poly mesh and buff it up.

However, I’d recommend against using the tessellation too-too much. It can be expensive, as well as in Unreal 5.0, deprecated (too many challenges to maintain vs the advantages that Nanite gives us).

I’d recommend making a base mesh, sphere, which already has a decent number of vertices so you don’t have to enable tessellation at all.

Go into the editor, add a sphere-mesh, make sure you bump up the resolution. Right-click on the mesh in the viewport → convert to static mesh and bingo! Apply your material to this guy and you can start working on it.

1 Like