kevin Posted October 1, 2015 Share Posted October 1, 2015 I'm having a few issues with decals in C++, particularly masking. I understand the idea behind bit masking (e.g. this), but there seems to be an issue with the implementation. I've modified the C++ Api/Nodes/Objects example (source attached, see below for the relevant code) to include a simple decal projecting down onto the four dynamic meshes in the scene. Then I set the bit masks for the one of the objects and the decal to unique bit masks. However, the decal still hits all objects in the scene. Can someone tell me what I'm missing? Unigine::DecalDeferredOrthoPtr decal = Unigine::DecalDeferredOrtho::create(1000.f, 64, 64, "decal_deferred_base"); decal->setZNear(0); Unigine::MaterialPtr material = decal->getMaterialInherit(); Unigine::ImagePtr teximg = Unigine::Image::create("samples/materials/textures/layer_00_0_d.dds"); material->setImageTextureImage(material->findTexture("diffuse"), teximg); decal->setDecalMask(1 << 0); objects[3]->setDecalMask(1 << 1, 0); printf("decal->getDecalMask() & object[3]->getDecalMask = %d\n", decal->getDecalMask() & objects[3]->getDecalMask(0)); One a related note: how can I make the orthographic decal project both forwards and backwards? I understand that orthographic decals are based on an ortho projection, and I've tried to set the znear value to negative (e.g. ortho(left, right, bottom, top, -100000, 100000)) in the Unigine source (because Unigine::Decal has guards against znear being < 0), but no matter the znear value, the decal never projects in both directions. Thanks, Kevin Objects.cpp Link to comment
kevin Posted October 1, 2015 Author Share Posted October 1, 2015 Update: I just played with decal masks in the editor for a bit. DecalObject decal masks work fine, but DecalDeferred masks do not. Setting the masks to different values still displays the decal if it's deferred. If it's an object decal, everything displays correctly. Anyone know why this is? Thanks, Kevin Link to comment
maxi Posted October 12, 2015 Share Posted October 12, 2015 Hi Kevin, You are right, decal mask isn't working in old DecalDeferred for some reason. Please, check out new release, where this problem isn't exist. Decal mask now is configured in materials. Link to comment
kevin Posted October 14, 2015 Author Share Posted October 14, 2015 Thanks, I'll check out the update. Link to comment
Recommended Posts