
Advertisement
furrymaster
Member
Content Count
94 
Joined

Last visited
Community Reputation
100 NeutralAbout furrymaster

Rank
Member

Radeon vs nVidia rendering  game issue
furrymaster replied to furrymaster's topic in Graphics and GPU Programming
yes thats right, I have noticed this after writting last post Thank you so much for help. These layout location is so useful thing:) 
Radeon vs nVidia rendering  game issue
furrymaster replied to furrymaster's topic in Graphics and GPU Programming
I'm trying to use laoyut + location but radeon gives error: 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: //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 ); } What am I doing wrong? And why NV doesn't get any error? 
Radeon vs nVidia rendering  game issue
furrymaster replied to furrymaster's topic in Graphics and GPU Programming
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 layoutlocation code. Than you all so much. 
OpenGL Radeon vs nVidia rendering  game issue
furrymaster posted a topic in Graphics and GPU Programming
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: http://www.wupload.com/file/2676932477/antyNoid.zip Sample shader: #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); } 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 shadermerging system, but it works fine). Oh and: I dont get any Opengl/Shader compile errors what is so strange too. 
thank you for useful advice. Luckly I found solutinon by myself few hours ago but i think this material probably will help me soon:)

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 rectrect colision. Main problematic colisions are: 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.

[Box2D]Problem with joints  simple moving
furrymaster replied to furrymaster's topic in Math and Physics
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: Vector_2D range=pos  target; range=range*range; if(range.x+range.y < 10) stop(); my body can still keep moving if it colide with something in its way. 
[Box2D]Problem with joints  simple moving
furrymaster replied to furrymaster's topic in Math and Physics
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. 
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:( )

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(1normal.x*normal.xnormal.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).

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?

Deferred lighting optimalisation  support needed
furrymaster replied to furrymaster's topic in Graphics and GPU Programming
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; 
Deferred lighting optimalisation  support needed
furrymaster replied to furrymaster's topic in Graphics and GPU Programming
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; 
Deferred lighting optimalisation  support needed
furrymaster replied to furrymaster's topic in Graphics and GPU Programming
Quote:Original post by Ashaman73The inverse model view matrix (although you called it invMVP, which means the inverse of modelviewprojection 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? 
Deferred lighting optimalisation  support needed
furrymaster posted a topic in Graphics and GPU Programming
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

Advertisement