|
Post by DJLinux on Mar 3, 2012 9:52:29 GMT -5
Hey DJLinux, there are 2 counts of "glVertexAttrib4f" and no "glVertexAttrib4f v" Thought I'd just leave that here... Ok fixed. Joshy
|
|
|
Post by shadow008 on Mar 31, 2012 20:08:10 GMT -5
So much work in getting prepared for college... This is my first working stage of shadow mapping using GLSL Used the tutorial from hereClearly, there is much room for improvement, but its a start. I the code is horribly uncommented, I should probably fix that. The shaderpack folder also includes my "as optimized as its ever going to get" bloom shader, that can be added to _Literally_ any demo. I simplified it down to a single function ;D So add that in anything you throw out for demonstration. This is the bare bones of shadow mapping. The shadow map shader doesnt even include simple diffuse shading, will be fixed. Maybe blur the shadow map for better effect, use the cascaded shadow map technique for large areas, PCF(well.. maybe just blur). But after this, I want to get point light shadow mapping working. I'd prefer to use the fish-eye dual paraboloid technique simply for speed, but there really isn't much out there in terms of documentation. I guess it's cube maps... ...So much self shadowing... so much... Download it (please?): SHADOW MAPPING B4GL&GLSL
|
|
|
Post by DJLinux on Apr 3, 2012 4:46:07 GMT -5
|
|
|
Post by shadow008 on Apr 3, 2012 11:14:54 GMT -5
Well isn't that just adorable? May I suggest commenting out bloom? If that doesnt work, comment out the Render() function after InitFirstPass() Sorry, the only cards I was able to test this on was my AMD Radeon 6670 (latest drivers) and ATI Radeon 3100M (latest drivers). Interestingly enough, I was getting similar results when developing my bloom shader. It might just happen to be the way the full screen quad is drawn. I had to mess with that a bit before getting it to work properly. Oh wow.... after some testing, I'm pretty sure this is a driver error. I was able to recreate your problem. In my bloom shader include file, under CreatePlane(), it turns out the texture coordinates are actually incorrect. Apparently my gfx card changes it to be proper regardless. Are you using an Nvidia card? I changed the quad drawing coordinates to this as a "proper" fix glVertex2i(-1, -1): glTexCoord2f(1, 0) glVertex2i( 1, -1): glTexCoord2f(1, 1) glVertex2i( 1, 1): glTexCoord2f(0, 1) glVertex2i(-1, 1): glTexCoord2f(0, 0)
If you comment out Bloom(...) and everything starts working, then thats the problem. THE OTHER POSSIBLE ISSUE is that your running below 1280x1024 resolution (my test was at 1920x1080). That just messes with the shadow maps, but shouldnt really distort the screen like that. This is what I get: 
|
|
|
Post by DJLinux on Apr 3, 2012 11:42:57 GMT -5
Normaly glVertex is the signal for "end of vertex define" (with all current attributes) That means glTexCoord, glNormal, glColor must be defined before !!!
(so far i know)
|
|
|
Post by shadow008 on Apr 3, 2012 15:18:58 GMT -5
Normaly glVertex is the signal for "end of vertex define" (with all current attributes) That means glTexCoord, glNormal, glColor must be defined before !!! (so far i know) Really? I don't remember ever having problems with those. (Tests that statement) Well I'll be damned  Looks like your right. That first vertex defaults to texcoord (0,0) So it still "technically" works. I've been doing it wrong the whole time  But THIS is the proper fix I guess: glTexCoord2f(0, 0):glVertex2i(-1, -1) glTexCoord2f(1, 0):glVertex2i( 1, -1) glTexCoord2f(1, 1):glVertex2i( 1, 1) glTexCoord2f(0, 1):glVertex2i(-1, 1) By the way, did that fix the problem by any chance? Or is it still all messed up?
|
|
|
Post by DJLinux on Apr 3, 2012 17:20:37 GMT -5
Well I'll be damned  Looks like your right. Trust me I'm old and little bit wise ;D It's the "bloom" part only what makes trouble here and yes my NVIDIA GL 3.3 drivers are up to date. Joshy
|
|
|
Post by DJLinux on Apr 3, 2012 20:21:29 GMT -5
Here are a translation with FBO in Basic4GL but i don't like the result. (is there an error in my translation ? May be you will use the FBO (framebuffer) stuff. (not pixelbuffer PBO) Download: ShadowShader.zip Joshy
|
|
|
Post by shadow008 on Apr 3, 2012 21:40:17 GMT -5
Ahh... so much better:  Theres still terrible amounts of artifacts... The ones that are hard to get rid of... Also, point lights, MUST BE DONE ^_^ Edit: Wait, FBO's??? Finally! I was always wanting to play with those. But its late, and I have training tomorrow. So ill check that over when I have time.
|
|
|
Post by shadow008 on Apr 4, 2012 17:43:37 GMT -5
Interesting. I just implemented FBO's. And I seem to be getting the exact same issues as seen in your demo. I implemented a shader to visualize the depth buffer. All goes well with the screen buffer copy.  But when using FBO's, it doesn't seem as anything is being drawn to the FBO at all... The reason the parts behind the light are "lit" is because it falls outside the range of the shadow map texture. It bleeds over the x and y parts and completely shadows everything in front because thats what the shader is told to do.  It just seems as though NOTHING gets rendered to the FBO at all. I'll have to cross check this using the color extensions and such in my bloom shader to determine if theres just some stupid mistake made.
|
|
|
Post by shadow008 on Apr 9, 2012 21:14:51 GMT -5
Well, after messing with it, it seems as though the FBO isn't ever making it past the setup phase. Every single time; no matter what I do to it; I always come up with gl_framebuffer_incomplete_missing_attachment_ext as the FBO error. This means that there isn't a legitimate texture attached to it. It seems as though there is no way to set the texture up properly though... Looking online for a solution came up with nothing at all. Though I did notice that many of them included something called a render buffer. I have no idea what that is, though it can be attached to the FBO... My test included drawing a sphere to a FBO, and using that to texture a cube drawn to the default FBO... Nothing worked.  I always get a blank cube. Have you gotten them to work properly yet?
|
|
|
Post by DJLinux on Apr 11, 2012 14:47:48 GMT -5
Have you gotten them to work properly yet? No and i don't need it anymore. I tested the OGRE and IrrLicht 3D engines with C++ successful. The list of primary features and render speed of this engines are more or less the same (what i tested so far). The OGRE engines needs more than 10 libs as *.dll's  I prefer the IrrLicht engine i created with the latest gcc compiler one static irrlicht lib and it works good here. If i get a little bit time (may be next weekend) i build also a IrrlichtPlugin for Basic4GL. The tricky part are we can use the Basic4GL OpenGL window as IrrLicht render device. That means if you set in the Basic4GL IDE any params resizable, stencilbuffer, fullscreen ... the engine will use this settings also. By the way you get many GUI widgets too. In combination with the TrueAxis, FreeSound and TCP Plugin there are no limits anymore to build professional games with Basic4GL. You can get an good overview of the features from here: irrlicht.sourceforge.net/features/The main tutorial page: irrlicht3d.org/wiki/index.php?n=Main.TutorialsJoshy
|
|