Find out which visleafs are visible from the leaf the light resides in - being able to cast shadows obviously requires visibility. If any of these leafs are also visible to you then you might see shadows.
In other words, if there are any leafs that are visible to both you and the light (including the one you are in, and the one the light is in) then you might see shadows there. If it's prohibitively expensive to walk visleafs (if even possible - which I should hope it's rather trivial) perform the check less frequently. The user likely won't notice a 100ms delay in a shadow turning on. Of course a change in the state of the light should also cause a check. The light turning on and then shadowing several frames later would be unsightly. > Date: Sat, 8 Aug 2009 14:03:47 +0200 > From: [email protected] > To: [email protected] > Subject: Re: [hlcoders] Checking to see if an object/world vector is in a > visible leaf? > > The only reliable way to do this is to find out exactly what leaves the > projector projects into and then see if any of them is in the PVS. After > searching the code, I found that there are some lists of all shadows in > the game, and that each leaf has a handle per shadow (projectors?). > > Try search clientleafsystem.cpp for more information, I'd gladly help in > more detail, but try and search it and see what comes up, you might need > to make some new functions, but it's possible. > > Problem with this: the light won't draw if it is out of PVS, even if > > surfaces it shines on are in. > > > > Testing the PVS of the entity and the end of a traceline down AbsAngles > > to a maximum of m_flFarZ /should/ overcome that...most of the time > > > > Kyle Gospodnetich wrote: > > > >> HLCoders wrote: > >> > >> > >>> After a very quick search in some header files, I think these two > >>> functions might interest you. > >>> > >>> bool IVRenderView::AreAnyLeavesVisible( int *leafList, int nLeaves ); > >>> int IEngineTrace::GetLeafContainingPoint( const Vector &ptTest ) = 0; > >>> > >>> I haven't tested them, but if they work like I think they do, this is > >>> how you'd do it. I think this is client-side too. > >>> > >>> bool ShouldDraw( const Vector &ptTest ) > >>> { > >>> int LeafNum = enginetrace->GetLeafContainingPoint(ptTest); > >>> return render.>AreAnyLeavesVisible(&LeafNum,1); > >>> } > >>> > >>> > >>> > >>>> Is it possible to check if an object or vector is within a visible > >>>> (currently being rendered) visleaf? I need to occlude an entity that > >>>> isn't normally occluded, and this is the best way I can think of doing > >>>> it. Any help is much appreciated. I can't find any examples of this in > >>>> the code. > >>>> > >>>> -Kyle '1/4 Life' G. > >>>> > >>>> _______________________________________________ > >>>> To unsubscribe, edit your list preferences, or view the list archives, > >>>> please visit: > >>>> http://list.valvesoftware.com/mailman/listinfo/hlcoders > >>>> > >>>> > >>>> > >>>> > >>>> > >>> _______________________________________________ > >>> To unsubscribe, edit your list preferences, or view the list archives, > >>> please visit: > >>> http://list.valvesoftware.com/mailman/listinfo/hlcoders > >>> > >>> > >>> > >>> > >>> > >> It works! > >> > >> Here, let me give back to the community: > >> If you want projected textures to occlude properly, head into > >> c_env_projectedtexture.cpp and add: > >> > >> ... > >> public: > >> DECLARE_CLIENTCLASS(); > >> > >> bool ShouldDraw( const Vector &vecOrigin ); > >> ... > >> > >> ... > >> bool C_EnvProjectedTexture::ShouldDraw( const Vector &vecOrigin ) > >> { > >> int LeafNum = enginetrace->GetLeafContainingPoint(vecOrigin); > >> return render->AreAnyLeavesVisible(&LeafNum,1); > >> } > >> ... > >> > >> Change > >> > >> if ( m_bState == false ) > >> { > >> > >> To > >> > >> if ( m_bState == false || !ShouldDraw( GetAbsOrigin() ) ) > >> { > >> > >> in UpdateLight() > >> > >> And finally: > >> > >> void C_EnvProjectedTexture::Simulate( void ) > >> { > >> //UpdateLight( false ); > >> UpdateLight( true ); > >> > >> BaseClass::Simulate(); > >> } > >> > >> _______________________________________________ > >> To unsubscribe, edit your list preferences, or view the list archives, > >> please visit: > >> http://list.valvesoftware.com/mailman/listinfo/hlcoders > >> > >> > >> > >> > > > > > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, > > please visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

