Skip to main content
GameDev.net gamedev.net
🔒 Locked

Need ideas: Assign distinct color to each face of mesh

Started by dragon-kurve Nov 4, 2019 at 4:56 PM 3 replies 2k views
JohnnyCode
JohnnyCode

He took the world normal and turned it to a color vector information straight ahead I suppose, combining it with the world position he did the same thing with as well.

If you want a specific color per triangle, it is more difficult, since this color attribute would belong to a vertex, and face is composed of 3 verticies, shared or not. It'd have to be the same color for all three verticies so that it does not interpolate to different color.



dragon-kurve
dragon-kurve

So I started with dot(CameraVector, WorldNormal) in vertex shader:

2.thumb.png.3b6868ca3fa2411808c2b064cbb1fe4a.png1.thumb.png.16025c3c90225ea25acef8857d6672bf.png

Maybe I can make some progress based on this.

cozzie
cozzie

Not sure if this helps, but if you want a color per face, then all vertices per face should be unique and assigned that color (so no vertex re-using).

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.