Jump to content

how to build a light vop from scratch? wip


kensonuken

Recommended Posts

Im trying to build a custom light vop and started to build one.. I request you guys to help me out in building this light vop... I will be uploading the hip files..

This is the shader which im trying to build

light
pointlight( 
	float intensity = 1;
	color lightcolor = 1;
	point from = point "shader" (0,0,0);
	float decay = 2.0; )
{
	illuminate( from )
	{
		float distance_squared = L.L;

		if( decay == 2.0 )
		{
			Cl = intensity * lightcolor / distance_squared;
		}
		else
		{
			Cl = intensity * lightcolor / pow(distance_squared, 0.5 * decay ); 
		}
	}
}

Link to comment
Share on other sites

yeah jason I know but I want to make lots of additional functions which i feel better to build it using vops and add them quickly. As of now I have only one thing to add to the existing light shaders thats projecting the UV texture over the object and render them into saparate pass for each light.. I dont know if things can work like taking Cl and multiplying with uvs or howz the solve this problem... I dont want to use some rendered texture and plug it in the light node but to generate it procedurally so that It will not generate any sub pixel artifacts during the interpolation...

Edited by kensonuken
Link to comment
Share on other sites

What I mean is to learn from VEX function set, the language structure from the VEX source code, particularly how it differs from RSL - and then build it in VOPs like you want it. If you look through the Light shaders in VEX, you'll see that there are no illuminate constructs in there.

It seems like you're running before you're walking. There is some fundamental groundwork you need to know before building some of these shaders.

Link to comment
Share on other sites

yeah I saw the sample shader code in the shop I understood how it works and Im trying to plug UV map (procedural). I am a bit confused..

it should be multiplied by Cl but I want to take that out as another pass called Proj so im thinking to write that out as some Proj = Cl * Uvmap just getting confused how to code this...

Link to comment
Share on other sites

i could build this shader but this is showing only the UVs of the object instead of just a uv projection streching across the cone angle...

light
light1()
{
    float       amount;
    vector      vec;
    float       amount1;
    vector      vec1;
    vector      sum;

    // Code produced by: ramps1
    float ss;
    vop_bindS(ss, s, 1);
    ss = ss*1 - 0;
    if (1 != 0)
        amount = vop_TentTrain(ss*.5, 1*vop_FilterWidth(ss));
    else
        amount = vop_RampTrain(ss, 1*vop_FilterWidth(ss));

    // Code produced by: floattovec1
    vec = vop_floattovec(amount, amount, amount);

    // Code produced by: ramps2
    float ss1;
    vop_bindS(ss1, t, 1);
    ss1 = ss1*1 - 0;
    if (1 != 0)
        amount1 = vop_TentTrain(ss1*.5, 1*vop_FilterWidth(ss1));
    else
        amount1 = vop_RampTrain(ss1, 1*vop_FilterWidth(ss1));

    // Code produced by: floattovec2
    vec1 = vop_floattovec(amount1, amount1, amount1);

    // Code produced by: add1
    sum = vec + vec1;

    // Code produced by: output1
    vector tempCl = sum;
    Cl = tempCl;
}

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...