Jump to content

passing attributes to vex


ben.toogood

Recommended Posts

evening all,

is it true to say that any point attribute (say "life", "numhit", "id") can be passed into a vex shader?

I have manged to pass floats and vectors (having found that once they are named as parameters in the parameter list they are in) but seem to be struggling with other attributes.

In the attribute spread sheet things like "numhit" and "id" look like ints and ive declared them as int parameters, but they dont seem to be bound and i dont seem to get values from them.

should they be passing? or are some attributes nonpassable?????

thanks for any help, much appriciated (one week to my deadline and all, ha)

ben

Link to comment
Share on other sites

is it true to say that any point attribute (say "life", "numhit", "id") can be passed into a vex shader?

There's a global variable "id" already, so you shouldn't have to pass it in as a parameter.

I'm pretty sure "nhit" is an integer attribute (at least if you look at the .geo file, it appears that way). This means that you have to declare the id parameter as an integer.

pop testnhit(int nhit=0)
{
    if (nhit > 0) Cd = {1,0,0};
    else Cd = {1,1,1};
}

Life appears to be 2 floats, so here doesn't seem to be a way to pass in the direct values. However, again, there's a global variable called "life".

Link to comment
Share on other sites

cheers crunchy,

what you suggested worked, and worked well. what i would really like though would be for my vex shop shaders to be able to take these attributes, to control allsorts of things. my point attributes pass into the sops level fine, but dont seem to want to be passed into parameters of shaders? i am confused. :(

hope u or some one else knows something.

the best i have come up with so far has been to use the attributes in pops to set point color Cd, and then use this in my surface shader....

thaks again

ben

Link to comment
Share on other sites

im trying to utilise collision generated particle point attributes to switch between image sequences used on sprites. I also wish to find the time since the collison so that when a sprite collides, it will play a 'hit' animation and then revert to the usual base image sequence when after the duration of the 'hit' animation.

ben

Link to comment
Share on other sites

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...