mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.58k stars 35.37k forks source link

FlatShading on MeshLambertMaterial #7130

Closed Astrak closed 3 years ago

Astrak commented 9 years ago

The shading property has been removed from MeshLambertMaterial, it is only rendered the SmoothShading way.

Is it the desired effect ? Phong looks heavier to get this result.

codeka commented 7 years ago

Is there any update here? I noticed #9222 got merged recently, is that the way to go about this?

WestLangley commented 7 years ago

@codeka Yes, if your geometry is THREE.Geometry, you can call

geometry.computeFlatVertexNormals();

and achieve flat shading when using MeshLambertMaterial.

looeee commented 7 years ago

Added a note to the docs saying that FlatShading won't work for this material.

jee7 commented 5 years ago

Currently the note about flat shading not working with Lambert seems to have gone missing from the docs.

One might assume that MeshLambertMaterial with flatShading: true would produce the same result as MeshPhongMaterial with flatShading: true and shininess: 0.

http://jsfiddle.net/__jee7__/0aj5vh9g/16/

As choosing the material class seems to be about how the shading is calculated (what reflectance model is used) instead of where is it calculated (per fragment, vertex or face).

Mugen87 commented 3 years ago

Quick update on this topic since THREE.Geometry is now removed.

@mrdoob We might want to consider to move flatShading to only those materials who actually support it (and not have it in Material). Except for that, I would not change shader code nor introduce a new geometry class.

mrdoob commented 3 years ago

@mrdoob We might want to consider to move flatShading to only those materials who actually support it (and not have it in Material).

That sounds good to me 👍