Greetings!
I have problem having dynamically generated mask on C++ and using it in my custom renderpath Custom.xml.
i read documentation:
Note that if you already have created a named rendertarget texture in code and have stored it into the resource cache by using AddManualResource() you can use it directly as an output (by referring to its name) without requiring a rendertarget definition for it.
and probably miss something or using it in wrong way
in C++ I generate sampler
m_texture(new Urho3D::Image(context->context()));
m_texture->SetName("rtLightMap");
unsigned int width = 1024;
unsigned int height = 768;
m_texture->SetSize(width, height, 3, Urho3D::TEXTURE_RENDERTARGET);
for (int x=0; x<width; ++x) {
for (int y=0; y<height; ++y) {
m_texture->SetPixel(x, y, Urho3D::Color(1.0,1.0,1.0));
}
}
context->cache()->AddManualResource(m_texture);
in Custom.xml the following renderpath is described:
<rendertarget name="rtDiffuseMap" sizedivisor="1 1" format="rgba" />
<rendertarget name="rtNormalMap" sizedivisor="1 1" format="rgba" />
<command type="clear" color="0 0 0 0" output="rtDiffuseMap"></command>
<command type="clear" color="0 0 0 0" output="rtNormalMap"></command>
<command type="scenepass" pass="normal" output="rtNormalMap"></command>
<command type="scenepass" pass="diffuse" output="rtDiffuseMap"></command>
<command type="quad" vs="Urho2DCombine" ps="Urho2DCombine" output="viewport">
<texture unit="diffuse" name="rtDiffuseMap" />
<texture unit="normal" name="rtNormalMap" />
<texture unit="specular" name="rtLightMap" />
</command>
My final viewport is black, because the rendertarget=“rtLightMap” considered be black (I multiply by it’s color in shader Urho2DCombine). if I use the path “asteroid/concept/nm_combine_concept.png” instead of render target name, I got proper scene picture, but with static mask.
What I want to have, is dynamic mask in C++ and use it in my renderpath.
Could someone point me on what I was missing?
My appreciation in advance