Ambient occlusion, is it possible?

I'd love to see ambient occlusion in Racer for loads of reasons... and good old self-shadowing for car interiors.

Is this a CG/shader thing to refine and get working, or is there hard coding behind the scenes that Ruud needs to complete to allow these things to happen?!


Dave
 
I'm afraid, currently in Racer, neither cannot be done by just implementing the shaders.

I assume, you're talking about Screen Space Ambient Occlusion? Afaik, it is not just making the shaders, but the algorithm for rendering a frame needs to be (hard) coded as well. There are quite a lot of material on GameDev.net, have a look.

As for shadows (shadow mapping is the way to go IMHO), a shadow map needs to be rendered for each light (in the simplest case - only for the sun) and then fed to all shaders that are affected by shadows.

I really don't want to have stenciled shadows, where you cannot cut the specular light in the shadowed area etc..
 
Yeah, shadow maps seems the way forward.

I'm just playing PGR2 here (Xbox1) with interior shadowing, and also GT5P on the PS3, and it has it too... Xbox1 and PGR1 is old, and GT5P is getting on now.

We have CG graphics yet this whole hardcoded old shadow system and lighting system seems to be hindering Racers visuals.

OK, for the old shaders and the really old gfx system that is fine, but holding on to it all for CG stuff seems to be limiting us moving forward :(


Really looking forward to these additions, since almost all current and last-gen games had these features and now with Racer still not having them (when in the past Racer kinda kept pace with what was out there, or better than), makes Racer look a bit limited.


Dave
 
Funny this subject pops up. Cascaded shadow maps is almost up and running for Racer ! I'm gonna finish up the shaders and the ini settings next week. And ambient occlusion would be nice too, i will try to put taht high on the "to-do" list.
 
Back when we were on RSC I posted a link to a website that had info about cg generated shadows. I tried to use them but my very limited knowledge of cg's rendered them unuseable. I'll look to see if I still have the info and post it tomorrow night.

I found the info the 7z file has a .mht file that will open in your browser.
 

Attachments

  • Rendering Fake Soft Shadows with Smoothies.7z
    76 KB · Views: 261
i stopped with this:

http://rapidshare.com/files/353335149/ssoa.rar

the problem was this function:

Code:
float3 fetch_eye_pos(float2 uv)
{
    float z = tLinDepth.SampleLevel(samNearest, float3(uv, 0), 0);
    return uv_to_eye(uv, z);
}
I'm not an expert in HLSL so don't really know what "SampleLevel" does, it has something to do with mipmapping or something.
also, the depth map seems to be linear, so the racer depth map needs to be converted.
It would be nice to see what you come up with without looking at my code first.
I suggest you also use the horizon based AO since that is the best one.

I see two possible problems with my shader:
- The constants might be wrong
- the samplelevel thing


If i was able to run the sample code i could pinpoint the problem ...
 
that's not really necessary, you can just replace that by 0.0.

i'm almost there by the way, i'm getting some ambient occlusion in one half of my screen ... really bizar bug. :) almost there
 
untitled..JPG
almost there ! :)
 
I've gotta tell ya, i'm blown away by this SSAO stuff, it's absolutly amazing.

here is the fullscreen shader:
http://rapidshare.com/files/353374955/ssao_final.rar

It needs a lot of tweaking in the constant section (in ssoa.cg). Post the best settings you can find here. I'm gonna implement this as a feature as soon as possible.

screen:
ssao..JPG


edit:

If you want to use the shader, "ssao.cg" as fs_filter1 (extract the shader files in the fullscreen shader folder)

adjust the variable "f" in the shader with fx.visibility defined in racer.ini

you can find it here in ssoa_conv.cg:
Code:
float3 fetch_eye_pos(float2 uv, sampler2D depthMap)
{
    // tLinDepth.SampleLevel(samNearest, float3(uv, 0), 0);
    //float4 depth = tex2D(depthMap,uv);
    
    float f=750.0f; // adjust this to match fx.visibility from racer.ini
    float n = 0.1f;
    float z = (2 * n) / (f + n - tex2D( depthMap, float2(uv) ).z * (f - n));
    
    return uv_to_eye(uv, z);
}
edit2:

in ssao.cg change the rand value to 1.0f/reswidth for the best result

Code:
float3 rand=1.0f/1024.0f;

we are probably gonna need a normal texture to make it look real good, but this really shows off how good i could be
 
Fantastic work :D

The level of realism added just with this is astonishing.

No more 2d shadow maps for the ambient occlusion under the car needed then :D

Saves baking vertex lighting into tracks too!

Tyres that are under the car will appear dark, but as they steer out into the light, or the suspension extends, they will light up a bit. All these lovely little visual details will now be evident and not need faking or being evident as wrong :)


Can't wait to try it...!


Dave
 
I'm gonna implement this as a feature as soon as possible.

While you are working on this, can you please look into making the naming convention of the fs shaders a bit more logical, and layered?

Ie, I don't like vignetting, but do like HDR and motion blur.

Is there any way you can make the fs shaders have good names and/or be commented well enough so we can just turn off some lines in the fs shader files to turn features on/off.

Ie, bloom_hdr_vign_blur_ssao.cg would be the name for the file with all the features on, but also there is one with the same name but no _vign, which has all the same stuff, but no vignetting?

Or perhaps just make it clear in one general fs_shader with comments which bits to comment out to turn effects on/off etc?!


Thanks

Dave
 

Latest News

Online or Offline racing?

  • 100% online racing

    Votes: 72 7.4%
  • 75% online 25% offline

    Votes: 101 10.4%
  • 50% online 50% offline

    Votes: 141 14.5%
  • 25% online 75% offline

    Votes: 266 27.4%
  • 100% offline racing

    Votes: 386 39.8%
  • Something else, explain in comment

    Votes: 4 0.4%
Back
Top