Generate materials with color gradients

Hi there,
I’m trying to programmatically create material for my polygon with color gradients like below.


For example, set x 0 ~ 5 to be blue, 5 ~ 10 purple, 10 ~ 15 pink…
https://www.babylonjs-playground.com/#MCJYB5#8
Is it possible? :thinking:
Thanks!

something like that?
https://nme.babylonjs.com/#WB25SB

2 Likes

Hey,
Thanks! That’s exactly what I need.
But I found some difficulties… :sweat:
I’ve built a material like:
image
https://nme.babylonjs.com/#WB25SB#1
But when I apply it on the ground and polygon, it looks odd :thinking:
https://www.babylonjs-playground.com/#MCJYB5#9
image


Do you have any ideas? Thank you again!:blush:

Aha, I’ve figured it out :joy:
For future reference
https://www.babylonjs-playground.com/#MCJYB5#10

I’m not sure if I need to create a new topic…
Another question is can I have a light and shadow effect on the NodeMaterial?


It looks flat from the top…:thinking:

You have a light node in the list :slight_smile:

Thank you!:smile:
For future reference
https://nme.babylonjs.com/#WB25SB#2
https://www.babylonjs-playground.com/#MCJYB5#12

1 Like