Page 1 of 1

Polygon colours from gradient

Posted: 06 Feb 2018, 11:04
by tarkovsky
Hi all.
How can I color whole polygons from a gradient shader?
I have a map, where I want the color/texture to look more "polygonized" (according to geometry).

Ideally color would be sampled at PolygonRefFrame and applied to whole polygon. ICE? Vertext color on disconnected polys (no experience whatsoever ;))?

Current:

Image

Image

Re: Polygon colours from gradient

Posted: 06 Feb 2018, 11:49
by rray
With ICE there's a polygon position attribute that you can use for a closest location lookup or gradient calculation. I would do the gradient computation directly in ICE instead of baking/reading from a shader. That would give you a color per polygon which you can convert to per node which is what you need for writing into a vertex color property (there's no color-per-polygon in XSI). No disconnecting has to be done.

The conversion can be done this way: put all the per polygon colors into an array (with build array from set) and select from that array using NodeToPolygon.

Re: Polygon colours from gradient

Posted: 07 Feb 2018, 15:38
by tarkovsky
Thanks for the pointer rray - I'll give it a go :)!

Re: Polygon colours from gradient

Posted: 19 Feb 2018, 10:40
by tarkovsky
Hello again.
Suggestion works great - thanks again, but I'm not sure how to do the gradient in ICE?

Image

t

Re: Polygon colours from gradient

Posted: 19 Feb 2018, 11:48
by rray
Hi tarkovsky, there's a gradient node directly in ICE, when you plug the polygon's Y position into its input, it will be in polygon context.

Then you can connect it to the "Build array from set" node that you already have

Re: Polygon colours from gradient

Posted: 19 Feb 2018, 14:20
by tarkovsky
Got it! Thx! :-bd

Always struggling with context stuff!

Re: Polygon colours from gradient

Posted: 19 Feb 2018, 17:32
by rray
Context in ICE is tricky.. the concept is great though. There could be user friendlier methods but these would require memory stored for all kinds of lookups and also some pre computation time