Jump to content

Gouraud vs. Flat shading


omniglitch
 Share

Recommended Posts

Something odd I've noticed is that all of the models I make in Blender (which are exported to .fbx then converted to .gmf with the fbx2gmf tool) appear Gouraud shaded by the engine, yet the sample models that came with the SDK and models created by code, like CreateCube(), appear flat shaded.

 

To show you what I mean, the left cube in the image below was created with CreateCube() and the right cube was created in Blender--I just exported the default cube blender starts with. Both cubes use the same material, which includes both diffuse and normal textures.

 

Flat_vs_Gouraud.jpg

 

For most models I'd rather avoid Gouraud shading, as it's often quite ugly. Is there something I have to do in the art pipeline to have models use flat shading, like the sample models appear to use? Is there some command to set the shading type for a model?

Link to comment
Share on other sites

Hmmm interesting. Can't say I've had the same problem. Then again I use UU3D to export to gmf so that may be the difference.

 

BTW: It's difficult to tell exactly what the differences are in that render because the models are different distances away and the lighting on both models is different. If you took a screen shot of a frame where both cubes are the same distance away and and with the same shadows it would be easier to see the exact differences.

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

an exported uu3d created cube will suffer the same problem... it has to with the normals i would suspect...

 

in the following picture, i have created 4 cubes. listing them left to right:

1) CreateCube()

2) UU3D created cube saved as gmf

3) 3DWS created cube saved as gmf

4) Another modelling program created cube with small chamfers on each corner and converted to gmf using uu3d

 

post-14-0-92413800-1315354541_thumb.jpg

 

if you add a really small chamfer to all the edges of the cube, you should be able to fix the issue

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

UU3D has that bug, as you can see from your screenshot too, that it doesn't create evenly shadowed surfaces. I have to run always 3D Tools -> Unweld Faces, to make them look correct.

 

Here's what I mean:

 

Default UU3D cube, with shadow bugs:

post-2-0-11316200-1315355307_thumb.png

 

Unweld Faces cube, now faces are correctly shadowed:

post-2-0-50281500-1315355339_thumb.png

 

Of course, in-game you need also some glossy cubemap (like in Filax's parfume shop demo), to make it look more real, or at least a specular map.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

ooo nice find... i tried about every other 3d tool except that one... so no need for the chamfers if you use uu3d... nice. but if he doesnt have uu3d he will need to chamfer... unless his modelling app has that ability as well... :)

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

I've tried the chamfering technique before with other engines, but it's pretty labor intensive (or maybe I was doing it the hard way). I like the unweld feature in UU3D. It greatly multiplies the number of vertices, but the results are worth it in my opinion. I was pretty much already sold on getting the full version of UU3D, now I'm really sold on it.

Link to comment
Share on other sites

yes uu3d is really nice and has alot of very nice hidden features in it...

 

and it doesnt appear to make more vertices as far as the GMF is concerned... when i counted the vertices in a plain uu3d exported cube and an unwelded face uu3d exported cube, the number of vertices was the same... granted a cube is pretty basic...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

This Unweld only aligns the vertex normals to the same direction as the face normal. The default cube in UU3D has the vertex normals in a 45 degree direction facing outwards from each corner of the cube. For rounded objects this works, but for sharp edged objects it looks bad, because some places get darker than the they should. Maybe the intensity of the gouraud shading could be adjusted with a higher ambient light, but then the whole scene would look ugly again.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

I've tried the chamfering technique before with other engines, but it's pretty labor intensive (or maybe I was doing it the hard way). I like the unweld feature in UU3D. It greatly multiplies the number of vertices, but the results are worth it in my opinion. I was pretty much already sold on getting the full version of UU3D, now I'm really sold on it.

 

Chamfering is super easy in Blender. Do you use the edge loop command? Just hit ctrl+r and then it will let you put edge loops in between polygons. Then it will let you slide these loops up and down. Slide them up to the edge where you want to make a chamfer and done.

 

Yes it does increase the poly count but that is the challenge. Where is it worth incresing for a good look? All questions that you gotta ask youself.

 

As for the normals, its a good idea to get that right in blender before export. There are a few tools in the 't' and 'n' panels for showing normals and editing and flipping them.

 

Concerning UU3D: I don't recommen unwelding the UV's. By doing this you are creating a tonne of extra vertices in the UV map. Every vertext that is unwelded becomes 2 vertices. If you completely unweld a plan that consists of 4 quadrants then that converts the 1 vertex in the middle to 4 verticies...... Not very efficient and not recommened. You generally want to keep your UVs stitched together as much as possible. You may not notice the verticies in any vertex count but it doesn't change the fact that the UV map has more verticies = bigger UV file = longer processing of UVs.

 

TBH I don't know what you guys are talking about with UU3D. The reason that cube looks funny that Metatron posted is because its using shaded smoothing and its edges have too great and angle between faces to get a good result from that. That is what shaded smoothing will do.... If you want flat smoothing.. don't auto smooth and don't export smoothing groups. I seriously cannot replicate this problem on my system......

 

Edit: If you are going to make a cube with hard edges like you would for a crate for example... Don't use smooth shading and don't export any smoothing groups.

 

Edit2: UU3D is excellent. One of the best value for money software I've gotten.

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

I use the method Metatron uses because Blender has done the same to me in the past, Ive also had trouble with recalculating normals in blender. It seems to flip some faces the wrong way, so When I load it into leadwerks, im seeing lots of back faces, as well as correctly flipped faces. :S

Intel core 2 quad 6600 | Nvidia Geforce GTX460 1GB | 2GB DDR2 Ram | Windows 7.

 

Google Sketchup | Photoshop | Blender | UU3D | Leadwerks Engine 2.4

Link to comment
Share on other sites

  • 4 weeks later...

UU3D has that bug, as you can see from your screenshot too, that it doesn't create evenly shadowed surfaces. I have to run always 3D Tools -> Unweld Faces, to make them look correct.

 

It's not a bug, it's by design. :)

 

Currently, there are no tools in Unwrap 3D to edit the vertex normals separately, so Unwrap 3D will calculate its own

vertex normals based on how edges are connected. So, if all edges belonging to a vertex are connected, it will look smooth.

The default box primitive is fully welded, so all vertices will look smooth. This is by design.

 

But, to overcome this limitation, Unwrap 3D has many tools to unweld edges. The best tool is AutoSmooth Faces, which

works exactly like the AutoSmooth tool found in 3dsmax. It unwelds sharp edges, while keeping flat edges smooth.

This is especially useful for models that have curved surfaces, such as barrels, poles, cylinders, or cones.

 

If there were tools in Unwrap 3D to edit vertex normals, it would probably work like Maya. In Maya, you can make an edge

hard or soft, and this will change how the vertex normals appear at that edge. Hard edges appear sharp, and soft edges

appear smooth. I would prefer implementing this method over 3dsmax's smoothing groups, as I see it as being easier to use

and understand.

 

Now, if you're wondering what happens to vertex normals when exporting to a GMF file, you can be assured, that they won't

change. The same vertex normals you see in Unwrap 3D are the same vertex normals that are exported to GMF. So, what you

see is what you get, in terms of vertex normals.

 

I hope that helps.

Ultimate Unwrap 3D: http://www.unwrap3d.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...