• Advertisement

oggs91

Member
  • Content count

    69
  • Joined

  • Last visited

Community Reputation

421 Neutral

About oggs91

  • Rank
    Member
  1. Hi Cg Gurus :)   I'm looking for interesting papers in the field of Character Animation Synthesis for an assignment at my university. The course is about writing a short state of the art report on a topic based in the field of Computer Graphics. To make sure I don't miss any interesting papers I kindly ask you to post papers dealing with Character Animation Synthesis that have caught your eye.   thx :) 
  2. yes do that, render backfaces to your shadowmap   think about how big a texel from the shadowmap is if it's projected onto your terrain, clearly the area each texel has to cover is bigger if the light is low above the ground and producing very long shadows. biasing can correct this to a certain extent but if your shadowmap resolution is too small that won't help either. a simple solution would be to just increase the shadowmap resolution, and/or limit the possible light angle. i think a proper solution would be to use a cascaded shadowmapping technique
  3. vec3 normal = normalize(transpose(inverse(mat3(u_modelMat))) * texture2D(tNormals, fragTexCoord0.xy).rgb); this has to be done in the geometry pass, your lighting pass does not know which fragment comes from what object ( u_modelMat is for a specific object ) your normal transformation was ok i think in post #3   anyway to find out why the dot product is always zero draw lightVector and normal as RGB an inspect the two resulting images (you can also make abs() to show negative values too ) ... if you can't conclude whats wrong post the output images
  4. replace vec3 halfVector = normalize(lightVector + normalize(-position));   with vec3 viewVector = normalize(position - cameraPosition); vec3 halfVector = normalize(lightVector + viewVector);   like light position you also have to pass the camera position as a uniform to the shader remember you are doing lighting there in worldspace, not in viewspace. in viewspace the direction to the viewer would be -position     thx
  5. GL_FRAMEBUFFER_UNSUPPORTED is returned if the combination of internal formats of the attached images violates an implementation-dependent set of restrictions. https://www.opengl.org/sdk/docs/man3/xhtml/glCheckFramebufferStatus.xml   i'm not sure what is the problem here see for possible formats https://www.opengl.org/sdk/docs/man/html/glTexImage2D.xhtml   but anyway, you want 16 or 32 bit values for position and normals, also with 3 not 4 values glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, height, 0, GL_RGB, GL_FLOAT, NULL); // position, 3 float values glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, height, 0, GL_RGB, GL_FLOAT, NULL); // normals, 3 float values glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_FLOAT, NULL); // diffuse color, 3 float values, or 4 values with alpha (GL_RGBA)   for more details consider my deferred rendering code https://github.com/oggs91/CGUE2014-15/blob/master/src/DeferredPipeline.cpp line 333
  6. that's no opengl command ...  gl_createGBufTex(GL_TEXTURE2, GL_RGB32F, id_textures[GBUFFER_TEXTURE_TYPE_NORMAL], GL_RGB, screenWidth, screenHeight); // Normal could you provide sourcecode for this?    since you don't specifiy it in gl_createGBufTex the GL_FLOAT part may be missing
  7. as phil_t said ... i recommend to use RGB32F which means 32bit for each vector component glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, height, 0, GL_RGB, GL_FLOAT, 0);   usually color textures have a RGB or RGBA format, which provides only unsigned 8 bit per component
  8. normal transformation looks correct, if you do no scaling on the modelMat even the modelMat itself would be a proper transformation for normals but since you transformed them to worldspace colors should be consistent for surfaces which equal orientation, which is clearly not the case for your rendering of worldspace normal vectors - so as soon as you get some lighting expect it to be wrong on the tanks   try to render the lightDirs next, pls post the result :)
  9. your position and normal are vec4, what values do the w components have? this can affect the normalization of the normal maybe use vec3 n = normalize(normal.xyz) or change the texture lookup your calculations of diffuse and specular terms seem to be correct   i also think you dont transform your normals correctly on the tanks blue is up, on the floor green is up transform normals in the geometry pass by the inverse transpose of modelview matrix
  10. for example tonemapping shaders use this functionality to read the average luminance from the smallest mipmap level which is only 1x1 pixel
  11. essentially the sampler is what brings your texture from a raster image to a 2d parameterized texture space, so you can index your texture in the shader not with pixel positions but with a continuous floating point value in 2 axis in range [0,1]   ok, nice, but how do we determine what color is on position [0.234, 0.789] ? first of all we need the texture size lets assume it's [512, 512] [0.234, 0.789] * [512, 512] = [119.808, 403.968] okay ... but at this exact position is obviously no pixel going the simple way we can just use the NEAREST pixel position [120, 404]   well but that looks pretty crappy, especially if we zoom into the texture ... another possibility would be to interpolate between the 4 surrounding pixels [119, 403], [120, 403], [119, 404], [120, 404] this method is called bilinear interpolation   i already mentioned zooming into the texture ... this is called the magnification filter and this case can be perfectly handled with bilinear interpolation ... but now imagine the shown texture covers less pixels than in the original texture if we use nearest we only get the one pixel marked on the right, if we use bilinear interpolation we get 4 pixels ... but actually we need the pixels of the whole patch .. and somehow combine the colors on the left you can see the result with linear interpolation, pretty ugly because we dont use enough information from our texture, this effect is called aliasing   and finally this is where mipmapping steps in the mipmaps of a texture are downsampled versions of the original textures ( original is the bottom one ) each mip level has half it's size of the previous level   resume to the image from before, we have a big area in texel space we have to cover ... we can now choose an appropriate mip level from our texture pyramid depending on the size of the area in texture domain ... choosing colors from appropriate mipmaps leaves us with image (b) from before   but wait there is more! if two pixels in screenspace are now textured from two different mipmap levels we can get artifacts,  compare bilinear mipmap with trilinear mipmap   trilinear filtering solves our problem, it samples a second mipmap level and interpolates again linearily between the sampled colors from the two chosen mipmap levels   but wait ... there is even more if you still have not enough from this subject look into ripmapping and anisotropic filtering
  12. oh i didnt actually answer your question ...   as i explained in my previous post vec3(InverseViewMatrix * vec4(0.0, 0.0, 0.0, 1.0) is equal to the camera position in world space what you want is a directional vector pointing from the fragments worldspace position to the viewer (= camera position) which is computed by   vec3 viewDirection = normalize(cameraPosition - worldSpacePosition));
  13. first of all viewMatrix is a matrix that transforms from worldspace to camera space the inverse therefore transforms camera space to worldspace   which means you transform the coordinate (0,0,0) from camera to worldspace, and this is the camera position in world space coordinate system i usually just pass the camera position vec3 uniform to the shader which is much simpler and clearer   if this matrix multiplication is unclear to you it may be valuable todo the matrix multiplication once by hand, and you will see that multiplying with vec4(0,0,0,1) is same as extracting the translational part of the matrix
  14. diffuseReflection = attenuation * vec3(SunlightDiffuse) * vec3(DiffuseMeshColor) * max(0.0, dot(normalDirection, normalDirection));     max(0.0, dot(normalDirection, normalDirection)); <-- this should describe with a value from 0 to 1 how bright the surface is ( you compute the squared distance of the normalDirection, which should always evaluate to 1 )   replace with   max(0, dot(normalDirection, lightDirection))   if both vectors are normalized this gives you the cosine of the angle between the vectors     for testing i suggest to compute only finalColor = vec4(vec3(max(0, dot(normalDirection, lightDirection))), 1);
  15. i thought this a bit further... as you said the blur should be only applied to pixels with alpha=0 therefore would normalize the blur kernel with the sum of weights at positions where alpha != 0   if i apply the blur once i get a border of 1 pixel around my chart in the 1d case (with blur [0.5 1 0.5]) it would look like this:   so applying the "blur" multiple times with a fragment shader, eventually fills the whole texture
  • Advertisement