Hey, I am using cubemaps for shadow mapping. When I run my application in 1024x768 resolution, the cubemaps are not properly generated. They appear to be incorrectley connected at the top and bottom sides. The strange thing is that when I run my application in 1440x900 resolution, the problem is much less noticable (the seams are smaller apart). I confirmed this problem by downloading two other examples from the forums and testing it on my machine. Both have the problem as well. The problem only occurs when rendering into the 6 sides of the cubemap (when loading a cubemap (skycube for example) the function is fine).
the red circle shows the problem - the projection from the cubemap is correct from the side segments but not from the bottom (and top which isn't shown)
-Mike-
http://www.groundtacticsgame.com/ Alienware m17x R Custom laptop specs: Intel Core 2 Extreme Quad CPU Q9300 2x Nvidia 280GTX 2GB vram 6GB ddr3 memory@ 1333Mhz 512GB SSD 1200p 17' screen runs Crysis Warhead on max settings at 1200p at 90 fps
Maybe the cubes are not a power of 2? Check if they work when loaded as a sky cube and used with one of the mirror shaders. If they work there, then the problem is obviously not the cubemap.
The cubes are 512x512 (3072x512). When I change the shader to display the cubemap and instead of rendering into it I load a skycube (1024x1024) it works fine. Could the problem be rendering into the cubemap? I am using the size_x, size_y, pos_x correctley (they work at resolution of 1440x900 or higher) and I set up the 6 views' arc to 90 and their angles (pan) are correct. Also, I found one more problem - I cannot render into a cubemap with sides larger than 512x512. I can load cubemaps with 1024x1024 sides but I cannot render into them. thanks for your help and let me know if there is anything else you need to know. -Mike-
http://www.groundtacticsgame.com/ Alienware m17x R Custom laptop specs: Intel Core 2 Extreme Quad CPU Q9300 2x Nvidia 280GTX 2GB vram 6GB ddr3 memory@ 1333Mhz 512GB SSD 1200p 17' screen runs Crysis Warhead on max settings at 1200p at 90 fps
You've described the problem quite clearly, but at least in the engine code I see nothing that could prevent you from rendering in a >512 cubemap.
Can you strip down your project so that nothing else happens but rendering into the cubemap and displaying the result? If the problem then still happens, please send it to Support. We'll look into this.
sorry for the long delay. I've been trying to fix this myself but I can't. here is a small demo showing the problem. The problem occurs with rendering into any size cubemap.
I notice the offset problem in your example, but it is hard to see - it has the size of about 1 pixel only. It disappears totally on higher shadow map resolutions like 1024x1024, so it looks very different than in your screenshot. It seems to be just an aliasing error.
I've also checked the code, but the cube maps are created correctly and the render offset is also correct - so I can't confirm any problem there.
You mentioned in the comment of your script that the problem disappears when you create the cube map with a DirectX function. But that had to be the same function that the engine uses. Can you also upload an example where the offset disappears, or send it to support at conitec.net? I'd like to compare both.
I have narrowed down the problem. The 1 pixel offset occurs in windowed or full-resolution modes only. On my 1440x900 monitor, in video mode 1024x768, the offset becomes extremely noticable like in my picture. Can you confrim this by changing the video res in the source and running? I don't think the problem is the cubemap function (as you said it is the same as the normal dx one) but rather with the viewport size variables or something related. -mike-
http://www.groundtacticsgame.com/ Alienware m17x R Custom laptop specs: Intel Core 2 Extreme Quad CPU Q9300 2x Nvidia 280GTX 2GB vram 6GB ddr3 memory@ 1333Mhz 512GB SSD 1200p 17' screen runs Crysis Warhead on max settings at 1200p at 90 fps