Ogre - Turning off shadow casting for individual objects.

Everything related to 3D programming
Krix
User
User
Posts: 66
Joined: Fri Mar 11, 2005 6:24 pm
Location: Toronto

Ogre - Turning off shadow casting for individual objects.

Post by Krix »

Undocumented EntityRenderMode mode for disabling shadow casting per entity!

Almost wrote a feature request when I discovered that the WorldShadows Type: #PB_Shadow_None also a mode for EntityRenderMode so EntityRenderMode(1, #PB_Shadow_None) turns off the shadow casting for entity one. Works both with stencil and texture shadow.

The entity still receives shadow cast by other objects/meshes in the 3D world and that can cause some visual glitches in certain situations so that's something to look out for but it gives an extra level of flexibility with shadows and in certain situation it's absolutely necessary to be able to turn off shadow casting for an individual mesh. So I'm really glad this feature is in already too bad it wasn't documented. Did you guys know about that this was already in PureBasic?

Fun fact! As far as I know the first PureBasic version that had shadow support in it was V4.00! As soon as shadow functions were implemented the EntityRenderMode immediately got the mode #PB_Shadow_None along with #PB_Entity_CastShadow...back in 2006...but never got documented.
Last edited by Krix on Thu Jan 26, 2017 10:22 pm, edited 1 time in total.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Ogre - Turning off shadow casting for individual objects

Post by applePi »

yes i know about disabling certain entity shadow, but never tried it.
while searching my archives i have found
about self shadowing
http://www.purebasic.fr/english/viewtop ... 60#p450970
look my example there
when i choose WorldShadows(#PB_Shadow_Modulative) there is a shadow on the ground
but with WorldShadows(#PB_Shadow_Additive) there is no shadow on the ground
but comment line 42
SetMaterialColor(5, #PB_Material_SelfIlluminationColor, $FFFFFF)
and the #PB_Shadow_Additive will work again. this is i have found just now. it is logical since we can't see a shadow over a very bright object, use RGB(100,100,100) instead of $FFFFFF and we have diluted shadow. #PB_Shadow_Modulative works everywhere but it is less accurate.
but what annoys me in the above example is that the tip shadow over the robot head is too long so may be its shadow is wrong. there is a need for more tests. the internal shadow generating is too complex so we choose what is suitable .
Post Reply