YouGroove Posted May 12, 2014 Share Posted May 12, 2014 Could it be possible to switch in real time a shader for some character to another shader ? and not affect other same characters copies ? Can Lua variables be passed to shaders ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Admin Posted May 12, 2014 Share Posted May 12, 2014 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 2 Quote Link to comment Share on other sites More sharing options...
shadmar Posted May 12, 2014 Share Posted May 12, 2014 You could also use a texture atlas, maybe controlled by ex_color.a or something. (Rick had such a shader in 3,0) But scripted materials sounds very flexible, me like. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
YouGroove Posted May 12, 2014 Author Share Posted May 12, 2014 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 ) 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. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
bandrewk Posted May 12, 2014 Share Posted May 12, 2014 Why can't you use Material::SetShader() / GetShader() and all the methods of the shader class? Quote Link to comment Share on other sites More sharing options...
shadmar Posted May 12, 2014 Share Posted May 12, 2014 It would change all instanced models too. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
bandrewk Posted May 12, 2014 Share Posted May 12, 2014 Not if using Asset::Unmanaged flag, as Admin mentioned. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.