Lunarovich Posted June 20, 2015 Share Posted June 20, 2015 Hello! I know how to attach post-processing effects to a camera via editor as well as programmatically. However, I do not know how to control post-processing shader parameters dynamically. For example, Shadmar's pixelate shader has this variable: const int downgrade = 6; //at original 1920x1080, 6 yields 320x180 Now, how can I change downgrade value via Lua code? Thank you! Quote Link to comment Share on other sites More sharing options...
Rastar Posted June 20, 2015 Share Posted June 20, 2015 You would have to make this into a uniform uniform int downgrade = 6; and can then set it via Shader:SetInt(). 1 Quote Link to comment Share on other sites More sharing options...
gamecreator Posted June 20, 2015 Share Posted June 20, 2015 This might help too http://www.leadwerks.com/werkspace/topic/11762-posteffect-collection/page__st__20#entry89091 Quote Link to comment Share on other sites More sharing options...
Lunarovich Posted June 23, 2015 Author Share Posted June 23, 2015 You would have to make this into a uniform uniform int downgrade = 6; and can then set it via Shader:SetInt(). I see the point. However, if you look at the API, you'll see that Camera:AddPostEffect accepts only string. That said, I cannot first load a shader and send a reference to the shader as a parameter to the camera. Rather, I send a string and never get the reference to the shader back from camera (at least in Lua and as far as I can see). This might help toohttp://www.leadwerks.com/werkspace/topic/11762-posteffect-collection/page__st__20#entry89091 That would probably be the way to control Shadmar's shaders? But can you control stock shaders (ones that come with LE) in the same way? Quote Link to comment Share on other sites More sharing options...
Rastar Posted June 23, 2015 Share Posted June 23, 2015 I see the point. However, if you look at the API, you'll see that Camera:AddPostEffect accepts only string. That said, I cannot first load a shader and send a reference to the shader as a parameter to the camera. Rather, I send a string and never get the reference to the shader back from camera (at least in Lua and as far as I can see). The path parameter for Camera:AddPostEffect also accepts a Lua script which does the shader handling. I have no access to Leadwerks right now, but iirc the Bloom effect uses this approach (have a look at Shaders/PostProcess). 1 Quote Link to comment Share on other sites More sharing options...
Lunarovich Posted June 23, 2015 Author Share Posted June 23, 2015 The path parameter for Camera:AddPostEffect also accepts a Lua script which does the shader handling. I have no access to Leadwerks right now, but iirc the Bloom effect uses this approach (have a look at Shaders/PostProcess). Thanks! It occured to me to use also this approach. However, I wanted to see if there is a more direct approach. I'm asking all this because I have an idea of a gameplay based on various postprocessing parameter manipulations - different types of subjectivities manifested via different types of vision. 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.