BabylonJS / Babylon.js

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.
http://www.babylonjs.com
Apache License 2.0
23.17k stars 3.42k forks source link

Flat Shaded Polies? #99

Closed McFunkypants closed 10 years ago

McFunkypants commented 10 years ago

Hello. Thanks for all your wonderful work.

I was wondering if there was a way to turn off vertex color interpolation in the standard shader? So that, instead of blended "gourad" gradients, each polygon in a mesh is using the old-school retro flat-shaded look.

Example Image - I want the model on the RIGHT side - for a "faceted" look. http://cdn.tutsplus.com/gamedev.tutsplus.com/uploads/2013/10/import_compare.png

THANK YOU VERY MUCH for any advice!

(more examples: http://gamedev.tutsplus.com/tutorials/aesthetics/go-beyond-retro-pixel-art-with-flat-shaded-3d-in-unity/)

hw3web commented 10 years ago

look on this forum , I did ask about it but is it still on progress , maybe in the future

http://www.html5gamedevs.com/topic/1837-abc-babylonjs-scale-smooth-and-pick-and-split-view/?hl=smooth

Deltakosh - "Flat shading is not supported right now "

deltakosh commented 10 years ago

I will add the feature to the roadmap:)

McFunkypants commented 10 years ago

One interesting workaround I did was to "explode" the mesh so that all tris have three unique verts (none shared) then make all vert normals the same. Voila: flat shaded polies without special shaders since there are no nearby colours to interpolate from (but way more vertexes, so less performant).

cyle commented 10 years ago

I'd like to add my name to this feature request! I actually spent a couple days trying to learn shaders so I could do this myself, but I just don't have the skills yet.

deltakosh commented 10 years ago

Done :)

McFunkypants commented 10 years ago

Yay! You are awesome. Thank you!