yazgoo

Members
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

124 Neutral

About yazgoo

  • Rank
    Newbie
  1. Hi, I'm posting here to introduce a very basic hobby game I've been working on for the last month. [size=5]Presentation[/size] It's a in browser 3D game based on patchinko. I'm looking for people to test it, give me feedback and maybe write maps. It's available here: [url="https://github.com/yazgoo/nails_n_wood"]https://github.com/yazgoo/nails_n_wood[/url] It's playable here: [url="http://naw1-yazgoo.rhcloud.com/"]http://naw1-yazgoo.rhcloud.com/[/url] It has only been tested on firefox as of today and it's still buggy. [size=5]Toward 0.1 version[/size] The goal being to release a stable 0.1 version soon with just the functionnalities I developed on current version which are:[list] [*]playing «Official» levels which must be as polished as possible (which is far from being the case now) [*]editing and playing «Custom» levels [*]automated game tests [/list] I'll be targeting last versions of firefox, google chrome and internet explorer. [size=5]Toward 0.2[/size] When this first milestone is reached, I'll be focusing on 0.2, which should (nothing sure here) bring the following:[list] [*]money (or at least credits) you gain by playing and you use to «buy» stuff (textures, shaders, unlock maps…) [*]map sharing (would love to use something like bittorent torque for this if it's possible). [/list] [size=5]Wanna help?[/size] I'm just a beginner in game development so maybe I'm not focusing on important things, so I'm opened to suggestions. If you'd like to contribute maps or anything (e.g. open issues on github), this would be awesome. You can write maps via the in game editor or your favourite image editor.
  2. Turns out I've done a little maths to find if D3D and OpenGl clip spaces are homogeneous. Here should be the transformation needed (on the basis I have openGL clip space coordinates) : multiply by w; OpenglProjectionInverse; DirectXProjection Those matrices are : Pogl: matrix( [n/r,0,0,0], [0,n/t,0,0], [0,0,-(n+f)/(f-n),-2*f*n/(f-n)], [0,0,-1,0] ); Pd3d : matrix( [n/r,0,0,0], [0,n/t,0,0], [0,0,f/(f-n),1], [0,0,-f*n/(f-n),0] ); and Pd3d * rightHandToLeftHand * Pogl^(-1) is : matrix( [-1,0,0,0], [0,1,0,0], [0,0,-(f-n)/(2*f*n),-(-n-f)/(2*f*n)-f/(f-n)], [0,0,0,(f*n)/(f-n)]) [edit]I've corrected the matrix and added a left to right hand matrix which is Identity with (0,0) == -1[/edit] [Edited by - yazgoo on May 19, 2009 10:45:02 AM]
  3. Thank's V-man, but it does not seem to work. Maybe I'm not declaring clip space coordinates right, this is the way I do this in my shader :out.position.z = depth; // between 0 and 1 out.position.x = xCoordinate; // between -1 and 1 out.position.y = yCoordinate; // between -1 and 1 out.position.w = 1;to calculate the depth I use something like the following (with a depth texture filled with two bytes zbuffer data) :depth = (255 * zbuffer.r * 256 + 255 * zbuffer.g) / (pow(2,16)-1); [Edited by - yazgoo on May 18, 2009 10:51:14 AM]
  4. Quote:Personally, I would avoid using glReadPixels. I think I didn't explain well enough : I use glReadPixel to recover the ZBuffer but then i use my depth image in a D3D program, more precisely in a shader. A graphic is more appropriate : Opengl side : [ OPENGL scene ]----glReadPixels---->[ depth buffer Image] D3D side : [depth buffer image]--pixelValue-->[ vertex shader ]-->float4(pixelValue,x,y,1)Quote:Why are you interested in clip space? clip space is just projection * modelview * vertex.Correct me if I'm wrong, but clip Zbuffer as given by glReadPixel is in OpenGL clip space. Vertex shader projection is in (D3D) clip space. Then I was thinking I could avoid any projection/unprojection directly giving coordinates in clip space. So my questions are, more precisely : - Are OGL(as returned by glReadBuffer and scaled as I explained)/D3D clipping space coordinates the same ? - If it isn't is there a simple transformation which would avoid gluUnproject and then mul by WorldViewProj ? [Edited by - yazgoo on May 13, 2009 10:57:23 AM]
  5. Hi, everyone. I'd like to know more about the following. Let's say I glReadPixels in GL_DEPTH_COMPONENT format with GL_UNSIGNED_SHORT type. I then calculate a float beetween 0 and 1 using glReadPixels man component conversion table. Now, is the coordinate I get a good coordinate in D3D clip space (in shader) (more precisely float4(x, y, depth, 1) in (unnormalized)CS) ? Need I GL unproject and then D3D project (which seems overkill to me) ? (This may be a wrong topic for this forum but I didn't see elsewhere to post) Thanks for helping [Edited by - yazgoo on May 13, 2009 8:24:02 AM]
  6. Thank's erveryone. I'm trying to implement Opengl Superbible's shadow mapping. This is working, but I don't get how you combine your objects textures and the shadow texture. This result in the fact that all my objects which have their own texture (not mapped as usual though) don't have shadow texture projected on them. I'm also trying to figure out the best glPolygon offset.
  7. Thanks, Mike2343. Then, do you know what book would be good, and explain me how tomake shadows ? As for the "bad programming techniques", do you talk about it's OpenGl usage or about it's C usage in itself ?
  8. OpenGL starting opnegl

    Hi dk3790, If the question is if you need OOP knowledge to learn C openGl, then, I would say no. OpenGl can be used with standard C - which means with C++ too. C++ would help you because you would benefit of many OOP concepts, but C knowledge, which is quite non OOP, is enough.
  9. Greetings to everyone ! I'm new to those forums, so I may be doing things the wrong way. I've got a problem with an implementation of Nehe's lesson 27 algorithms,which I've quite copy/pasted. I won't copy here the whole code, but here are relevant parts : first, glCastShadow method void Object::glCastShadow(Vector3d lightSource) { Vector3d relativeLightSource = getRelativeOfAbsolute(lightSource); FacesCollection::iterator face; for(face = facesCollection.begin();face != facesCollection.end();face++) (*face)->setLightVisibility(relativeLightSource); glDisable( GL_LIGHTING ); glDepthMask( GL_FALSE ); glDepthFunc( GL_LEQUAL ); glEnable( GL_STENCIL_TEST ); glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE ); glStencilFunc( GL_ALWAYS, 1, 0xFFFFFFFFL ); glFrontFace( GL_CCW ); glStencilOp( GL_KEEP, GL_KEEP, GL_INCR ); glDoShadowPass( lightSource ); glFrontFace( GL_CW ); glStencilOp( GL_KEEP, GL_KEEP, GL_DECR ); glDoShadowPass( lightSource ); glFrontFace( GL_CCW ); glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); glColor4f( 0.0f, 0.0f, 0.0f, 0.1f ); glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glStencilFunc( GL_NOTEQUAL, 0, 0xFFFFFFFFL ); glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP ); glPushMatrix(); glLoadIdentity(); glBegin( GL_TRIANGLE_STRIP ); glVertex3f( -1.1f, 1.1f, -1.1 ); glVertex3f( -1.1f, -1.1f, -1.1 ); glVertex3f( 1.1f, 1.1f, -1.1 ); glVertex3f( 1.1f, -1.1f, -1.1 ); glEnd(); glPopMatrix(); glDisable(GL_BLEND); glDepthFunc(GL_LEQUAL); glDepthMask(GL_TRUE); glEnable(GL_LIGHTING); glDisable(GL_STENCIL_TEST); glShadeModel(GL_SMOOTH); } Then, here are my InitGl and ResizeGl (it may be relevant, since it's quite messy). void InitGL(int Width, int Height) { GLfloat LightAmbient[] = { 0.5f, 0.5f, 0.5f, 1.0f }; GLfloat LightDiffuse[] = { 1.0f, 1.0f, 1.0f,1.0f }; GLfloat LightPosition[] = { 0.0f, 0.0f, -15.0f, 1.0f }; glEnable(GL_TEXTURE_2D); glClearColor(0.15f, 0.15f, 0.15f, 0.0f); glShadeModel(GL_SMOOTH); glClearDepth(1.0); glClearStencil(0); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); /*glMatrixMode(GL_PROJECTION); glLoadIdentity();*/ gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,1,1000.0f); //glMatrixMode(GL_MODELVIEW); glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); glLightfv(GL_LIGHT1, GL_POSITION, LightPosition); glEnable(GL_LIGHTING); glEnable(GL_LIGHT1); glEnable(GL_COLOR_MATERIAL); glBlendFunc(GL_SRC_ALPHA,GL_ONE); glColor4f(1.0f,1.0f,1.0f,0.5); } void ReSizeGLScene(int Width, int Height) { if (Height==0) Height=1; glViewport(0, 0, Width, Height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,1,1000.0f); glMatrixMode(GL_MODELVIEW); } I've checked the method called glDoShadowPass() by itself (without stencil and color mask = 0), and edges seem well casted and drawned. My problem is that I get a dark square (the one I drew but stencil buffer has no effect) which darkens for each object I try to glCastShadow(), and no shadow. (browsing/checkouting the whole code is possible : http://forklifters.svn.sourceforge.net/viewvc/forklifters/) Regards