Advertisement

Need ideas: Assign distinct color to each face of mesh

Started by November 04, 2019 04:56 PM
3 comments, last by cozzie 5 years, 1 month ago

 

 

What I'm trying to acheive is:

2dUaalv.png.525e8aa7c42d336a6068dfcbced2257e.pngGEqjNNl.png.755c91d5934ee698dd5623ecc8d83a9f.png

source: https://forums.tigsource.com/index.php?topic=40832.msg1027183#msg1027183

Original author said he combine world normal and world position, but I can't reproduce this - if you have any idea, pleae comment it.

It will be really appreciated!!

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.

 

 

Advertisement

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.

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

This topic is closed to new replies.

Advertisement