pbobzebuilder

Members
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

387 Neutral

About pbobzebuilder

  • Rank
    Newbie
  1. OpenGL Equivalent to D3DReflect for OpenGL

    Thanks a lot !   glGetProgramResourceName, glGetActiveAttrib, glGetActiveUniform... will do the job. 
  2. Anyone knows if there's an equivalent to D3DReflet for Opengl ?   D3dReflect allows to Query the shader needs after compilation.  
  3. GPU Normal Maps Artifacts on a Quadtree Terrain

    Thanks to take the time helping me :)   I haven't tried to precompute values by the CPU but it could reduce the artifacts if precomputed using doubles.... I'll give it a try :)   My terrain is actually a 1:1 scale planet. My normals are computed in object space which explain the matrix (Used to transform my normals from planar heightmap to sphere).   Coordinates passed to my noise function are between -1, 1 at quadtree-depth = 0. May be I could try another scale to limit f32 precision issues.
  4. GPU Normal Maps Artifacts on a Quadtree Terrain

    My problem comes much from where the heightmap comes from. I create an heightmap for each leaf of my quadtree. As I go deeper in the quadtree subdivision, I continuously create heightmap based on miscellanous noise functions. At a given depth (about 14 subdivs) the input coordinates for the noise are too small for a 32 bits float (I'm doing it with the GPU). This precision issue leads to really bad artifacts in the normal map.   Nothing strange about the way normals are computed. There's multiple ways to compute normals. Here I choose a fast and simple shortcut. I Could have used something like sobel filter but it takes more computations and more sampling from the heightmap. Instead, I only do the difference between the top and above Heights for one axis and the difference between left and right Heights for another axis. Given a Y axis = 2.0 for a quadtree depth of 0 I'll have Y=1 for Depth=1; Y=0.5 for Depth=2, Y=0.25 for Depth=3 and so on... (here is why the 1<<pTreeNode->GetDepth() is for.)
  5. Terrain Normal Map

    For a terrain & if your normal map is computed from a heightmap, you can use world space normal maps. Your normalmap will only be used on the terrain (tangent space allow you to use your normal map on any geometry).
  6. GPU Normal Maps Artifacts on a Quadtree Terrain

    Been trying all the day to get around the problem without any success. I think I'll bypass the precision issue by setting the maximum quadtree-depth of the normal map to 14.   I'll be happy to discuss with anyone having similar problems.
  7. GPU Normal Maps Artifacts on a Quadtree Terrain

    Just checked my UVs but those are correct.  I keep digging the Normal Calculation, but I think I was wrong and my real problem is my noise function reaching the limits of float.   Question is: How to generate good looking NormalMaps from HeightMaps generated on the GPU at ground level.
  8. GPU Normal Maps Artifacts on a Quadtree Terrain

    I think it's definitely a precision problem from the GPU to deal with too small values from the HeightMap.     If anyone have a clue for me
  9. Hi,   I'm actually working on terrain rendering based on quadtree & GeoMip Terrain. I've implemented normal maps generation by the GPU and everythings works fine except I'm getting artifacts near the ground. I Get lines (cf screenshot) after the normal calculation wich is certainly a precision issue.  Heightmaps are 256^2, and shows no artifacts. Normal Maps are 256^2 and artifacts shows at ground level (Quadtree depth is 16 and above.)  Both are R32G32B32A32_FLOAT textures.     If anyone has an idea or experienced those kind of artifacts, I'll be grateful     Here is my normalMap HLSL code (with scale coming from CPU : f32 scale = 1<<pTreeNode->GetDepth(); );     float2 uv = input.tex0; float3 sphere = heightMap.Sample(heightMapSamplerState, uv).xyz; float hpix = PixelSize; float normalStrength = 0.5;   float l = heightMap.Sample(heightMapSamplerState, uv + float2( -hpix, 0)).w; float r = heightMap.Sample(heightMapSamplerState, uv + float2( hpix, 0)).w; float t = heightMap.Sample(heightMapSamplerState, uv + float2( 0,   hpix)).w; float b = heightMap.Sample(heightMapSamplerState, uv + float2( 0,  -hpix)).w; float tanZ = (t-b); float tanX = (l-r); float tanY = 2.0 / (scale*normalStrength); float3 normal = normalize(float3(tanX, tanY, tanZ)) * 0.5 + 0.5; float ny = normal.y;   float3x3 mat = BuildRotationMatrix(sphere, float3(0.0f, 1.0f, 0.0f)); normal = mul(normal.xzy, mat); //FaceMatrix   return float4(normal, ny);