A VEX surface shader using the modulus function.

Math and shader language!

Date Created:Friday December 29th, 2006 03:41 AM
Date Modified:Thursday July 31st, 2008 03:33 PM

Modulus -

VOPs vs. VEX?

You can achieve the exact same things with both worlds!

Modulus -

Modulus -

Script is below, along with the file.

#pragma hint prim color
#pragma hint sec color
#pragma label prim "Primary Color"
#pragma label sec "Secondary Color"
#pragma range freq 10 20 
#pragma label freq "Frequency"

v_modulus(float freq=10vector prim={1,0.7,1}, sec={0.3,0.3,1})
    float ss s*freq%1;
    if ( ss 0.5 ) {
        Of 0;
    } else { 
        Of 1;
    vector n noise(s*10,t*10);

    // uncomment this to set the green channel from 0 to 1

    Cf Of;


Download: modulus.hip 232 KB
Download: modulus.vfl 565 B

Please login or Click Here to register for downloads
Creative Commons License
Modulus by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at
Permissions beyond the scope of this license may be available at