I used the ambient occlusion (AO), described a couple of days ago, baked in to the texture of the model.
Now I have AO pre-calculated I have removed the awkward and artifact prone self shadowing from the models. For that purpose I am using ID based shadow maps.
There was surprisingly little information easily available on the Internet. Perhaps I searched for the wrong key words. Anyway, most of the ID shadow code is based on one of the many other shadow and filter methods I have tried up to now.
The difference being that instead of comparing the stored shadow depth it simply checks if the thing closest to the light is it'self or not using a unique index number for each model.
The tricky bit I found with ID shadow maps was converting a signed integer to a float in Shader Model 3. In the newer Shader Model 4 there are loads of built in methods to do that and I could have used an unsigned int which would have been even easier. None of that was available for the Xbox shader though! I used the following simple code:
// Consistently convert a signed integer32 to a float
// in the range 0.0f to 1.0f
float IntToFloat(int inputID)
{
// The maximum value for a signed 32 bit integer
return (float)inputID / 2147483647.0f;
}
Once everything was a float it was easy to compare.
==
Unrelated to any of the above I have just exceeded the free 200M capacity of the Subversion (SVN) hosting service I have been using. The project including documentation is 128M and the rest must be the change history. I have become used to using source control and would miss it if it was not there so I have decided to pay for more capacity rather than mess about chopping up the project in to smaller chunks or trying to manage my own server. I am trying out a couple of the lower cost SVN hosts to decide which I will use going forwards.
No comments:
Post a Comment