Ambient Occlusion Demo
Yes, that is the nature of ambient occlusion. I wouldn't call this "incorrect" though.JP wrote:Notice that the lightmap is incorrect when you rotate the model? The lighting appears the same for all the tombstones (or whatever they are), regardless of their rotation.
dlangdev: The "final" scene you posted doesn't apear to have any ambient occlusion. Those shadows look real-time to me.
-
- Posts: 199
- Joined: Wed Nov 29, 2006 4:07 am
shadows != AO
Static AO is an outdoor light-bouncing type effect. Blender has had it for years now. If done correctly, its hardly even noticable, except that everything just looks "more real".
The downside is that anything that moves in the AO scene is going to look horribly out of place. Unless you use an AO shader on the moving objects (nice one Blindside!)
dlangdev, speed up Blender's AO by changing it to approximate. It wont look quite as good, but its ALOT faster, (because you dont need raytrace turned on)and it will blend with a realtime AO'd objects better
Static AO is an outdoor light-bouncing type effect. Blender has had it for years now. If done correctly, its hardly even noticable, except that everything just looks "more real".
The downside is that anything that moves in the AO scene is going to look horribly out of place. Unless you use an AO shader on the moving objects (nice one Blindside!)
dlangdev, speed up Blender's AO by changing it to approximate. It wont look quite as good, but its ALOT faster, (because you dont need raytrace turned on)and it will blend with a realtime AO'd objects better
Signature? I ain't signin nuthin!
AO doesn't need a light source, it uses disks or a depth map to figure out shades of grey.
The "final" scene you posted doesn't apear to have any ambient occlusion. Those shadows look real-time to me.
They were made in 3DS Max. I only use blender. I would imagine 3DS Max has better shadows/AO.
It would be nice to have SSAO, but Blindside is keeping it a secret.
Well, it's not going to be a secret soon, once I get my butt going and playing around with RenderMonkey. Multi-sampling is definitely going to be hard, though.
SSAO isn't that much of a secret. In fact, jinquan has implemented it into his engine, shown the demos, and I believe he even gave the code for. At any rate, it's all over GameDev as well.
And yes, AO is meant as a simulation of shadows. It is supposed to catch the little soft shadows that can't be done well with shadowing techniques. Basically, set a sofa, or something smaller, closer and closer against the wall. Notice the soft shadow that begins to form as it gets closer and closer. AO simulates what happens when objects are close to each other like that for shadowing. Usually by analyzing the depth map, as dlangdev said, and taking into account, in a variation of ways, the angle between the objects.
And yes, AO is meant as a simulation of shadows. It is supposed to catch the little soft shadows that can't be done well with shadowing techniques. Basically, set a sofa, or something smaller, closer and closer against the wall. Notice the soft shadow that begins to form as it gets closer and closer. AO simulates what happens when objects are close to each other like that for shadowing. Usually by analyzing the depth map, as dlangdev said, and taking into account, in a variation of ways, the angle between the objects.
TheQuestion = 2B || !2B
-
- Posts: 199
- Joined: Wed Nov 29, 2006 4:07 am
Shadows are a blockage of direct light, while AO is a simulation of the occlusion of indirect lighting (bounced). Two totally different things
http://en.wikipedia.org/wiki/Ambient_occlusion
http://en.wikipedia.org/wiki/Ambient_occlusion
Signature? I ain't signin nuthin!
It's not a secret, look here: http://www.gamedev.net/community/forums ... hichPage=2It would be nice to have SSAO, but Blindside is keeping it a secret.
Theres alot of source code that'll plug more or less directly into XEffects (Using it's depth map rendering features). You can also search for jinquan's SSAO topic where he posted the source code (And his version is pretty identical to mine).
Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Blindside, need your help.
Can you help me figure out the Ambient Occlusion code posted on the link you provided. I made a sample demo program and I'm stuck generating the DepthMap RTT.
Should I simply get the Z-value and stuff it to gl_FragColor? I want to interface the Z-value to the AO demo, tho.
Shader Code:
Render Loop:
Here is the screenshot.
Texture shows the content of the depthMap. It looks like the Z-value is getting in there. Is that OK? do I need to divide it by w?
Can you help me figure out the Ambient Occlusion code posted on the link you provided. I made a sample demo program and I'm stuck generating the DepthMap RTT.
Should I simply get the Z-value and stuff it to gl_FragColor? I want to interface the Z-value to the AO demo, tho.
Shader Code:
Code: Select all
uniform sampler2D myTexture;
uniform sampler2D depthMap;
void main (void)
{
//vec3 col = gl_TexCoord[0].z;
vec3 col = gl_Position.z;
//vec3 col = gl_Position.z/gl_Position.w;
gl_FragColor = vec4(col,1.0) *2.0;
}
Code: Select all
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);
driver->setRenderTarget(depthMap, true, true, video::SColor(0,0,0,255));
for ( int i=0; i<17; i++) {
room->getMaterial(i).MaterialType = (video::E_MATERIAL_TYPE)newMaterialType2;
}
smgr->drawAll();
driver->setRenderTarget(0, true, true, 0);
for ( int i=0; i<17; i++) {
room->getMaterial(i).MaterialType = (video::E_MATERIAL_TYPE)newMaterialType1;
}
smgr->drawAll();
env->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Per pixel lighting example - Irrlicht Engine [";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}
Texture shows the content of the depthMap. It looks like the Z-value is getting in there. Is that OK? do I need to divide it by w?
OK, I think I have an idea how to put the two texture maps into the final render. It looks like I need a screen quad for rendering the depth and color maps, tho.
Is there a simple way of setting-up the screen quad, I mean the simplest least-amount of code? I can setup the render to have three passes.
Is there a simple way of setting-up the screen quad, I mean the simplest least-amount of code? I can setup the render to have three passes.