I recently had some trouble with stencil shadows, which turned out to be due to a query mask value of zero, which I had intended to mean that the entity in question is not pickable using the mouse.
Mouse picks are usually implemented using ray queries, so I guess one could argue that query masks have a greater purpose than just user interaction, and that ray queries are just a subset of all possible scene queries. Nevertheless, the side effect I was experiencing seems quite hard to grasp for the average user. My two questions to someone who understands the design rationale behind the implementation:
Is the query mask really needed when rendering stencil shadows? There is a check for isInScene in there after all.
Are scene queries using query masks used in some other subsystem that I (and possibly others) should be aware of when adjusting the mask values?
In general, a list of things that query masks are used for would be nice, preferably in the API documentation, of course.
Query masks: design rationale and intended usage?
-
- Halfling
- Posts: 40
- Joined: Sat Dec 09, 2006 9:06 am
-
- Gnoblar
- Posts: 1
- Joined: Wed Aug 28, 2013 7:12 pm
Re: Query masks: design rationale and intended usage?
Hi,tp wrote: Nevertheless, the side effect I was experiencing seems quite hard to grasp for the average user. There was more information here
What type of side effect you have experienced, which could be hard to grasp for the normal/average user?
Last edited by wiliamjack703 on Wed Oct 30, 2013 11:27 pm, edited 1 time in total.
- Kojack
- OGRE Moderator
- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 534
Re: Query masks: design rationale and intended usage?
An AABB query is performed when generating stencil shadows, the scene manager builds the AABB so it fits the camera frustum then finds all objects within it to cast shadows.
There are no other scene queries performed during typical operation (I breakpointed the query code, but there might be some performed only under special circumstances).
The basic problem is that setting a scene query mask of 0 on an entity will make it not render stencil shadows. If you want to have an object ignored by your own scene queries but still render stencil shadows, then give it a querymask using a higher bit value than you are using. So if you are using 1, 2 and 4 as masks, then make 8 be the value for non selecting and use 7 (combination of 1,2,4) as the mask in the query.
There are no other scene queries performed during typical operation (I breakpointed the query code, but there might be some performed only under special circumstances).
Hmmm, the first post here was 4 years ago and the poster hasn't even logged in to the forum in the last 2.5 years. I don't think you will be getting an answer.wiliamjack703 wrote:Hi,
What type of side effect you have experienced, which could be hard to grasp for the normal/average user?
The basic problem is that setting a scene query mask of 0 on an entity will make it not render stencil shadows. If you want to have an object ignored by your own scene queries but still render stencil shadows, then give it a querymask using a higher bit value than you are using. So if you are using 1, 2 and 4 as masks, then make 8 be the value for non selecting and use 7 (combination of 1,2,4) as the mask in the query.