Smoothing Issue

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

Smoothing Issue

Postby Tyion » Wed Aug 06, 2008 6:04 pm

So I exported my first Age into blender today /cheers! and big thanks to Kato for the help he gave! :) But now I am faced with an issue, I linked into my Age of white and black and found that URU had well (smoothed all of my mesh's, this in turn made everything look (Icky) shall we say. So my question is, how do I stop this from happening?

Thanks much

Tyion
Tyion
 
Posts: 126
Joined: Fri Dec 28, 2007 2:52 am
Location: In the land of Hyrule!

Re: Smoothing Issue

Postby Jojon » Wed Aug 06, 2008 10:27 pm

You kind of don't... Smooth meshes is what we have by default (I don't believe flat shading is an option at all) and furthermore, Plasma shading uses not the face normals, but the vertex normals. I.e. at a 90 degree corner, both adjacent faces point the same way, 45 degrees from their actual normal.

To "fix" this, you can break the mesh apart. I.e. if you have a cube that comes out "overshaded", you separate its six faces, so that each have private copies of their four respective vertices, rather than them all sharing eight. You can do this by selecting a face (or a group of faces, for more complex flattish shapes) and pressing the "Y" key.

A better way, is to set edges, where you have sharp angles, to "hard edges" and apply the "EdgeSplit" modifier just before export. This way you can keep the object whole in Blender. The downside is that you must remember to do this for all objects using it and that you must not save the project after applying, or the latest save will have the objects broken apart. Save first, then apply and export, then reload the saved project before further work is done. Cristian Walther write a bit of python that automagically applies modifiers at time of export -- I don't know whether that has been made "official" part of pyPRP, but I don't think so.

EDIT: (It is, of course also possible to use three vertices for a corner, rather than a single one -- then you'll have vertex normals that match the face ones. That however means you get lots of extra faces.)
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

Re: Smoothing Issue

Postby Tyion » Wed Aug 06, 2008 11:48 pm

Hey Jojo thanks for the info! I am pleased to report I tested the Y methed and I think it worked! Now I just have to do it to all my mesh's lol here it comes the long hours. :D
Tyion
 
Posts: 126
Joined: Fri Dec 28, 2007 2:52 am
Location: In the land of Hyrule!

Re: Smoothing Issue

Postby Christian Walther » Sat Aug 09, 2008 1:17 am

Jojon wrote:Cristian Walther write a bit of python that automagically applies modifiers at time of export -- I don't know whether that has been made "official" part of pyPRP, but I don't think so.

Nope, not thus far - and likely not in the next few releases either, since I haven't ruled out that it may have unintended side effects. But if enough people test it and find that it's useful and doesn't break anything, it might eventually.

As a reminder, it's available from http://svn.guildofwriters.com/pyprp/contrib/CWalther/experimental/ using any Subversion client. (Perhaps I should make a separate branch for it that doesn't contain any of the post-release trunk changes or my other experimental changes.)
Christian Walther
 
Posts: 443
Joined: Sun Jun 08, 2008 3:10 am
Location: Switzerland

Re: Smoothing Issue

Postby tikibear » Fri Jan 09, 2009 12:37 am

This info is very useful. I have applied it to the Sprite Gallery.

I made all the faces on objects "soft" so they look the way they will in the game. I used the "set sharp" feature in the GUI to set all the edges sharp that I want to not be lit softly. I saved these settings.
I wrote a script to add the edge split modifier to all the objects with sharp edges. These are hard-coded in the script for now. The modifier is set to only apply to edges flagged sharp, not to edges with angular criteria
I save before running the script. I run the script. The appearance of the modded objects changes in the window. I open the Outliner. All the modified objects have a symbol next to them so I can go down the list applying the modifier to each, manually.
Once the modifiers are all applied I can export and reload the blender file to discard the modifications.

I can find no way for a script to actually apply the modifiers. Please let us know if there's a way.

I can probably modify the script to look at all objects in a scene and add the modifier automatically in some way.
tikibear
 
Posts: 54
Joined: Sun Oct 05, 2008 11:07 pm

Re: Smoothing Issue

Postby tikibear » Fri Jan 09, 2009 12:53 am

I created a new group called "sharp". I modified the script to apply the modifier to objects in that group.
tikibear
 
Posts: 54
Joined: Sun Oct 05, 2008 11:07 pm

Re: Smoothing Issue

Postby Christian Walther » Fri Jan 09, 2009 1:40 pm

tikibear wrote:I can find no way for a script to actually apply the modifiers. Please let us know if there's a way.

I'm not sure if that's what you want, but the way to get the modified mesh of an object o is
Code: Select all
m = Mesh.New()
m.getFromObject(o)

(while
Code: Select all
m = o.getData(mesh=True)

gets you the original mesh).

I don't know if there's a programmatic equivalent of the "Apply" button of a modifier, if that's what you're looking for.

By the way, I consider the current state of my PyPRP modification refined enough for a beta-quality release now.
Christian Walther
 
Posts: 443
Joined: Sun Jun 08, 2008 3:10 am
Location: Switzerland

Re: Smoothing Issue

Postby Grogyan » Fri Jan 09, 2009 2:00 pm

Tyion wrote:So I exported my first Age into blender today /cheers! and big thanks to Kato for the help he gave! :) But now I am faced with an issue, I linked into my Age of white and black and found that URU had well (smoothed all of my mesh's, this in turn made everything look (Icky) shall we say. So my question is, how do I stop this from happening?

Thanks much

Tyion


Have you tried the setSmooth and SetSolid buttons, they are usually what cause objects to appear smooth or not in game
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: Smoothing Issue

Postby Aloys » Fri Jan 09, 2009 6:19 pm

setSmooth and SetSolid buttons, they are usually what cause objects to appear smooth or not in game

Unfortunately Plasma doesn't work that way. The only way to get sharp edges is to actually split the vertexes. And to do that the EdgeSplit modifier is the best solution; although applying the modifier before the export is less than optimal.
There was a more indepth technical discution going on in this thread.
I also seem to remember a discussion somewhere about how it was possible to get PyPRP to apply modifiers during the export process.. I just can't find it right now.. It would really be a great thing, as right now it can be a serious time waster.
User avatar
Aloys
 
Posts: 1968
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Smoothing Issue

Postby Christian Walther » Sat Jan 10, 2009 12:11 pm

Aloys wrote:I also seem to remember a discussion somewhere about how it was possible to get PyPRP to apply modifiers during the export process.. I just can't find it right now.. It would really be a great thing, as right now it can be a serious time waster.

I actually talk about it two and five post above you. :)

The original thread is here and the software is available at http://svn.guildofwriters.com/pyprp/contrib/CWalther/experimental/.
Christian Walther
 
Posts: 443
Joined: Sun Jun 08, 2008 3:10 am
Location: Switzerland

Next

Return to Building

Who is online

Users browsing this forum: No registered users and 6 guests

cron