migueltk's picture

Improving shadow mapping in two passes

Hola

He adaptado la demo "Shadow Mapping" del libro "OpenGL Superbible, 3rd Edition" para OpenTK, se puede descargar desde aquí

El problema es que la calidad de las sombras no es muy buena, ¿Como podría mejorarse? ¿Alguien con más conocimientos que yo podría reescribir la demo para mejorar la calidad en dos pasadas ?

(Google Translator)
Hello

I have adapted the demo "Shadow Mapping" the book "OpenGL Superbe, 3rd Edition" to OpenTK can be downloaded from here

The problem is that the quality of the shadows is not very good, how could it be improved? Someone with more knowledge than I could rewrite the demo to improve quality in two passes?

Inline Images
Shadow Mapping in 2 Passes

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
migueltk's picture

El link del programa, segundo intento:

http://www.megaupload.com/?d=IX6M1M7X

the Fiddler's picture

I don't know if you can create smooth shadows without shaders.

I have attached a slightly modified version that compiles with OpenTK 1.0 (needs both OpenTK.dll and OpenTK.Compatibility.dll). On my nvidia card, this generates an InvalidEnum exception at line 281, you might wish to look into that.

AttachmentSize
SimpleWindow.cs16.13 KB
migueltk's picture

I have tested your implementation and to operate normally, to make the program work the graphics card must support the extension GL_ARB_shadow_ambient, I think your card supports it, check it out.

the Fiddler's picture

Unfortunately, it seems that GL_ARB_shadow_ambient isn't supported on my card. (This is a mobile Quadro, equivalent to a 8400M, using the 195.62 drivers. OpenGL version is 3.2). However, the application seems to run fine when I remove this line.

Hortus Longus's picture

migueltk, on the lines 242/243, when you increase GL.Translate/GL.Scale from 0.5f to 0.99f, the result becomes better. I think you have some operations to finetune.

migueltk's picture


The best results are obtained with the following code, lines 309 to 311:

            GL.LightModel(LightModelParameter.LightModelAmbient, noLight);
            //GL.Light(LightName.Light0, LightParameter.Ambient, ambientLight);
            //GL.Light(LightName.Light0, LightParameter.Diffuse, diffuseLight);
AttachmentSize
ShadowMapping2Passes2.png46.46 KB
Shadow2PassOtk1.zip8.55 KB
Hortus Longus's picture

Perhaps. ; -)

Possibly a small help for you, if you regard some of these articles:
(do not follow the links to his website on simsysbr.com, they are gone)
Simple Ray Tracing in C#
http://www.codeproject.com/KB/graphics/Simple_Ray_Tracing_in_C_.aspx
Simple Ray Tracing in C# Part II (Triangles intersection)
http://www.codeproject.com/KB/graphics/Simple_Ray_Tracing_in_C_2.aspx
Simple Ray Tracing in C# Part III (Reflection)
http://www.codeproject.com/KB/graphics/Simple_Ray_Tracing_in_C_3.aspx
Simple Ray Tracing in C# Part IV (Anti-Aliasing)
http://www.codeproject.com/KB/graphics/Simple_Ray_Tracing_in_C_4.aspx
Simple Ray Tracing in C# Part V (Texture Mapping)
http://www.codeproject.com/KB/graphics/Simple_Ray_Tracing_inC_5.aspx
Simple Ray Tracing in C# Part VI (Vertex Normal Interpolation)
http://www.codeproject.com/KB/graphics/Simple_Ray_TracinginC6.aspx
Simple Ray Tracing in C# Part VII (Shadows)
http://www.codeproject.com/KB/graphics/Simple_Ray_Tracing_in_C7.aspx

--
Solution Architect: "But you can use patterns"
Young Developer: "Yes, but can I get it as an ActiveX control?"