Page 1 of 2

How to make flat faces/sharp edges?

PostPosted: Tue Jun 17, 2008 9:40 am
by Christian Walther
OK, here's the next Blender/PyPRP newbie question! :) I suspect this one can be answered by the experts faster than I can figure out the answer on my own:

Meshes exported from Blender always seem to be smoothly shaded in Uru (single, averaged normal for all faces meeting at a vertex). What if I want to have flat faces and sharp edges (separate vertex normals for each face)? For Blender's own renderer, I have found that I can adjust that by marking faces as "smooth" or "solid", using "Auto Smooth", or marking edges as "sharp" and using an "EdgeSplit" modifier. See the left (smooth) and middle (solid) cubes in the top image:

cubes.jpeg
cubes.jpeg (15.23 KiB) Viewed 4596 times

In Uru however, both of these cubes appear smooth, as seen in the bottom image. What I'm aiming for is the look of the right cube, which isn't actually a cube, but just six disconnected quads. Is there a way to achieve this while keeping the mesh connected in Blender, to keep editing it a bit easier?

To cut the right cube, I used the EdgeSplit modifier and "applied" it. Interestingly, its documentation says "The output of the EdgeSplit modifier is available to export scripts, making it quite useful for creators of game content." That seems to suggest that things should also work with the modifier "unapplied", so that the cutting would only happen at export time, while leaving the Blender file unmodified. My experience however is that the modifier has no effect at all on the result in Uru. Am I misunderstanding this, or is PyPRP just not making use of that capability?

Re: How to make flat faces/sharp edges?

PostPosted: Tue Jun 17, 2008 12:37 pm
by Jojon
I wouldn't be surprised if they are looking into it now, after reading your post. :)

*pats his poor butchered meshes "sooo-soo little ones, don't be sad - those nice mister developer gentlemen will make everything allright, I'm sure."*

:7

Re: How to make flat faces/sharp edges?

PostPosted: Tue Jun 17, 2008 1:31 pm
by Christian Walther
It wasn't my intention to point out anything that needs to be looked into... (Though if I did, all the better. I might even start looking into it myself.) I was just asking a question about what seemed a pretty basic aspect of age building to me... :)

So am I understanding you correctly that you have the same question and haven't found an answer to it yet?

Re: How to make flat faces/sharp edges?

PostPosted: Tue Jun 17, 2008 2:01 pm
by Trylon
Interestingly, the effect you desire was actually the default way of operation before the GoW 1.0.0 PyPRP version.
We included an optimization loop that checks if vertices that are added are already there or not...

EDIT: Ehm wait a few seconds - we did use vertex normals however, so lighting could be the same in both situations.
Ah well, the easy (and most beautiful) way to implement what you want is to disable the optimization routine, and to use the face normal value and write it to the vertex normals.

Re: How to make flat faces/sharp edges?

PostPosted: Tue Jun 17, 2008 9:59 pm
by Christian Walther
Heh, this is interesting. Here I come, as a complete newbie, and I'm already suggesting new features, without even knowing it. :D

Just to be clear, I (usually) don't want this effect on a whole mesh, just on selected edges. Would your solution accomplish that, Trylon?

In fact, in terms of PRP output (or at least of visual output in Uru), what I want is exactly what I can already get by applying the EdgeSplit modifier. The only thing is that I would prefer not having to apply it, but keeping it present as a modifier.

I wonder how hard it is to learn the Blender Python API. I might look into this modifier-output-available-to-export-scripts thing myself. I've always wanted to learn more about PRP and Plasma anyway.

Just out of curiosity - I haven't tried this yet - does the same thing happen with other modifiers? E.g. when I have a subdivision modifier (and don't apply it), does PyPRP export the original coarse mesh, not the subdivided one?

Re: How to make flat faces/sharp edges?

PostPosted: Tue Jun 17, 2008 11:57 pm
by D'Lanor
Christian Walther wrote:The only thing is that I would prefer not having to apply it, but keeping it present as a modifier.

When this came up before we were told that only applied modifiers are recognized by PyPRP. Which I can completely understand. I do not even want to think about the extra programming required to apply modifiers during export.

Re: How to make flat faces/sharp edges?

PostPosted: Tue Jun 17, 2008 11:59 pm
by Grogyan
As you know Christian i'm attempting to write my own script using the Blender API, but while the API is fairly straight forward, learning and knowing python is problematic

Re: How to make flat faces/sharp edges?

PostPosted: Wed Jun 18, 2008 12:17 pm
by Christian Walther
D'Lanor wrote:When this came up before we were told that only applied modifiers are recognized by PyPRP.

Can you point me to where this came up before (if it was in a public place)? There might be something to learn for me there.

D'Lanor wrote:I do not even want to think about the extra programming required to apply modifiers during export.

Well, the bit I quoted from the EdgeSplit documentation made it sound like it would be easy, or even automatic. You're getting me more and more interested in checking this out myself.

Grogyan wrote:while the API is fairly straight forward, learning and knowing python is problematic

Really? I'm pretty fluent in Python, so that isn't a problem in my case - but even if I wasn't, I'd expect that to be the least obstacle. My experience is that learning new languages is fairly easy, it's the APIs that take more time. :geek:

Re: How to make flat faces/sharp edges?

PostPosted: Wed Jun 18, 2008 12:27 pm
by D'Lanor
Christian Walther wrote:Can you point me to where this came up before (if it was in a public place)? There might be something to learn for me there.

Not that much was said but here is the topic.

Re: How to make flat faces/sharp edges?

PostPosted: Wed Jun 18, 2008 12:37 pm
by Christian Walther
Thanks! I happened on that topic when I searched for "modifier" after your comment, but I wasn't sure if that was what you were referring to.