Jump to content

I need help in baking a transformed normal map...


Christhiana
 Share

You are about to reply to a thread that has been inactive for 3315 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have been working on a set of modular walkways and I'm having trouble with getting the normal maps on the round corner pieces to work correctly. I'm probably going the wrong way about this and I don't know if what I'm trying to achieve is even possible at all? I'm asking for your input on this because I'm out of ideas and I can't seem to find an answer anywhere.

 

This is the object and the UV mapping of the part in question.

model.jpgmapping.jpg

 

I bought a woodlplank texture on MP which came with normal and specular maps. To get the texture to follow the curve of the round corners I mapped them the way shown below.

texture settings.jpg

 

When I bake the normal map in blender it's the original normal map transformed to fit the object the same way the diffuse and specular texture does. The problem ofcourse is that this way the normals are totally wrong as shown in the image below.

baked normals.jpg

Is there a way to make blender recalculate the normals to be correct for the way they are projected on the object? Or isn't this possible at all? Or is there another way to achieve this?

Link to comment
Share on other sites

As far as I know, this cannot be done in Blender.

However, you might try to use XNormal and a "Tools"-menu. There is a tool called "Object/Tangent space converter".

Maybe you can convert  your very original woodplank normal map into Object Spaced Normal map (using a simple plane mesh fed into XNormal tool) and then start to work with these generated Object Spaced Normal maps inside Blender.

Do all the bakings with Object Spaced Normal maps and finally convert them back into Tangent Spaced Normal map using XNormal converter tool.

I did not make any practical test on this, but I think it might be a good starting point for your problem :)

Link to comment
Share on other sites

D'oh! I just tested same kind of situation..you are right, the normals break in the object space normal map too. Actually, I should have thought a bit more: of course they go wrong because the object space isnt same anymore in the new object and new uv...

I cant figure out any other solution than converting the very original normal map into grayscale bumpmap. Using PhotoShop normal map filter or GIMP normal map tools. Then baking with grayscale bumpmaps and converting them back to normal map using GIMP of PS....

 

 

Link to comment
Share on other sites

