Aller au contenu

Photo

Preserving smooth normals across a UV seam?


  • Veuillez vous connecter pour répondre
28 réponses à ce sujet

#1
Rekov

Rekov
  • Members
  • 75 messages

I'm having a weird problem that I haven't run into before where the normals aren't smooth over a seam in the UV map. To be clear, there isn't an edge split in the model itself, just in the UV map. It looks fine in Blender, but in game I get this:

sCdGii.png

 

The cylinder on the left is the same, but rotated 180 degrees about the z axis, so the only thing different about it is where I cut the mesh to unwrap for uv.



#2
kamal_

kamal_
  • Members
  • 5 238 messages

Is that a jetpack?



#3
Rekov

Rekov
  • Members
  • 75 messages

Is that a jetpack?

It might be....   B)


  • kamal_ aime ceci

#4
Rekov

Rekov
  • Members
  • 75 messages

Actually, I may have found the answer myself. There is a "Smooth T/S" seams option. It seems to fix most of the problems, but I'm still getting some weird shading. Probably just the cost of an ancient engine.



#5
rjshae

rjshae
  • Members
  • 4 478 messages

Are there any shading issues being caused by the geometry of your smoothing groups? That's what I usually encounter. Certain smoothed indentations seem to cause it to use different lighting sources (sky, ground, &c.) by varying amounts.



#6
Rekov

Rekov
  • Members
  • 75 messages

I'm not 100% sure what you're getting at rjshae, and it's because I've taught myself a lot of this without ever learning the proper terms for things.

 

So in blender you can set surfaces to smooth or flat, right? I figured out a while back that NWN2 doesn't make that distinction, and reads everything as smooth. To get flat, sharp faces you have to use an edge split, or literally have two separate faces that aren't actually joined, but their edges overlap.

 

The problem I was having here initially was that cuts in the UV (seams) but not actually on the mesh were causing the same behavior as an edge split. Checking the smooth T/S seams option fixes this problem, but also seems to prevent edge split from marking sharp edges as it should.

 

AKrrPZ.png

 

As you can see here, the shading on the cylinders is all obviously off. They're shaded progressively darker as you get progressively closer to the bottom, and the reason for this is that it's trying to smooth the normals from the side of the cylinder to the bottom as if there isn't a sharp edge there. You can see the same thing on the wooden box in the center, especially on the metal frame around it's edge. It isn't being shaded as a flat surface, but as a curved surface.

 

Are smoothing groups something else? If I've been doing it wrong all this time I'll be glad, because that suggests that there -is- actually a solution.



#7
Tchos

Tchos
  • Members
  • 5 030 messages

NWN2 doesn't make that distinction, and reads everything as smooth. To get flat, sharp faces you have to use an edge split, or literally have two separate faces that aren't actually joined, but their edges overlap.
Are smoothing groups something else? If I've been doing it wrong all this time I'll be glad, because that suggests that there -is- actually a solution.

 

It's not true that you need to split the edges, or that NWN2 doesn't distinguish between smooth and flat.  Smoothing groups allow you to specify different amounts of smoothing for any polygons you choose, and if you remove them from smoothing groups entirely, they will be flat. 

 

Select the polygons you want to be smoothed sharply differently than their adjacent faces (such as the edge of a vase that isn't supposed to be perfectly smooth with the rest of the vase), and put them in a different smoothing group (let's say smoothing group 2) than the ones next to them (smoothing group 1), and you'll immediately see them appear to be two separate faces instead of part of the same face.

 

For things that are just supposed to be flat, like the sides of a box, just remove them from smoothing groups.  In Gmax you select the polygons and find the smoothing group button(s) that are toggled on, and toggle them off.

 

I always fuse all points in my objects.  If some aren't fused, smoothing doesn't work properly on them.



#8
Rekov

Rekov
  • Members
  • 75 messages

Oh man, I've been doing it really wrong then, lol. I'll have to see if I can figure out how to do this in Blender. And then go back and clean up a **** ton of my older models. From what I can find though, the equivalent in blender -is- edge splits. Do I have to mark everything sharp to define the smoothing groups, or does it work to smooth faces individually?

 



#9
Tchos

Tchos
  • Members
  • 5 030 messages

I don't use Blender, but I'm almost positive that edge splits are not a Blender equivalent of smoothing groups.

 

I looked at the video, and he's physically separating the polygons to change their smoothing, whereas with smoothing groups you just say "this part is in group 1, and this part is in group 2" and they're still physically connected, but it looks the same.



#10
Rekov

Rekov
  • Members
  • 75 messages

Everything I can find about shading groups and Blender says using an edge split modifier is the only way to come close. I can set everything to flat (1st pic), I can set specific faces to smooth (2nd pic), but I can't actually group different smooth sections apart from each other without using edge split (3rd pic).

 

As far as I know you use blender, right RJ? I'd be curious to hear your take on this. It could be entirely a matter of the export script, actually. The script doesn't know what to look for in Blender when it comes to defining shading groups.

vmiW9A.png



#11
Tchos

Tchos
  • Members
  • 5 030 messages

This is how you do it in Gmax (and 3ds Max).  In Gmax, as you can see here, there are 32 different groups into which you can put polygons (and you can even select polygons by which group you put them in!).  Each of those will be smoothed separately from the other groups, even if they're touching each other and are part of the same fused object.  Blender really should have the same ability without needing to physically split them, but yes, let's see what people who know Blender say.

 

gmax%20smoothing%20groups.gif



#12
Rekov

Rekov
  • Members
  • 75 messages

Well here's the thing, Tchos. Even if blender doesn't actually support smoothing groups, it should be possible to teach the export script to effectively create them as it goes. For example it could be taught to recognize every group separated by edges marked sharp as it's own smoothing group.



#13
Tchos

