Weird seams around normal map when placed on a plane.

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  10 October 2012
Weird seams around normal map when placed on a plane.

So I am trying to create sprites from models, rendering them both as diffuse textures and then with a Normal TexMap to extract normal maps from the object. However I've run into a rather annoying issue. When moving lightsources around, parts of the normal map that should be dark always have a white outline which I can't fix.

Here's an example and my workflow:

Edit: Please note that these spheres are not the models I'm working on. I did not want to post them so I simply created a simple example to show the issue I'm having. These renders are only made for this post.

1. First I create a model (for this example, 3 spheres)

2. I then apply "Normal TexMap" material to them and render. That gives the following results:

3. I apply the normal (pictured above) and opacity maps to a plane and add a lightsource and move it a little bit to one side like so:

4. The results are this:

Note the bright outline on the right side of the spheres. How can I get rid of it? I've tried playing with different filters, turning AA down and up, the blur in the "coordinates" tab of the normal map. I've even changed renderers with no luck yet.

I'd appreciate if someone could give me some points on how to get rid of those seams or even just pointing me to a better workflow to create "sprites" from 3d models.


Last edited by l3ftnut : 10 October 2012 at 07:10 PM.
  10 October 2012
Thanks for the reply RobinB.

I'm not sure if my links in the previous post didn't work but the normal map I'm using is the second picture I posted. I apologize if the pictures did not work or if I wasn't clear enough. Here it is again (hope it works):

I seem to have accidentally saved it for this example with alpha background. However that is not the issue as far as I know. I have tried to both save the picture without alpha enabled and changing the background colors in Photoshop without any change.
  10 October 2012
I saw it before, but I can't see it now. I couldn't tell if that was the actual map or not with the alpha channel. If there is an alpha channel in the map, is the transparent bit flat blue? I wonder if pre-multiplied alpha is causing problems.
  10 October 2012
You probably need padding in your normalmap.
Also png might be a problem if that's the very map you are using.
  10 October 2012
Thanks again RobinB.

Hmm.. I think the transparent stuff is black. I tried changing the background to the more common blue in photoshop, without any luck. Example here:

When I disable the alpha channel, the rendered background is black. However the problem remains. Example:

The weird "edge" is always the same. Could it be the format? I only use .PNG.
  10 October 2012
Thanks for the reply Noren.

Ofcourse I should have tried a different format. I was in fact using PNG's for everything. I will try to use a different format when I get home and see if that helps.
  10 October 2012
Theoretically one non premultiplied alpha .tga with black background should be fine.
Your alpha will be anti-aliased and your color information (for the normals) will be aliased, giving you all the data you need.
When applying your texture you can choose which channels Max will read out, if it it's a premultiplied alpha, if it should use the alpha, if it should be filtered and so on.

Depending on the filtering and how Max handles that exactly, you might still need to enhance the borderpixels of your normalmap, though. No matter if black or blue, if Max decides to sample from a pixel outside your blobs, it will look wrong.

If you use render to texture to render from a plane instead of the usual way you can choose to add "padding" right away. You'll have to render your anti-aliased alpha in a seperat pass, though, if I recall correctly. )
Or you could use some script in Photoshop or a similar program for it. (Edge dilation is another term for it that might come in handy. xNormal comes with a script/plugin like this, for example.)

Last edited by Noren : 10 October 2012 at 08:31 PM.
  10 October 2012
Thank you again!

Alpha channel is not a requirement for what I'm trying to do. It was simply a mistake from my side, I forgot to uncheck the alpha option when I did the rendering for this thread. I did not notice it until after I had posted.

You have given me some ideas which I will play with tonight and hopefully everything goes well.

Are there any known problems with the PNG format which could be causing this? Or more specifically, the way 3dsm creates PNG images?
  10 October 2012
I would stay away from PNGs with alpha. I know that photoshop fills fully transparent pixels with pure white, regardless of what colour they were before bringing them in. Max might do the same. And that might cause this sort of problem. Bake your map to an opaque texture with the mid blue background (shouldn't matter which format then) and keep the alpha on a separate texture and see what that looks like.
  10 October 2012
Thanks guys! I think I've found the problem thanks to the both of you.

Basically when I'm saving PNG's from 3dsm, edges seem to get anti aliased (I'm not sure if that's the correct term for what's happening) however images in Targas format do not. I can convert the Targas to PNG in photoshop without the edges getting smoothed out and they'll work fine as normal maps.

It seems that just PNGS saved from 3dsm itself are causing the issue. I wonder if there's any way to disable the smoothing from happening when you save a PNG from 3dsm?

Here's a close up of the edges. In case the above picture isn't working here is a link:
  10 October 2012
What's the black around the object? That should be mid blue (127,127,255). Black is an invalid colour for tangent space normal maps so if some of that bleeds through you will get artifacts.
  10 October 2012
Thank you RobinB. I really appreciate your help.
I will change the background to the midblue color.

I'm still wondering though if the smoothing/anti aliasing that 3dsm does when saving .pngs can be avoided?
  10 October 2012
Originally Posted by robinb: Black is an invalid colour for tangent space normal maps

Not necessarily. It basically just means the surface is pointing away from us. (Good for translucency effects for example. )
(127,127,255) points towards us and is closer to the average color of your usual normalmap, but to avoid artifacts altogether you need padding.

Last edited by Noren : 10 October 2012 at 11:43 PM.
  10 October 2012
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 01:58 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.