Jump to content

Switching shaders at run time.


YouGroove
 Share

Recommended Posts

I've been considering adding scripts to materials in the same way entities work. This would not work on a per-entity level with batched rendering, but characters aren't batched, so in that case you could send some different variables to a shader for each instance.

 

You can also just use Asset::Unmanaged to load a unique copy.

http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/asset/

http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/model/modelload-r352

  • Upvote 2

 

 

Link to comment
Share on other sites

You could also use a texture atlas, maybe controlled by ex_color.a or something. (Rick had such a shader in 3,0)

Yes could be usefull. My goal would be to swicth shader of character at any time with some script variable in input.

Example :

- shader change to a special shader effect (on gameplay conditions)

- shader LOD : near distance diff/norm/spec/glow , long distance : diffuse only shader ( sounds lot of performance gain here wink.png )

 

This would not work on a per-entity level with batched rendering

This could apply : If you make level divided in sectors and portals visibility , you could switch shader to simple diffuse one when sector is not one where the player is around.

Stop toying and make games

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.

 Share

×
×
  • Create New...