Jump to content

export data from one shader to another


mic

Recommended Posts

hello! i have written two shaders - displacement and surface. both of them similarly calculates new 's' and 't' coordinates. I think it would be better to calculate uv space only in the displacement shader and then export the values to surface, it would be faster. can i do this?

(shaders written in rsl)

Link to comment
Share on other sites

hello! i have written two shaders - displacement and surface. both of them similarly calculates new 's' and 't' coordinates. I think it would be better to calculate uv space only in the displacement shader and then export the values to surface, it would be faster. can i do this?

(shaders written in rsl)

In RSL, you can combine displacement and shading in a single surface shader, so you're not forced to use message passing. You can still choose to write them separately if you wish, of course. In that case, you can import the st's from a displacement shader (which exports them) using the displacement() function. The import functions are (from the help):

float atmosphere( string param; {float|point|color|string} var )
float displacement( string param; {float|point|color|string} var )
float lightsource( string param; {float|point|color|string} var )
float surface( string param; {float|point|color|string} var )

And their VEX analogs:

int dimport(string name; {int|float|vector|vector4|matrix|matrix3|string} value&)
int limport(string name; {int|float|vector|vector4|matrix|matrix3|string} value&)
int simport(string name; {int|float|vector|vector4|matrix|matrix3|string} value&)
int shimport(string name; {int|float|vector|vector4|matrix|matrix3|string} value&)

Cheers.

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