Tchos
  • Members
  • 5 030 messages

I'm not sure what it does with that information.  I know that something is lost in the translation from Max to MDB, because when I re-import an MDB that I exported, I have to rebuild the smoothing groups, and sometimes I need to re-fuse split points, so I often keep a copy of the models in the Gmax native format for the purpose of preserving the groups if I need to make changes to the model later, rather than importing the MDB.  It's entirely possible that the exporter auto-splits the edges between smoothing groups, if the NWN2 MDB format needs them to be that way.  So it may be that there's really no difference in the final results in these two methods, and only matters while we're editing them.

 

An unrelated thing that's always lost on import is the specular strength of a material.  It's definitely an import issue there, and not an export issue, because when it's set properly and exported, it works correctly in the game, but when it's re-imported from that file the specular strength has been lost.  In that case it seems to be unintended and unnecessary, so I assumed the other behaviour was also unintended.



#14
Rekov

Rekov
  • Members
  • 75 messages

It's an exporter thing. This is for exporting to a different file format, but it demonstrates how you would go about setting the smoothing groups and setting up the export script to read them.



#15
Tchos

Tchos
  • Members
  • 5 030 messages

I'm not sure there are any such export settings in the exporter I'm using.  This seems to be the extent of the settings, since no special panel pops up during the export action.

 

gmax%20export%20settings.gif



#16
rjshae

rjshae
  • Members
  • 4 478 messages

Well here's the thing, Tchos. Even if blender doesn't actually support smoothing groups, it should be possible to teach the export script to effectively create them as it goes. For example it could be taught to recognize every group separated by edges marked sharp as it's own smoothing group.

 

Blender does support smoothing groups; they just aren't preserved during export/import. Since it's a pain to keep re-assigning them, I sometimes just do a "P" to split the selected faces into separate parts for editing purposes, then rejoin them at the end.

 

I'm not sure how hard it would be to implement smoothing groups as an option with the import script.



#17
Rekov

Rekov
  • Members
  • 75 messages

How do I do smoothing groups in Blender, then? Because I can't find the place where I assign different faces to different groups anywhere.



#18
rjshae

rjshae
  • Members
  • 4 478 messages

To me it's a combination of Vertex Groups and Sharp Edges; the first so you can select a set of faces to work with, and the second to modify the surface normal along the edges. There's also an Edge Split modifier that I haven't experimented with (although I make frequent use of the V key to split edges).

 

But I could just be blowing smoke out my arse...



#19
Rekov

Rekov
  • Members
  • 75 messages

To me it's a combination of Vertex Groups and Sharp Edges; the first so you can select a set of faces to work with, and the second to modify the surface normal along the edges. There's also an Edge Split modifier that I haven't experimented with (although I make frequent use of the V key to split edges).

 

But I could just be blowing smoke out my arse...

So yeah, that's what I've been doing, and that's literally what the edge split modifier is doing. It's actually splitting edges so that you have faces that touch each other, but aren't actually part of the same cohesive mesh.



#20
Tchos

Tchos
  • Members
  • 5 030 messages

Which is somewhat different from what Max calls "smoothing groups", since you can have sharp seams and edges between two polygons in a cohesive mesh without splitting them in Max.  I'm guessing it won't make much difference in the final products, though.



#21
Rekov

Rekov
  • Members
  • 75 messages

Even then, I have an edge split at the bottom of those cylinders in my second picture, and the shading doesn't seem to recognize that at all.



#22
rjshae

rjshae
  • Members
  • 4 478 messages

 

AKrrPZ.png

 

As you can see here, the shading on the cylinders is all obviously off. They're shaded progressively darker as you get progressively closer to the bottom, and the reason for this is that it's trying to smooth the normals from the side of the cylinder to the bottom as if there isn't a sharp edge there. You can see the same thing on the wooden box in the center, especially on the metal frame around it's edge. It isn't being shaded as a flat surface, but as a curved surface.

 

My suspicion is that is at least partially the result of the lighting model that NwN2 uses. In the image below, there's a similar effect to yours with the pillar on the left, where it gets darker toward the ground. In the right hand image I changed the ground lighting colors to match the sky, making it much more evenly toned. Can you try that and see if it has any effect?

ground_lighting_zpsuzux12hs.jpg



#23
Rekov

Rekov
  • Members
  • 75 messages

I think you're right, RJ. It looks a lot better with the lighting tweaked. Man, we really need a new game for this crap.

 

HQfxMt.png


  • rjshae aime ceci

#24
-Semper-

-Semper-
  • Members
  • 2 256 messages

Which is somewhat different from what Max calls "smoothing groups", since you can have sharp seams and edges between two polygons in a cohesive mesh without splitting them in Max.  I'm guessing it won't make much difference in the final products, though.

 

imo the electron engine doesn't support smoothing groups and the exporter written for max automatically splits edges at the borders. which would make sense since game engines generally split vertices at uv borders. the more uv islands your model has the more vertices are needed. in generell it's best to use as few uv islands as possible, but you'll need a uv split / edge split where hard edges are supposed to be. it's also important to know that not every uv split demands an edge split - like down the middle of a face, where the mirror axis of the texture is. also try to hide uv splits as best as possible.

 

http://polycount.com...d-vertex-counts

 

it would also be interesting to know to what tanget space the electron engine is synced. i doubt that it's something modern like mikkt. dunno if obsidian baked their maps in 3dsmax6, in zbrush or some other 3rd party program.



#25
Tchos

Tchos
  • Members
  • 5 030 messages

imo the electron engine doesn't support smoothing groups and the exporter written for max automatically splits edges at the borders. which would make sense since game engines generally split vertices at uv borders.

 

That's what I'm coming to suspect during this conversation, but it would be nice if someone could confirm that.  Maybe by checking the export script code?