There have been a few posts discussing Advanced Stencils and a scene or 2 showing how to nest Advanced Stencils into a hierarchy.
Been doing some research to try and better understand how the Stencil buffer works and would be grateful for a few explained answers.
What is the Reference property vs the Mask property?
Thanks all
Hello Ventuzians!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
Advanced Stencils
Moderator: Support
Re: Advanced Stencils
Hi Greg,
Reference is the actual value which is tested against.
The mask is applied to the reference value before the test. The mask can be used to use only certain bits of the reference value. It's is a bit wise AND operation. 3 in binary code is 0011. So applying this mask to a reference value, means only the lowest two bits of the reference value are used.
A mask value of -1 means the Reference is not masked at all. Cause -1 in binary code means every bit is 1.
Hope that helps a bit...
Reference is the actual value which is tested against.
The mask is applied to the reference value before the test. The mask can be used to use only certain bits of the reference value. It's is a bit wise AND operation. 3 in binary code is 0011. So applying this mask to a reference value, means only the lowest two bits of the reference value are used.
A mask value of -1 means the Reference is not masked at all. Cause -1 in binary code means every bit is 1.
Hope that helps a bit...
Re: Advanced Stencils
Götz,
Thanks for the clues. can you elaborate more what the reference is? Is it a grid of 8 bit numbers?
Thanks for the clues. can you elaborate more what the reference is? Is it a grid of 8 bit numbers?
Re: Advanced Stencils
The reference is an integer value - the stencil buffer is an integer buffer. The size is usually 8 Bits per pixel. Using the built in stencil nodes you can use one of eight layers. That's basically each bit used separately (reference value: 1, 2, 4, 8, ..). Using the advances stencil node you can define your own reference value (23, 42, ..). Using 2^n is useful because you can combine them and use the masking (see bit operations in programming languages). However in most cases you just need to mask an area, so you're usually just setting a reference value and check against it (equal or not equal). If you have several elements in screen that use stencil you should use different stencil reference values. Imagine a text box where you use stencil to limit text drawing to some box - if you have more than one box and they overlap, you could get undesired behaviour if you use the same reference value for all text boxes.