Double-sided faces

Double-sided faces

Share and discuss visual creations and creation practices like texturing, modelling and musing on the meaning of life.

Moderators: MR.D, Moderators

Post Reply
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Double-sided faces

Post by SpliFF »

I have some models I've imported that were originally designed with texture applied to both sides of some triangles (a one-dimensional object). In Spring however the objects rear face is simply invisible.

What I'd like is for the triangles front face to be mirrored on the back face.

Short of making a new model, what can I do to make these faces visible in Spring?

With your answer, keep in mind that I have about 20 models fitting this category, i'd like a solution that's reasonably fast or automated, rather than relying on my crappy modelling and UV mapping skills.

My tools are Blender, Wings3D and Upspring. The models are 3ds format (exported from blender).
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Re: Double-sided faces

Post by Gnomre »

Go into polygon selection mode in upspring (bottom icon on the left toolbar). Select the face in 3d view, and click the "Flip selected polygons" button a couple up from the polygon selection mode button.

There are almost certainly similar functions in the other apps you mentioned, they might be called "Reverse normals" or something like that though.
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: Double-sided faces

Post by SpliFF »

That just reversed the effect. Now I can't see the face from the front (only behind). I want a single face with two sides. I could flip a copy of the face but I'd prefer an approach that won't add polys to the model.

The models in question are taken from the (now GPL) Warzone2100. They are already textured and UV mapped which saves me a LOT of work. The models are very low poly which is perfect because I'm aiming for high unit counts. I can add more faces if that's the only way but it would be nice to use the models as-is and just copy the texture to the back face. I just don't know if the back face is allowed to have a texture. I don't think it's an OpenGL limitation (after all, Warzone2100 allows it) but maybe Spring doesn't? If it does then I just want to know if there's a trick to enabling it.

Perhaps this is "back-face culling". If so I would imagine it's a hardcoded thing? If not is it something a mod can set? Is it something else?

I imagine I don't want the engine to enable ALL back faces, that's just going to slow things down while it renders the insides of units. So is this something I can set per-face?

For what it's worth, Upspring does render the back faces, it's just when it gets to Spring they vanish.

Here's the model:
Image

As you can see it makes considerable reuse of the back faces. duplicating the faces would almost double the poly count.
Last edited by SpliFF on 24 Mar 2009, 12:27, edited 1 time in total.
User avatar
Hoi
Posts: 2917
Joined: 13 May 2008, 16:51

Re: Double-sided faces

Post by Hoi »

Spring renders faces one sided, so if you want to have a triangle (2d) and you want to see both sides you'll have to use two triangles.
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: Double-sided faces

Post by SpliFF »

Thanks Hoi. I suspect that even hacking Spring/Lua to enable back-face rendering would hurt more than it helps so it looks like I have no choice but to add more faces. I suppose I'll just copy the important faces, paste them back over themselves, and flip the polys.

My follow up question is if I do that will I get z-buffer fighting or do I need to individual shift the faces back a few emos?
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: Double-sided faces

Post by Peet »

You will not get z-fighting between parallel faces when one of them is culled.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Double-sided faces

Post by yuritch »

Well, actually Spring renders faces single-sided on s3o models, but old 3DO models get both sides rendered. A hardcoded engine thing. Also, rendering backfaces automatically doubles the polycount as well, so it might not be the best idea to turn it on for s3o.
As for z-fighting issue, it's not really z-fighting that is the problem (both sides will have the same texture afterall), it's the way shadows are displayed. Currently it looks like both sides of a face (or even 2 faces that have the same vertex coords, but reversed normals so that they appear as 1 double-sided poly) get the same shading, which obviously looks wrong. Try it and see for yourself (one example is here, look at the screen with 2 destroyers and see alternating light and dark sections on their sides). So, yes, you'll probably have to leave some space between such faces.
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: Double-sided faces

Post by SpliFF »

Thanks. Cool ships btw yuritch.

I think I'll just remodel the affected parts totally, Spring has a much closer zoom than Warzone2100 so some of its cheats are harder to pull off. The howitzer (pictured above) looks like it's being held up with cardboard.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Double-sided faces

Post by lurker »

If you decide you want to, you can change the culling mode before the unit renders. Look at the recent topic about changing the alpha threshold and set culling instead. But be warned that I think that widget as-is doesn't work for some reason.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Re: Double-sided faces

Post by jcnossen »

For what it's worth, Upspring does render the back faces, it's just when it gets to Spring they vanish.
That's just because back face culling is not enabled default in upspring. Click within the view on "3D" and select "Cull faces" to see it like it is in spring.
What you can do quickly is make a copy of the object with the faces that you want to have 2-sided, and flip the polygons of the copy (By using "Flip all polgyons" in the object menu)
Post Reply

Return to “Art & Modelling”