michal Posted August 21, 2020 Share Posted August 21, 2020 hi, I would like to know if it is possible to set a parameter for post-process material via C++ API. Unigine::Render::setPostMaterials("post_hblur_gauss"); // like Uniigine::Render::setPostMaterialParam("Radius",2.2); thanks Link to comment
devrom Posted August 21, 2020 Share Posted August 21, 2020 Hey Michal, this thread should help you out: You can find the .basemat-file in your sdk installation: data/core/materials/default/post/post_hblur_gauss.basemat You need to inherit it and change the parameter just like in the linked thread. Best regards 1 Link to comment
rohit.gonsalves Posted August 21, 2020 Share Posted August 21, 2020 Dear @michal, Set post process material in Editor. Or you may set it using C++ api. In AppWorldLogic::update. Just a simple step like this. const char* stringMaterial = Render::getPostMaterials(); MaterialPtr material = Materials::findMaterial(stringMaterial); rTimeThatGoesForever += Game::getIFps(); float fValue = sin(rTimeThatGoesForever); material->setParameterFloat("radius", fValue); This is just an example. Actually, the string returned will be combined one separated with comma. So you need to separate the material names and use them. Rohit 1 Link to comment
michal Posted August 24, 2020 Author Share Posted August 24, 2020 On 8/21/2020 at 5:44 PM, rohit.gonsalves said: Dear @michal, Set post process material in Editor. Or you may set it using C++ api. In AppWorldLogic::update. Just a simple step like this. const char* stringMaterial = Render::getPostMaterials(); MaterialPtr material = Materials::findMaterial(stringMaterial); rTimeThatGoesForever += Game::getIFps(); float fValue = sin(rTimeThatGoesForever); material->setParameterFloat("radius", fValue); This is just an example. Actually, the string returned will be combined one separated with comma. So you need to separate the material names and use them. Rohit yes this exactly occurred to me first, when I didn't see the change so I thought I'm going for it wrong. Now I tried to use "post_filter_sobel" instead of "post_hblur_gauss" and the scale parameter and the material is really changing. thanks Link to comment
Recommended Posts