How to create flat shaded box?

Blitz3D Forums/Blitz3D Programming/How to create flat shaded box?

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Blitz smooths across unwelded vertices closer than a certain threshold. This causes the shading on cubes to be wrong because the normals for all the corner vertices will point out in the same direction diagonally from the three adjacent sides. In essence it shades it like it would a sphere.

The solution is not to use the Blitz normal shading function. There is a function in the coe archives I wrote along time ago that calculates the normals in a way which does not smooth across unwelded vertices. Click my username and select code archive entries to find it.

Of course my fucntion has it's own limitations. It may not work well on spheres and cylinders which have unwelded edges where the texture wraps.

A better solution is to have a smoothing function that takes an angle and only smooths across edges which are less than that angle. I don't know if there is a function in the code archives which does that.

But the best solution is to specify all your normals yourself in the 3d pakcage when you create the models. Of course this won't work if you're building stuff with primitives in Blitz.