Jump to content
  • Advertisement

Furion117

Member
  • Content Count

    8
  • Joined

  • Last visited

Everything posted by Furion117

  1. I'm trying to find a way to make textures that store at least 1 component of color with good accuracy. I generate the texture like this: glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, TEXTURE_SIZE, TEXTURE_SIZE, 0, GL_RGBA, GL_FLOAT, 0); Then I fill in the data with a compute shader. I bind the texture like this: glBindImageTexture(1, texture, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8); And save the data in the shader like this: imageStore(destTex, c, height.xyz); This produces terrain that looks like steps since my terrain is large and tall. I assume this because each color gets 8 bits. Is there a way to get more precision for at least the red component and be space efficient?
  2. Furion117

    Texture for Heightmap

    I've done that too.   I think I'll just use a buffer of floats instead of a texture.
  3. Furion117

    Texture for Heightmap

    I use it in a shader. The bindings don't seem to need to change in any way: glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texture);   I tried just writing .3 and .8 to the red channel and rendering the texture to screen with a full screen quad. The colors are same when I use R32_F. When I use RGBA8 the .8 renders brighter.   When I use my noise function for terrain, R32_F produces some very erratic terrain.
  4. Furion117

    Texture for Heightmap

    The original data is NULL.   I fill it in with a compute shader.
  5. Furion117

    Texture for Heightmap

    I tried your suggestion:   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, TEXTURE_SIZE, TEXTURE_SIZE, 0, GL_RGBA, GL_FLOAT, 0); is now glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, TEXTURE_SIZE, TEXTURE_SIZE, 0, GL_RED, GL_FLOAT, 0);   glBindImageTexture(1, texture, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8); is now glBindImageTexture(1, texture, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_R32F);   This however provides extremely different results. Is there anything I would have to change elsewhere?   Sorry I am relatively new to opengl.
  6. Fixed it by using a compute shader and overlapping the textures.
  7. Sorry if this has been asked before.   I am procedurally generating (very large) terrain and have a problem with discontinuities of chunks with the same LOD.   Let's say I start with this at the coarsest level of detail. [sharedmedia=core:attachments:26718]   Whenever I split the top chunk I want to render higher res height maps for each of the children. I use the GPU to do this. So I make 4 new meshes and 4 new height maps. The maps are seamless if you place them next to each other.   The problem is that the children share vertices and when rendering these shared vertices look at different height maps.   [sharedmedia=core:attachments:26719] (Just the bottom 2 children, top 2 omitted) (height maps are two separate textures). In this diagram when rendering the red child, vertices A and B look to the 'left' texture for a height map value and when rendering the blue child, vertices A and B look to the 'right' texture for a height map value. They get ever so slightly different values since the images are continuous between children.   I could instead generate the height for each vertex in the vertex shader, but this seems like this would be very slow once I get down to the finest LOD. Especially if I wanted to do bi-cubic interpolation on the heights.   I could also compute the height on the CPU side for each vertex but running complex noise functions seem to take upwards of 25-30 ms even for small resolutions. That's my entire frame!   Any thoughts?
  8. I thought of that too, but I'm not sure about how to actually do it. I render the textures using a 2x2 quad and pass in the world coordinates of the 4 corners of a chunk/node.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!