You can do what Jake suggests in his last post - convert it to grayscale and calculate a new normal map from that (or draw it by hand, there isn't a lot of detail there). Alternatively, don't use a unique texture set for the corner pieces, but rather use the same as used by the straight sections (so they have the same straight UVs, but are bent in 3d space). This may lead to some distortion of your texture, but this can be mitigated to an extent with extra edge loops. This is often how its done in game development, where additional textures are used only where absolutely necessary.

 

Link to comment
Share on other sites

Thank you both for the input!

 

I tried the method of converting to a height\bump map with gimp but the results are terrible when converting back to a normal map. Also the heightmap had a lot of artifacts.

I also found a website that generates normal, AO and Specular maps from a diffuse texture and gave that a try. The results are quite nice and I think I should be going that route. Generate normal and specular maps from the UV baked diffuse texture. With some experimenting with software that can generate normal maps I should be able to get a good looking result...

Still if anyone knows how to get it done in the way I wanted in the first place...

 

This is the normal map generated by the website:

NormalMap (1).png

 

Doesn't look too bad already in SL:

Snapshot_001.jpg

 

Edit: Here is the link to the site I mentioned: http://cpetry.github.io/NormalMap-Online/

It works best in Chrome.

 

Link to comment
Share on other sites

Thank You. :smileyhappy: 

In this case i would take the points of the UV's of your corner mesh and align them to the beams of the Normal map. The simplest way is to drag the UV points to match the beams on the Normal map. Instead of adapting the Normal map to the mesh, you adapt the mesh UV's to the Normal map. I hope that makes sense.

Link to comment
Share on other sites

That would give about the same result as baking from the normal map texture. The Normal map still doesn't get updated. The edges of the planks will stay pink no matter what angle they are mapped to. It should look more like this one:

NormalMap (1).png

Instead of this:

baked normals.jpg

 

Link to comment
Share on other sites

I tested your method but it gave the same result. The reflections all go to the same side. It's just a lot more work to map the uv's manually. For a correct result the color on the normal map should change when the angle of the plank edges change as shown in the pic in my previous post. With that map the light reflection is working correct. I just assumed that blender would recalculate those, but it seems a texture of a normal map within a material is treated as just a texture...

Link to comment
Share on other sites

I do understand what you mean and I think it should work this way. The tangent space would remain unchanged if I adapt the UV coordinates to the normal map. Maybe I should try this again tommorow when I've gotten some sleep. This has kept me busy all morning/day/night long :P Thank you for your input!

Link to comment
Share on other sites

As I see it, there is a problem with all these solutions because they all cause the pinching together of the woodgrain as well as the tapering of the joining grooves. That affects both diffuse and normal. So I started with a plain woodgrain texture (home made) without grooves (actually, I took one with grooves and copy-pasted strips to cover the grooves), made a normal map from it in GIMP, and applied both diffuse and normal maps to a grooved high poly mesh UV mapped so that the grain was aligned properly. Then I baked texture, ao (normalized) and normal maps from that to a low poly mesh. Made a diffuse texture by multiplying the ao bake with the texture bake in GIMP. Inworld, applied the combined diffuse map, the baked normal map and the ao bake alone as specular map (to suppress reflections from grooves), to the low-poly mesh*. Here is the result, and just the normal map applied to a black prim cube.

circbake_inworld.jpg

Here are the textures used (all reduced sizes). Top two are diffuse and normal maps applied to the high poly mesh. Below that, the results of baking selected (high-poly) to active (low poly) textures, normals and ao. Lastly, the combination of texture bake and ao (multiply).

circbake_maps.jpg

Next, some details of the meshes. Low poly orange, high poly black (they were joined just to make this picture, separate objects for baking). The edges of the high poly were extended to overlap the low poly to suppress some edge artefacts. Both were completely smooth shaded. Top of grooves were bevelled, and extra loops were put next to the bottom edge to keep the angled parts flat.

circbake_details.jpg

Here are the UV maps, simple one for low poly on left. The high poly one shows only half of the segments. The other ones were similar but mirrored vertically. All that is to avoid any two planks getting identical textures. The important point here is the alignment of each plank to the wood grain, which requires them to be separate islands.

circbake_uvs.jpg
So, at least something approaching what you need can be done in Blender, although these are not perfect.

*Interestingly, I found horrible shading problems with the normal maps if this flat low poly mesh wasn't completely flat (SZ0). It looks like thin meshes don't work properly. There were also a few nasties in the grooves if you look too closely. I guess because adding the normals from the woodgrain to that of the groove surfaces sometimes produced some normals pointing into the low poly mesh, which is not allowed. Should probably omit the grain normal from the grooves.

  • Like 1
Link to comment
Share on other sites

Well, the reflections do look correct to me.

CornerPlanks03.jpg

However, if you want the fan style planks, I would recommend to bake your own normals from a highpoly mesh, and creating your own texture set. Will be quicker in the end than trying a thousand things.

  • Like 1
Link to comment
Share on other sites

You are completely right. After some sleep and re-reading RipleyvonD's solution I understood what you did with the UV's. Not changing the normal map but adjusting the uv's to the normal map. I never thought of it that way and will remember this trick for when working with prebaked NM's in the future!

Link to comment
Share on other sites

Thank you so much Drongle for this wonderfull and comprehensive guide!

 

I have been thinking of using a high to low poly bake but I have never done this before and was a bit hesitant to try. I'm going to go this route because the end result looks so much cleaner and more realistic. You're guide has a very clear and simple workflow with a lot of great tips to circumvent some problems I would definetly have run into, like extending the edges on the high poly model and the aligning of the UV islands to the woodgrain.

 

I also noticed the pinching of the woodgrain and normal maps and it gives quite a few artifacts (besides from not looking correct in the first place. The gap between the planks got tapered as well, something you wouldn't expect to see in RL. The woodgrain also got stretched a lot on the outer edges when mapping it the way I did. Your solution to this problem works perfect! I like the idea of starting with a plain wood grain texture. The end result will be a unique texture opposed to a bought and applied one. It will give me a lot more control over the outcome as well.

 

A big thank you to everyone who took the time to respond with all these usefull tips and examples!

This has been a great learning experience and I'm sure I will be a better builder because of it!

Link to comment
Share on other sites

In case anyone is prepared to put up with the tapering/pinching effect, it is also possible to use the selected-to-active bake to transform the prebaked map. In this case, both meshes are identical except for their UV maps. Just duplicate the low poly from before and move one copy up a bit so you can select them in the right order ("from", "to"). Then edit the UV map of the "from" mesh so that it fits the parallel planks.

There is one very important step. If you leave the meshes as they are, the remapping will produce nasty effects because of the unequal triangulation. To avoid that add three levels of subdivision modifier - simple, not Catmull-Clark, and don't apply it. BUT Don't apply the modifier on export - otherwise you will have huge LI. Either delete it before exporting the mesh or uncheck the Apply modifiers option of the exporter.

Here are the pictures. I hope it's clear what they all are. Inworld at the bottom.

simplbake.jpg

Link to comment
Share on other sites


Christhiana wrote:

A big thank you to everyone who took the time to respond with all these usefull tips and examples!


 Your welcome Christhiana. :smileyhappy: 

 


Drongle McMahon wrote:

In case anyone is prepared to put up with the tapering/pinching effect, it is also possible to use the selected-to-active bake to transform the prebaked map. In this case, both meshes are identical except for their UV maps. Just duplicate the low poly from before and move one copy up a bit so you can select them in the right order ("from", "to"). Then edit the UV map of the "from" mesh so that it fits the parallel planks.

There is one very important step. If you leave the meshes as they are, the remapping will produce nasty effects because of the unequal triangulation. To avoid that add three levels of subdivision modifier - simple, not Catmull-Clark, and don't apply it. BUT Don't apply the modifier on export - otherwise you will have huge LI. Either delete it before exporting the mesh or uncheck the Apply modifiers option of the exporter.

Here are the pictures. I hope it's clear what they all are. Inworld at the bottom...

 

 Your baked Normal map came out just right Drongle.  I'm regularly impressed by Blenders modern builds.

Link to comment
Share on other sites


Drongle McMahon wrote:

In case anyone is prepared to put up with the tapering/pinching effect, it is also possible to use the selected-to-active bake to transform the prebaked map. In this case, both meshes are identical except for their UV maps.

This is actually very interesting feature. I have never noticed that Blender really is able to convert tangent basis between two uv-layouts. As I understood your example, you entered the original NM in the texture slot with image sampling "normal map". And after that baked "selected to active" using Bake mode "normals". This does the tangent basis conversion! Amazing : ) Very useful indeed.

Baking normals from hi-poly to low-poly is very clear, but I never thought Blender can do the bake from the NM texture channel too.

Link to comment
Share on other sites


Jake Koronikov wrote:


Baking normals from hi-poly to low-poly is very clear, but I never thought Blender can do the bake from the NM texture channel too.

As far as I can see this is just the usual High to Lowpoly workflow. It doesn't have to be geometry only in the highpoly which will bake down. The neat trick Drongle revealed here is the subdivision trick to minimize the map distortions.

The same can be done in XNormal and 3ds Max for example.

Link to comment
Share on other sites

This was the solution I was looking for in the first place. Good to know it can be done in blender. But I will stick to baking from high to low poly as the result is a more correct texture set. .

But still... I find it odd that this didn't work with a regular normal map bake. Since it works with a selected to active base to me it seems logical it would also work in a normal bake.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3315 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...