• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

AnujKalia

Members
  • Content count

    21
  • Joined

  • Last visited

Community Reputation

100 Neutral

About AnujKalia

  • Rank
    Member
  1. Hi all! We've implemented a hybrid shadow algorithm where shadow mapping gives us some boundary pixels which need to be further checked. One of the ways to check whether this boundary pixel is in shadow (or not) is to shoot a ray towards the light and check for intersection with the scene's triangles. Currently, we're thinking of storing the scene in an octree (in the texture memory of the GPU). Then shoot rays from every pixel and check for intersection by traversing the octree in the fragment shader. Can you point me to some tutorials/papers regarding such intersection detection? I couldn't find much information about how the octree should be stored in the texture, and how the octree should be traversed inside the fragment shader etc..
  2. Best of luck to all appearing for JEE. Special wishes for my students at Vidyamandir. I'm already looking forward to seeing you people here!
  3. I found the solution. Its not OK.
  4. Hi all! We've implemented Eric Chan's hybrid algorithm for accurate shadows, and we're now taking another step. Our shadow volumes algorithm involves extruding silhouette edges in the Geometry Shader. The question I want to ask is this: Suppose in the Geometry Shader, we were able to check whether a silhouette edge is [i]already [/i]in shadow (using, perhaps, the shadow map). Is it O.K to not extrude this silhouette edge? i.e. simply neglect the shadow planes that will be created when this edge is extruded? We're only dealing with watertight meshes, if that is relevant. We expect some performance gain if we can reject some edges inside the geometry shader, as that will reduce the fragment shader's load. Thanks for your help!
  5. connecting to proxy22.iitd.ernet.in... Y U NO WORK?
  6. Hi! Does someone know where I can find good code for Shadow Volumes (Z-fail using a geometry shader)? Actually I have written some code for it and it would be good to have a reference to check for bugs etc.
  7. 8 years after playing Age of Mythology, I tried writing the game. You can download the it from: http://www.filefactory.com/file/cf716eb/n/game.zip. Unzip, run oalinst.exe, lower sound and then run anuj.exe. Press 's' for shadows, and 't' for using your gold.
  8. Hi! I am searching for some cool applications of shaders (openGL) for a 4-months long college project. We want to write shaders for certain graphics applications which people sometimes do on the CPU, but which perform better when done on the GPU using shaders. We have thought about the following 2 applications: 1)Shadow Voumes: create the shadow planes using the Geometry Shader. 2)Hardware Skinning/Animation: use vertex shaders to apply bone matrix transformations. Can some share more interesting applications of shaders (Vertex/Geometry/Fragment) which we can consider in our project? Thanks!
  9. Turns out the issue has been raised earlier at : http://www.gamedev.net/topic/483134-textures-in-shadow-mapping---pass/
  10. I am using a shadow mapping code from Paul's Projects. It works fine for untextured objects but not for textured objects: [code] #define WIN32_LEAN_AND_MEAN #include <Windows.h> #include <stdio.h> #include <gl/glew.h> #include <gl/glfw.h> #include <gl/GLU.h> #include "Maths/Maths.h" GLuint textureID; VECTOR3D cameraPosition(-2.5f, 3.5f,-2.5f); //Camera & light positions VECTOR3D lightPosition(2.0f, 3.0f,-2.0f); GLUquadricObj *quadric; const int shadowMapSize=600; //Size of shadow map GLuint shadowMapTexture; //Textures int windowWidth, windowHeight; //window size MATRIX4X4 lightProjectionMatrix, lightViewMatrix; //Matrices MATRIX4X4 cameraProjectionMatrix, cameraViewMatrix; void DrawScene(float angle) { //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glBindTexture(GL_TEXTURE_2D,textureID); glPushMatrix(); glColor3f(.8,.8,.8); gluSphere(quadric,.5,50,50); glTranslatef(-1,-.6,.4); gluSphere(quadric,.5,50,50); glPopMatrix(); glPushMatrix(); glBegin(GL_POLYGON); glTexCoord2f(.5,.5); glVertex2f(.5,.5); glTexCoord2f(.5,-.5); glVertex2f(.5,-.5); glTexCoord2f(-.5,-.5); glVertex2f(-.5,-.5); glTexCoord2f(-.5,.5); glVertex2f(-.5,.5); glEnd(); glPopMatrix(); } bool Init(void) //Called for initiation { glMatrixMode(GL_MODELVIEW); //Load identity modelview glLoadIdentity(); glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); //Depth states glClearDepth(1.0f); glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); //We use glScale when drawing the scene glEnable(GL_NORMALIZE); //Create the shadow map texture glGenTextures(1, &shadowMapTexture); glBindTexture(GL_TEXTURE_2D, shadowMapTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadowMapSize, shadowMapSize, 0,GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); //Use the color as the ambient and diffuse material glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE); glEnable(GL_COLOR_MATERIAL); //White specular material color, shininess 16 glMaterialfv(GL_FRONT, GL_SPECULAR, white); glMaterialf(GL_FRONT, GL_SHININESS, 16.0f); //Calculate & save matrices glPushMatrix(); glLoadIdentity(); gluPerspective(45.0f, (float)windowWidth/windowHeight, 1.0f, 100.0f); glGetFloatv(GL_MODELVIEW_MATRIX, cameraProjectionMatrix); glLoadIdentity(); gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z,0.0f, 0.0f, 0.0f,0.0f, 1.0f, 0.0f); glGetFloatv(GL_MODELVIEW_MATRIX, cameraViewMatrix); glLoadIdentity(); gluPerspective(45.0f, 1.0f, 2.0f, 8.0f); glGetFloatv(GL_MODELVIEW_MATRIX, lightProjectionMatrix); glLoadIdentity(); gluLookAt(lightPosition.x, lightPosition.y, lightPosition.z,0.0f, 0.0f, 0.0f,0.0f, 1.0f, 0.0f); glGetFloatv(GL_MODELVIEW_MATRIX, lightViewMatrix); glPopMatrix(); glGenTextures(1,&textureID); // Generate and bind our texture ID printf("\n\ntextureID=%d\n",textureID); glBindTexture(GL_TEXTURE_2D,textureID); printf("check\n%d\n",glfwLoadTexture2D("ranger.tga",GLFW_BUILD_MIPMAPS_BIT|GLFW_ORIGIN_UL_BIT)); glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR ); // Use trilinear interpolation (GL_LINEAR_MIPMAP_LINEAR) glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR ); return true; } //Called to draw scene void Display(void) { printf("here"); //First pass - from light's point of view glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadMatrixf(lightProjectionMatrix); glMatrixMode(GL_MODELVIEW); glLoadMatrixf(lightViewMatrix); glViewport(0, 0, shadowMapSize, shadowMapSize); //Use viewport the same size as the shadow map glCullFace(GL_FRONT); //Draw back faces into the shadow map glShadeModel(GL_FLAT); //Disable color writes, and use flat shading for speed glColorMask(0, 0, 0, 0); DrawScene(0); //Draw the scene glBindTexture(GL_TEXTURE_2D, shadowMapTexture); //Read the depth buffer into the shadow map texture glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, shadowMapSize, shadowMapSize); //restore states glCullFace(GL_BACK); glShadeModel(GL_SMOOTH); glColorMask(1, 1, 1, 1); //2nd pass - Draw from camera's point of view glClear(GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadMatrixf(cameraProjectionMatrix); glMatrixMode(GL_MODELVIEW); glLoadMatrixf(cameraViewMatrix); glViewport(0, 0, windowWidth, windowHeight); glLightfv(GL_LIGHT1, GL_POSITION, VECTOR4D(lightPosition)); //Use dim light to represent shadowed areas glLightfv(GL_LIGHT1, GL_AMBIENT, white*0.2f); glLightfv(GL_LIGHT1, GL_DIFFUSE, white*0.2f); glLightfv(GL_LIGHT1, GL_SPECULAR, black); glEnable(GL_LIGHT1); glEnable(GL_LIGHTING); DrawScene(0); //3rd pass glLightfv(GL_LIGHT1, GL_DIFFUSE, white); //Draw with bright light glLightfv(GL_LIGHT1, GL_SPECULAR, white); //Calculate texture matrix for projection //This matrix takes us from eye space to the light's clip space //It is postmultiplied by the inverse of the current view matrix when specifying texgen static MATRIX4X4 biasMatrix(0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.5f, 0.5f, 0.5f, 1.0f); //bias from [-1, 1] to [0, 1] MATRIX4X4 textureMatrix=biasMatrix*lightProjectionMatrix*lightViewMatrix; //Set up texture coordinate generation. glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_S, GL_EYE_PLANE, textureMatrix.GetRow(0)); glEnable(GL_TEXTURE_GEN_S); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_T, GL_EYE_PLANE, textureMatrix.GetRow(1)); glEnable(GL_TEXTURE_GEN_T); glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_R, GL_EYE_PLANE, textureMatrix.GetRow(2)); glEnable(GL_TEXTURE_GEN_R); glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_Q, GL_EYE_PLANE, textureMatrix.GetRow(3)); glEnable(GL_TEXTURE_GEN_Q); //Bind & enable shadow map texture glBindTexture(GL_TEXTURE_2D, shadowMapTexture); glEnable(GL_TEXTURE_2D); //Enable shadow comparison glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE); //Shadow comparison should be true (ie not in shadow) if r<=texture glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); //Shadow comparison should generate an INTENSITY result glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY); //Set alpha test to discard false comparisons glAlphaFunc(GL_GEQUAL, 0.99f); glEnable(GL_ALPHA_TEST); DrawScene(0); //Disable textures and texgen glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glDisable(GL_TEXTURE_GEN_R); glDisable(GL_TEXTURE_GEN_Q); //Restore other states glDisable(GL_LIGHTING); glDisable(GL_ALPHA_TEST); glfwSwapBuffers(); } //Called on window resize void Reshape(int w, int h) { windowWidth=w, windowHeight=h; glPushMatrix(); glLoadIdentity(); gluPerspective(45.0f, (float)windowWidth/windowHeight, 1.0f, 100.0f); glGetFloatv(GL_MODELVIEW_MATRIX, cameraProjectionMatrix); glPopMatrix(); } int main(int argc, char** argv) { glfwInit(); //start using glfw library glfwOpenWindowHint(GLFW_FSAA_SAMPLES,4); glfwOpenWindow(400,400,0,0,0,0,0,0,GLFW_WINDOW ); glfwSetWindowTitle( "anuj" ); Reshape(400,400); quadric = gluNewQuadric(); gluQuadricTexture(quadric,GL_TRUE); Init(); glewInit(); while(1) Display(); return 0; } [/code] I think the problem starts here when the program binds "shadowMapTexture" [code] glBindTexture(GL_TEXTURE_2D, shadowMapTexture); glEnable(GL_TEXTURE_2D); [/code] However, the first line of my drawScene function binds it to a different texture: [code] glBindTexture(GL_TEXTURE_2D,textureID); [/code] "textureID" is the texture I want to appear on my spheres. So, I can't use shadowMapTexture? Is there an alternative?
  11. Thanks for the suggestions GreyHound!
  12. It works like a charm with an nVidia card! Thanks Anshaman73! Still, any suggestions are welcome. I don't want to try and convert it to GLSL just now because I'm a little out of time! If someone wants to try it themselves, they can download the cal3D library from http://download.gna.org/cal3d/sources/?M=D. [url="http://download.gna.org/cal3d/sources/cal3d-complete-0.10.0.tar.bz2"](cal3d-complete-0.10.0.tar.bz2[/url])I'm running miniviewer_gl_vp from the examples folder. I guess you will need to build the cal3D libraries first.
  13. anything i can try to get it running on an ATI card? i'm going to try it on an nVidia card tonight but sadly i have to work on this ATI one!!!
  14. I ran the exe on 3 separate laptops, and found different results: ATI (1GB): no texture at all! ATI (512MB): bad texturing...can't describe how bad.. Intel Graphics (128MB): the texture appears perfectly! Could someone explain?
  15. Hi! Thanks for replying. You are right. Its a shader for hardware skinning that Cal3D provides as an example. But, I'm not using any fragment shader (is that a pixel shader?) and I'm expecting the default fragment shader to do its job. Also, I guess that the attributes are getting mapped correctly because the animation is working fine. Only the textures are not appearing! Here's some more code Creating the buffers: [code] glGenBuffersARB(6, m_bufferObject); glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_bufferObject[0]); glBufferDataARB(GL_ARRAY_BUFFER_ARB, m_calHardwareModel->getTotalVertexCount()*3*sizeof(float),(const void*)pVertexBuffer, GL_STATIC_DRAW_ARB); glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_bufferObject[1]); glBufferDataARB(GL_ARRAY_BUFFER_ARB, m_calHardwareModel->getTotalVertexCount()*4*sizeof(float),(const void*)pWeightBuffer, GL_STATIC_DRAW_ARB); glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_bufferObject[2]); glBufferDataARB(GL_ARRAY_BUFFER_ARB, m_calHardwareModel->getTotalVertexCount()*3*sizeof(float),(const void*)pNormalBuffer, GL_STATIC_DRAW_ARB); glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_bufferObject[3]); glBufferDataARB(GL_ARRAY_BUFFER_ARB, m_calHardwareModel->getTotalVertexCount()*4*sizeof(float),(const void*)pMatrixIndexBuffer, GL_STATIC_DRAW_ARB); glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_bufferObject[4]); glBufferDataARB(GL_ARRAY_BUFFER_ARB, m_calHardwareModel->getTotalVertexCount()*2*sizeof(float),(const void*)pTexCoordBuffer, GL_STATIC_DRAW_ARB); glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_bufferObject[5]); glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_calHardwareModel->getTotalFaceCount()*3*sizeof(CalIndex),(const void*)pIndexBuffer, GL_STATIC_DRAW_ARB);[/code] and here's the mapping: [code] glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_bufferObject[0]); glVertexAttribPointerARB(0, 3 , GL_FLOAT, false, 0, NULL); glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_bufferObject[1]); glVertexAttribPointerARB(1, 4 , GL_FLOAT, false, 0, NULL); glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_bufferObject[2]); glVertexAttribPointerARB(2, 3 , GL_FLOAT, false, 0, NULL); glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_bufferObject[3]); glVertexAttribPointerARB(3, 4 , GL_FLOAT, false, 0, NULL); glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_bufferObject[4]); glVertexAttribPointerARB(8, 2 , GL_FLOAT, false, 0, NULL); glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_bufferObject[5]); [/code]