Game Development Community

Small render boost from terrRender.cpp

by Caylo Gypsyblood · in Torque 3D Professional · 12/17/2010 (1:08 am) · 5 replies

In the process of tossing together a prototype what use unusual terrain features(high plateaus and low valleys), PSSM terrain shadows provided to be undesirable (and buggy[?]).

In an ignorant preemptive first attempt to see how easy turning terrain generated terrain shadows off would be, I did the following;

In file terrRender.cpp
find const bool isColorDrawPass = state->isDiffusePass() || state->isReflectPass();
and directly below place if ( !isColorDrawPass ) return;

I assume with this modification we are skipping out on the shadow render pass?

One side effect is a decent FPS improvement, under the right conditions, and I have yet to notice any ill effects.

#1
12/17/2010 (4:09 am)
Yea... that just removes the terrain from shadow casting. It may work for some people and will save some draw calls and fillrate.
#2
12/17/2010 (4:46 am)
Cool, thanks for confirming that Tom.
#3
12/17/2010 (12:41 pm)
Just Cause 2 also does this: the terrain itself doesn't cast shadows. It improves performance, allow a higher shadow quality (since the shadow frustum doesn't need to be big enough to fit the terrain) and avoids large shadowed areas (which would look flat).
#4
12/21/2010 (8:50 pm)
Hmmm... I'm going to try this, because depending on the time of day, performance varies wildly. Best performance is at "night" but only after the moon rises, with performance at absolute nadir in the hours between sunset and moonrise.

Thanks for posting it as a suggestion.
#5
12/25/2010 (3:45 am)
Cool stuff! This was really helpful for us. We are doing an isometric looking game, and the terrain is flat in most locations, and it casting shadows was a real waste of good fps! =)