• 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.

furrymaster

Members
  • Content count

    94
  • Joined

  • Last visited

Community Reputation

100 Neutral

About furrymaster

  • Rank
    Member
  1. yes thats right, I have noticed this after writting last post Thank you so much for help. These layout location is so useful thing:)
  2. I'm trying to use laoyut + location but radeon gives error: [quote]Shader compilation: Vertex shader failed to compile with the following errors: ERROR: 0:4: error(#132) Syntax error: 'layout' parse error ERROR: error(#273) 1 compilation errors. No code generated[/quote] This error is for example here: [CODE] //VERT: #version 330 in layout(location = 0) vec2 in_Position; in layout(location = 1) vec2 in_TexCoord; uniform mat4 modelViewProjectionMatrix; out vec2 txCoord; void main() { txCoord = in_TexCoord; gl_Position= modelViewProjectionMatrix*vec4(in_Position,0,1); } //FRAG: #version 330 in vec2 txCoord; uniform sampler2D tex; void main() { gl_FragColor=texture2D( tex, txCoord ); } [/CODE] What am I doing wrong? And why NV doesn't get any error?
  3. Tsus u are right. I've checked that if i get attribute exactly before redner and set it into VAO i get good render in radeon. But it's unusefull in real time. I thin I'll use this layout-location code. Than you all so much.
  4. Hi, some time ago I wrote simple game which looks like arkanoid. And everything would be fine if not one BIG problem: on nVidia graphic cards my game is rendering everything what i want, but on Radeon you can't see anything else than black background. I dont use any special instructions for shaders or opengl. I use simple VBO + VAO + shader GLSL(#verison 120). Game: [url="http://www.wupload.com/file/2676932477/antyNoid.zip"]http://www.wupload.com/file/2676932477/antyNoid.zip[/url] Sample shader: [CODE] #version 120 uniform mat4 modelViewProjectionMatrix; in vec3 in_Position; void main(void) { gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position=vec4(in_Position.xy*2,0,1); } [/CODE] Do you have any idea what I am doing wrong? What should I check to know where is difference between using opengl+shader in nVidia and in Radeon? Can it be the problem of shaders? (all are in defaultData of game, some can look stragne because of shader-merging system, but it works fine). Oh and: I dont get any Opengl/Shader compile errors what is so strange too.
  5. thank you for useful advice. Luckly I found solutinon by myself few hours ago but i think this material probably will help me soon:)
  6. Hi, at the moment i'm creating simple physic in my engine and i have problem with 1 thing: when i have colision rect<< >>rect(s) how can I calculate vector which say "if you dont want to colide move for [x,y]". That what I have is: moving rectangle, coliding with it rectangles, move vector of my rectangle and intersect rectangle of each rect-rect colision. Main problematic colisions are: [img]http://i43.tinypic.com/35hqr07.png[/img] As you can see i cannot sum all push vectors because my moving rectangle will be pushed too far away. So that i'm getting 2 vectors from them which: has "best pushing" for x and for y value but counter to rect move vector. But it doesnt works well too( I can find an example where it doesnt work ). Do you have any idea what should it do? Maybe i'm going bad way to get "push vector"? Any articles about getting this vector would be nice too.
  7. thank you i ll try to use it. Edit: kinematics are bad idea because i need colisions, sometimes joints etc. And still i dont know WHEN to stop moving object. If i do sth like this: [code] Vector_2D range=pos - target; range=range*range; if(range.x+range.y < 10) stop(); [/code] my body can still keep moving if it colide with something in its way.
  8. But when i setting their velocity i`ll have to control when to stop them because this is force vector, so when they reach my target they will still keep moving.
  9. Hi, I`m writting because i have problem with using joints in Box2D. I`m trying to create simple moving system for my units but i cannot find out how to move units with this and this speed. I was trying to use linear Velocity but i have to control when units are on place in which i want them. I`ve tried joints but they are working like a... gum? U know, at start they move slow but if they are closer to target position my unit moves faster. Can u give me an advice how to use joints to have an effect like i want? (i was looking for good tutorial about this but all are with jumping boxes, moving them with mouse or car with wheels:( )
  10. Hi, i have next problem, now with bump mapping at deferred lighting. Heres screen with artefact: As you can see my shader makes some kind of marks of bump mapping. Do u have any advice what kind of my mistake can it be? here`s my pre (pixel)shader: varying vec3 normal; varying vec3 tangentS; varying vec3 tangentT; varying vec3 position; varying vec2 texCoord; varying float depth; uniform sampler2D baseTex; uniform sampler2D normalTex; void main() { vec3 bumpNormal = texture2D( normalTex, texCoord).xyz * 2.0 - 1.0;//bump map load vec4 base = texture2D( baseTex, texCoord); bumpNormal = bumpNormal.x * tangentS + bumpNormal.y * tangentT + bumpNormal.z * normal; bumpNormal = faceforward( bumpNormal, normalize(position), bumpNormal); normalize(bumpNormal); bumpNormal= bumpNormal* 0.5 + 0.5; gl_FragData[0] = vec4( bumpNormal.xy,depth*(bumpNormal.z<0?-1:1),base.a);//here i keep xy normals and depth with sign of normals.z gl_FragData[1] = vec4( base.rgb,1.0);//material } And my dirLight (pixel) shader: #version 120 #extension GL_ARB_draw_buffers : require #extension GL_EXT_gpu_shader4 : require uniform sampler2D normalDepthTex; uniform sampler2D materialTex; uniform vec3 lightDir;//=vec3( 0.57735); uniform vec3 lightColor;//=vec3(0,1.0,0); void main() { vec4 normal = texture2D( normalDepthTex, gl_TexCoord[0].xy); vec4 mat = texture2D( materialTex, gl_TexCoord[0].xy); normal.z=sqrt(1-normal.x*normal.x-normal.y*normal.y)*(normal.z<0?-1:1);//get real normal.z value from xy, because in normal.z i have coded depth, i`m only getting sign of z value(which is depth) vec3 bumpNormal = normal.xyz* 2.0 - 1.0;; float d = dot( lightDir, bumpNormal); d = max( 0.0, d) + 0.2; d = min( mat.w, d); gl_FragColor = vec4( (d*mat.rgb )*lightColor,1.0);//lightColor is green as u can see at the screen } Thanks for any useful advices(how should i resolve this problem).
  11. Hi, i have problem with getting modelView coord in deferred convex geometry rendering. i`m doing this like that: vec2 coord=(gl_ModelViewMatrix*gl_Vertex).xy; and i m getting position like this(with convex cane- spot light): but it should look like part of this one: What am i doing wrong?
  12. I have solved my problem, here is code: //screenScaledSize is width,height of screen/ 128.0f float x = (gl_TexCoord[0].x * 2.0f - 1.0f)*screenScaledSize.x; float y = (gl_TexCoord[0].y * 2.0f - 1.0f)*screenScaledSize.y; vec4 viewportPos = vec4(x, y, depth, 1 ); vec4 worldPos = viewportPos; worldPos.xyz /= worldPos.w; vec3 position=worldPos.xyz;
  13. OK, i have changed a lot of things in shader since my last post, maybe now u can tell me what am i doing wrong?(i still don`t get the same position as i showed at 1st post, 1st picture) encoding depth(while rendering models): gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; depth=(gl_Position/gl_Position.w).z; decoding depth: float x = gl_TexCoord[0].x * 2.0f - 1.0f; float y = (1 - gl_TexCoord[0].y) * 2.0f - 1.0f; vec4 viewportPos = vec4(x, y, depth, 1 ); vec4 worldPos = invMVP*viewportPos;//invMVP - now it is inverted matrixmodelviewprojecion worldPos.xyz /= worldPos.w; position=(worldPos).xyz;
  14. Quote:Original post by Ashaman73The inverse model view matrix (although you called it invMVP, which means the inverse of model-view-projection matrix !) transforms your camera space position into object space, not world space, unless your model matrix is the identity matrix. Yes, its name is invMVP, but because i tried many others possibilities even with inversed modelview projection matrix and i didnt want to change only name. If im right i have written in comments that its inverted modelview. My modelview matrix cant be identity matrix because (as u can see)i dont modify matrix before rendering quad. Do u have any advice for me what should i do now? Maybe should i read ESPECIALLY one tutorial(+example) about getting position from depth? Do u know any example(in cpp+GLSL) from which i read what am i doing wrong with my depth buffer?
  15. Hi i have problem with one optimization(voiding writing position into render target). I m trying to get info from depth buffer which i initialize like this: [source=cpp] glBindTexture( GL_TEXTURE_2D, depthBuffer); glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8_EXT, width, height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 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_TO_EDGE); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, depthBuffer, 0); glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_TEXTURE_2D, depthBuffer, 0); Im rendering full screen quad like this: [source=cpp] glBegin(GL_QUADS); glTexCoord2f(0,0);glVertex2f(-1,-1); glTexCoord2f(1,0);glVertex2f(1,-1); glTexCoord2f(1,1);glVertex2f(1,1); glTexCoord2f(0,1);glVertex2f(-1,1); glEnd(); As u can see that's normal [-1;1] quad but in shader i make from it fullscreenquad. End here is my shader in which i calculate spot light(and im trying to get position of pixel from depth) //VERTEX SHADER: #version 120 #extension GL_EXT_gpu_shader4 : require uniform vec3 spotPos; uniform vec3 spotDir; varying vec3 spot_Pos; varying vec3 spot_Dir; varying vec3 volumeCoords; void main() { spot_Dir=gl_NormalMatrix*spotDir;//i calculate lightdir spot_Pos=(gl_ModelViewMatrix*vec4(spotPos,1)).xyz;//i calculate lightpos volumeCoords = (gl_ModelViewMatrix*gl_Vertex).xyz; gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position=vec4(gl_Vertex.xy,0,1);//with this i draw fullscreenquad } //FRAGMENT SHADER #version 120 #extension GL_ARB_draw_buffers : require #extension GL_EXT_gpu_shader4 : require uniform sampler2D normalTex; uniform sampler2D materialTex; uniform sampler2D depthTex; uniform vec3 lightColor;//=vec3(0,1.0,0); uniform vec4 data;//intensinity,fallof,cosCutoff uniform mat4 invMVP;//inverted MODELVIEW float intensity;// = 128.0; float falloff;// = 512.0; float spotCosCutoff;//= cos(3.14/5) varying vec3 spot_Pos; varying vec3 spot_Dir; varying vec3 volumeCoords; void main() { intensity=data[0]; falloff=data[1]; spotCosCutoff=data[2]; vec3 normal = texture2D( normalTex, gl_TexCoord[0].xy).xyz * 2.0 - 1.0; vec4 mat = texture2D( materialTex, gl_TexCoord[0].xy); ////////////////////HERE STARTS MY PROBLEM float d = texture2D(depthTex, gl_TexCoord[0].xy).x; float fragDepth = -1000 / ( d - 0.2 );//zfar i znear vec3 fragLocation = vec3( volumeCoords.xy * fragDepth / volumeCoords.z , fragDepth); vec4 WorldSpacePos = invMVP *vec4(fragLocation,1.0); vec3 position=WorldSpacePos.xyz;//setting position /////////////////////////////////////////////////////////////////////// vec3 lightDir = ( spot_Pos - position); float dist = length(lightDir); lightDir=normalize(lightDir); float spotEffect = dot(spot_Dir, -lightDir); if(spotEffect>=spotCosCutoff) { dist = 1.0 / (1.0 + dist * dist * falloff); vec3 dif = max( (dot( lightDir, normal) * dist * intensity),0.0 )*lightColor ; gl_FragColor = vec4( dif*mat.rgb, 1.0); } gl_FragColor=vec4(position,1);//here i check if positions are good } Position should looks like this: but it looks like this: Do u have any idea what am I doing wrong? Thanks for all answers