Jump to content

Flat shading


ocean
 Share

Recommended Posts

So, if I'm ever going to get a project done I'm going to have to go retro... Is it possible to make a super-low-poly flat shaded game in Leadwerks? I tried importing plain colors as textures, but they seem awfully smooth by default at least.

Ubuntu 14.04 / 64bit. Dell XPS430, Intel Core 2 Quad Q8300 @ 2.50GHz, 4Gb Ram, Radeon HD 6670, Leadwerks Pro edition (Steam).

Link to comment
Share on other sites

You don't even need textures, materials can just have a diffuse color.

 

It's probably easiest to just build your normals using the angular threshold method above, using a tolerance angle of zero. This will give you completely hard edges on any model.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Brilliant! Thanks!

But am I right in assuming this does not apply to brushes? EDIT: Or terrain for that matter?

Ubuntu 14.04 / 64bit. Dell XPS430, Intel Core 2 Quad Q8300 @ 2.50GHz, 4Gb Ram, Radeon HD 6670, Leadwerks Pro edition (Steam).

Link to comment
Share on other sites

Brushes are always hard-edge unless you have smooth groups. Cylinders, spheres, and other round shapes have smooth groups but that can be removed.

 

You will need to modify the terrain shader to make that have hard edges.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

You can recalculate normals with a geometry shader as flat like this: (will override all mesh smoothing)

 

vec3 edge1 = vertex_position[1].xyz-vertex_position[0].xyz;
vec3 edge2 = vertex_position[2].xyz-vertex_position[0].xyz;
mat4 nm=transpose((cameramatrix));
vec3 faceNorm = mat3(nm) * normalize(cross(edge2,edge1));

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

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...