This is the
talk page for discussing improvements to the
Ambient occlusion article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find video game sources: "Ambient occlusion" – news · newspapers · books · scholar · JSTOR · free images · free news sources · TWL · NYT · WP reference · VG/RS · VG/RL · WPVG/Talk |
This article is rated C-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||
|
Total and utter crap, this article must be rewritten from scratch. — Preceding unsigned comment added by 79.52.243.58 ( talk) 19:38, 19 March 2013 (UTC)
This picture needs shadows to illustrate the point better, even though this isn't an article about shadows. It looks wrong without them, and they would be used in a real-life application. Same with the combined picture. Erudecorp 22:09, 22 October 2007 (UTC)
"Ambient occlusion" doesn't actually represent any real-world optical effect, it's a very rough approximation of shadows that "looks better" in many cases, but it produces a number of effects that are just plain wrong. In the real world, for example, you don't get dark regions at the intersection of two plane surfaces (the corner of a room, for example) simply from ambient light... yet this is a classic example trotted out to "demonstrate ambient occlusion". Try it... take some photographs of matte painted corners in a diffusely-lighted environment, any place where two corners actually come together the lighting is uniform all the way to the intersection. The only places I have been able to see such shadows is when you've got a nearby point source, and the corners are darker simply because they're further from the source... and there are better ways to simulate that effect! -- Resuna ( talk) 19:10, 21 July 2008 (UTC)
Hello all...
An image used in the article, specifically Image:Aocclude hemisphere.png, has a little bit of a licensing issue. The image was uploaded back when the rules around image uploading were less restrictive. It is presumed that the uploader was willing to license the picture under the GFDL license but was not clear in that regard. As such, the image, while not at risk of deletion, is likely not clearly licensed to allow for free use in any future use of this article. If anyone has an image that can replace this, or can go take one and upload it, it would be best.
You have your mission, take your camera and start clicking.-- Jordan 1972 ( talk) 22:11, 29 September 2008 (UTC)
Am I correct, that ambient occlusion came to computer games graphics first time with directx 10.1 version or earlier?
It seems, that ambient lighting only comes from above, but sky or clouds illuminating light from all directions except earth. So 5 parallel light sources (with light colour of each plane depending on skybox average colour, somthing like, where no clouds colour blue and where is clouds light colour more bright blank blue) can give much realism, only don't need use shadows, but only for diffuse illumination of object (depending on angle between light and object surface normal). But if use shadows some blur can be if it is possible. Of course some half sphere from inside lighting would be almost exact model except coulours (light can't change colour if sky have bright clouds or not), but it's almost impossible, so 5 planes should do we trick, if for example from one side is object blocked with over object, then diffuse little bit changing, even if there no sun in sky (sun under big clouds). Maybe ambient occlusion is that I talking, for example instead 5 lights, to use 20 lights and to blur all shadows somehow. In such way we get ambient occlusion and some diffuse lighting from sky. — Preceding unsigned comment added by Versatranitsonlywaytofly ( talk • contribs) 21:56, 24 November 2011 (UTC)
you can simplify the process even more because the most important components of the lighting are the sky and ground reflection colors. Going with this assumption, the process of finding out the total lighting for a particular microfacet of your object becomes a matter of determining the appropriate blend of both the sky and ground colors. This process is illustrated in Figure 17.3. Note that this approach can work well for any circumstance when lighting can be simplified by the representation of two sources of light, one coming from the ground and the other from above, and is not restricted to only outdoor scenes, although it is the most obvious example. To achieve the appropriate blend, you need to determine the proportion of the microfacet hemisphere that corresponds to the sky and ground portions. Without getting into the mathematical details, such integration is simply a matter of interpolating the sky and ground color in relationship to the dot product of surface normal and a vector pointing towards the sky. Doing so yields the following vertex shader code:
blendFactor = (dot(inNormal, float3(0,-1,0)) + 1.0)/2.0;
object, taking in both the position and the normals for the object vertices. In addition to the standard components, you need two extra variables to store the color of the ground and sky.With this, your vertex shader simply needs to take in the vertex normal, compute the blending factor, and use the lerp function to blend both colors. The following is the resulting vertex shader:
float4x4 view_proj_matrix; float4 sky_color; float4 ground_color; struct VS_OUTPUT { float4 Pos: POSITION; float4 Diff: COLOR; float4 Tex: TEXCOORD; }; VS_OUTPUT vs_main( float4 inPosition: POSITION, float4 inNormal: NORMAL, float4 inTex: TEXCOORD ) { VS_OUTPUT Out; // Transform the position and output the texture coordinate Out.Pos = mul( view_proj_matrix, inPosition); Out.Tex = inTex; // Determine the sky/ground factor float factor = (dot(inNormal, float3(0,-1,0)) + 1.0)/2.0; // Determine final lighting color Out.Diff = lerp(sky_color,ground_color,factor); // lerp(x, y, z)=x+z*(y-x) and lerp(x, y, 0.5)=(x+y)/2 Out.Diff.a = 1.0; return Out; } // For example: // float factor = (dot(float3(0.6, 0.8, 0), float3(0,-1,0)) + 1.0)/2.0; //factor=([0.6*0+0.8*(-1)+0*0]+1)/2=(-0.8+1)/2=0.1 // Out.Diff = lerp(sky_color,ground_color,factor); // Out.Diff=float3(0, 0.75, 1)+0.1*(float3(0, 0.5, 0)-float3(0, 0.75, 1))= // =float3(0, 0.75, 1)+0.1*float3(0, -0.25, -1)=float3(0, 0.75-0.025, 1-0.1)=float3(0, 0.725, 0.9) // Another example if clear sky and sun illuminating grass: // float factor = (dot(float3(0.866, 0.5, 0), float3(0,-1,0)) + 1.0)/2.0; //factor=([0.866*0+0.5*(-1)+0*0]+1)/2=(-0.5+1)/2=0.25 // Out.Diff = lerp(sky_color,ground_color,factor); // Out.Diff=float3(0, 0.75, 1)+0.25*(float3(0, 1, 0)-float3(0, 0.75, 1))= // =float3(0, 0.75, 1)+0.25*float3(0, 0.25, -1)=float3(0, 0.75+0.0625, 1-0.25)=float3(0, 0.8125, 0.75) // this is result if not counting [in] direct sun lighting on triangle (on microfacet)
interpolated value with the texture color of your object, yielding the following pixel
shader code: sampler color_map; float4 ps_main( float4 inDiff: COLOR, float4 inTex: TEXCOORD ) : COLOR { // Return the hemisphere color modulated // with the color of the base texture return inDiff * tex2D(color_map, inTex); }
on a per-vertex basis but can easily be adapted to do the same in a per-pixel (bump mapped surface normal taken) manner.
reasons worth mentioning; the first is the quality of the rendering results versus its ease of implementation. It is essentially a great, low-cost way of representing ambient lighting.
there are
This is the
talk page for discussing improvements to the
Ambient occlusion article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find video game sources: "Ambient occlusion" – news · newspapers · books · scholar · JSTOR · free images · free news sources · TWL · NYT · WP reference · VG/RS · VG/RL · WPVG/Talk |
This article is rated C-class on Wikipedia's
content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||||||||||||||||||||||||||
|
Total and utter crap, this article must be rewritten from scratch. — Preceding unsigned comment added by 79.52.243.58 ( talk) 19:38, 19 March 2013 (UTC)
This picture needs shadows to illustrate the point better, even though this isn't an article about shadows. It looks wrong without them, and they would be used in a real-life application. Same with the combined picture. Erudecorp 22:09, 22 October 2007 (UTC)
"Ambient occlusion" doesn't actually represent any real-world optical effect, it's a very rough approximation of shadows that "looks better" in many cases, but it produces a number of effects that are just plain wrong. In the real world, for example, you don't get dark regions at the intersection of two plane surfaces (the corner of a room, for example) simply from ambient light... yet this is a classic example trotted out to "demonstrate ambient occlusion". Try it... take some photographs of matte painted corners in a diffusely-lighted environment, any place where two corners actually come together the lighting is uniform all the way to the intersection. The only places I have been able to see such shadows is when you've got a nearby point source, and the corners are darker simply because they're further from the source... and there are better ways to simulate that effect! -- Resuna ( talk) 19:10, 21 July 2008 (UTC)
Hello all...
An image used in the article, specifically Image:Aocclude hemisphere.png, has a little bit of a licensing issue. The image was uploaded back when the rules around image uploading were less restrictive. It is presumed that the uploader was willing to license the picture under the GFDL license but was not clear in that regard. As such, the image, while not at risk of deletion, is likely not clearly licensed to allow for free use in any future use of this article. If anyone has an image that can replace this, or can go take one and upload it, it would be best.
You have your mission, take your camera and start clicking.-- Jordan 1972 ( talk) 22:11, 29 September 2008 (UTC)
Am I correct, that ambient occlusion came to computer games graphics first time with directx 10.1 version or earlier?
It seems, that ambient lighting only comes from above, but sky or clouds illuminating light from all directions except earth. So 5 parallel light sources (with light colour of each plane depending on skybox average colour, somthing like, where no clouds colour blue and where is clouds light colour more bright blank blue) can give much realism, only don't need use shadows, but only for diffuse illumination of object (depending on angle between light and object surface normal). But if use shadows some blur can be if it is possible. Of course some half sphere from inside lighting would be almost exact model except coulours (light can't change colour if sky have bright clouds or not), but it's almost impossible, so 5 planes should do we trick, if for example from one side is object blocked with over object, then diffuse little bit changing, even if there no sun in sky (sun under big clouds). Maybe ambient occlusion is that I talking, for example instead 5 lights, to use 20 lights and to blur all shadows somehow. In such way we get ambient occlusion and some diffuse lighting from sky. — Preceding unsigned comment added by Versatranitsonlywaytofly ( talk • contribs) 21:56, 24 November 2011 (UTC)
you can simplify the process even more because the most important components of the lighting are the sky and ground reflection colors. Going with this assumption, the process of finding out the total lighting for a particular microfacet of your object becomes a matter of determining the appropriate blend of both the sky and ground colors. This process is illustrated in Figure 17.3. Note that this approach can work well for any circumstance when lighting can be simplified by the representation of two sources of light, one coming from the ground and the other from above, and is not restricted to only outdoor scenes, although it is the most obvious example. To achieve the appropriate blend, you need to determine the proportion of the microfacet hemisphere that corresponds to the sky and ground portions. Without getting into the mathematical details, such integration is simply a matter of interpolating the sky and ground color in relationship to the dot product of surface normal and a vector pointing towards the sky. Doing so yields the following vertex shader code:
blendFactor = (dot(inNormal, float3(0,-1,0)) + 1.0)/2.0;
object, taking in both the position and the normals for the object vertices. In addition to the standard components, you need two extra variables to store the color of the ground and sky.With this, your vertex shader simply needs to take in the vertex normal, compute the blending factor, and use the lerp function to blend both colors. The following is the resulting vertex shader:
float4x4 view_proj_matrix; float4 sky_color; float4 ground_color; struct VS_OUTPUT { float4 Pos: POSITION; float4 Diff: COLOR; float4 Tex: TEXCOORD; }; VS_OUTPUT vs_main( float4 inPosition: POSITION, float4 inNormal: NORMAL, float4 inTex: TEXCOORD ) { VS_OUTPUT Out; // Transform the position and output the texture coordinate Out.Pos = mul( view_proj_matrix, inPosition); Out.Tex = inTex; // Determine the sky/ground factor float factor = (dot(inNormal, float3(0,-1,0)) + 1.0)/2.0; // Determine final lighting color Out.Diff = lerp(sky_color,ground_color,factor); // lerp(x, y, z)=x+z*(y-x) and lerp(x, y, 0.5)=(x+y)/2 Out.Diff.a = 1.0; return Out; } // For example: // float factor = (dot(float3(0.6, 0.8, 0), float3(0,-1,0)) + 1.0)/2.0; //factor=([0.6*0+0.8*(-1)+0*0]+1)/2=(-0.8+1)/2=0.1 // Out.Diff = lerp(sky_color,ground_color,factor); // Out.Diff=float3(0, 0.75, 1)+0.1*(float3(0, 0.5, 0)-float3(0, 0.75, 1))= // =float3(0, 0.75, 1)+0.1*float3(0, -0.25, -1)=float3(0, 0.75-0.025, 1-0.1)=float3(0, 0.725, 0.9) // Another example if clear sky and sun illuminating grass: // float factor = (dot(float3(0.866, 0.5, 0), float3(0,-1,0)) + 1.0)/2.0; //factor=([0.866*0+0.5*(-1)+0*0]+1)/2=(-0.5+1)/2=0.25 // Out.Diff = lerp(sky_color,ground_color,factor); // Out.Diff=float3(0, 0.75, 1)+0.25*(float3(0, 1, 0)-float3(0, 0.75, 1))= // =float3(0, 0.75, 1)+0.25*float3(0, 0.25, -1)=float3(0, 0.75+0.0625, 1-0.25)=float3(0, 0.8125, 0.75) // this is result if not counting [in] direct sun lighting on triangle (on microfacet)
interpolated value with the texture color of your object, yielding the following pixel
shader code: sampler color_map; float4 ps_main( float4 inDiff: COLOR, float4 inTex: TEXCOORD ) : COLOR { // Return the hemisphere color modulated // with the color of the base texture return inDiff * tex2D(color_map, inTex); }
on a per-vertex basis but can easily be adapted to do the same in a per-pixel (bump mapped surface normal taken) manner.
reasons worth mentioning; the first is the quality of the rendering results versus its ease of implementation. It is essentially a great, low-cost way of representing ambient lighting.
there are