Control lighting via VEX per primitive

   960   0   1
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
I was wondering if it's possible to control lighting on a per primitive or point basis in a wrangle.

Like for a distant light with wrangle set to run over primitives:

int Horizontal_Domain_Range;
int Horizontal_Domain;
float Fitted_Domain;
float Ramped_Domain;

Horizontal_Domain_Range = nprimitives(geoself())/360;

Horizontal_Domain = @primnum/360;

Fitted_Domain = fit(Horizontal_Domain, 0, Horizontal_Domain_Range, 0, 1);

Ramped_Domain = chramp("ramp_intensity", Fitted_Domain);

@light_intensity = Ramped_Domain;


At the moment I'm using the corresponding shader applied instead and its' opacity to get intended effect and replacing last line of the above with:

@opac = Ramped_Domain;

I tried using the attenuation ramp of the light itself, but it seems to introduce some discernable transition patterns(even though controls were set to b-splines for smooth graduations.)

I swore I was controlling the lighting attributes with vex about a year ago when I was working on some project.

Can't seem to find that file, nor any posts here on the forum.

Maybe I remember wrong and was working with just shading all along.

Is this possible in what I wish to do with lights?
Edited by BabaJ - Sept. 22, 2017 16:54:20
  • Quick Links