Jump to content

Post-processing material parameter


photo

Recommended Posts

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

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

  • Like 1
Link to comment

Dear @michal,

Set post process material in Editor. Or you may set it using C++ api.

image.thumb.png.ecebf61aa47025318d5025f223ae51a3.png

 

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

  • Like 1
Link to comment
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.

image.thumb.png.ecebf61aa47025318d5025f223ae51a3.png

 

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
×
×
  • Create New...