Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

263 Neutral

About LukasBanana

  • Rank

Personal Information

  • Role
  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi all, I'm trying to generate MIP-maps of a 2D-array texture, but only a limited amount of array layers and MIP-levels. For instance, to generate only the first 3 MIP-maps of a single array layer of a large 2D-array. After experimenting with glBlitFramebuffer to generate the MIP-maps manually but still with some sort of hardware acceleration, I ended up with glTextureView which already works with the limited amount of array layers (I can also verify the result in RenderDoc). However, glGenerateMipmap (or glGenerateTextureMipmap) always generates the entire MIP-chain for the specified array layer. Thus, the <numlevels> parameter of glTextureView seems to be ignored in the MIP-map generation process. I also tried to use glTexParameteri(..., GL_TEXTURE_MAX_LEVEL, 3), but this has the same result. Can anyone explain me how to solve this? Here is an example code, how I do it: void GenerateSubMips( GLuint texID, GLenum texTarget, GLenum internalFormat, GLuint baseMipLevel, GLuint numMipLevels, GLuint baseArrayLayer, GLuint numArrayLayers) { GLuint texViewID = 0; glGenTextures(1, &texViewID); glTextureView( texViewID, texTarget, texID, internalFormat, baseMipLevel, numMipLevels, baseArrayLayer, numArrayLayers ); glGenerateTextureMipmap(texViewID); glDeleteTextures(1, &texViewID); } GenerateSubMips( myTex, GL_TEXTURE_2D_ARRAY, GL_RGBA8, 0, 3, // only the first 3 MIP-maps 4, 1 // only one array layer with index 4 ); Thanks and kind regards, Lukas
  2. LukasBanana

    XShaderCompiler (HLSL to GLSL translator)

    I added a UI debugger in the latest release (0.04-alpha) to experiment with real-time translation for testing purposes. The pre-compiled binary for the debugger is only available for Win32 platform, and the Visual C++ 2016 Redistributables are required.  
  3. LukasBanana

    XShaderCompiler (HLSL to GLSL translator)

      I first had the name XShader in mind, but checked it on GitHub, to see if there are other projects with this name. So I changed it to XShaderCompiler ^^   Unfortunately, GLSL still lacks the logic separation of sampler states and texture buffers, although there are Sampler Objects in OpenGL. So I remove all appearances of SamplerState in the AST and only translate the Texture2D etc. to sampler2D respectively.   e.g. "tex0.Sample(samplerState0, texCoord)" becomes "texture(tex0, texCoord)".
  4. Today I want to present my latest project (and I still don't know where to put this topic elsewhere):   The XShaderCompiler is a cross-compiler, which translates HLSL (Shader Model 4 and 5) into GLSL (1.30 to 4.50) code.   I've uploaded the first Pre-Release (v0.02-alpha) on github with binaries for Win32, MacOS, and Linux. There is also a very short GettingStarted document which explains the most important shell commands.   The compiler tries to output 'pretty' code, i.e. reduces unnecessary wrapper functions, provides optional commentary preservation, and overall structured formatting (with a few configurations available).   However, don't expect too much, it's still in alpha state!   Greetings, Lukas
  5. LukasBanana

    LLGL (Low Level Graphics Library) Project

    Yeah, you're right. I already worked on a cross-compiler like that (see HLSLTranslator), but it's an unfinished project. For 100% uniformity you'll need a little more than just an abstraction layer like this. The differences between framebuffers in OpenGL and render targets in Direct3D are a problem, too. Or rather their lower-left vs upper-left image space origin.
  6. Hello to all graphic enthusiasts :-)   I'm currently working on a thin abstraction layer for Direct3D 11 and OpenGL (D3D12 and Vulkan will follow) to have a unified interface for my graphics applications (demos, prototypes, games, etc.).   Today I uploaded the first pre-release of my project on github: LLGL (Low Level Graphics Library) 0.01 Beta   The library is well documented and has a Getting Started PDF file. The library is also pre-compiled for Win32-MSVC14 (VisualC++ 2015), and Linux 64-bit (GCC).   I hope someone can make use of it and maybe I can get some feedback ;)   And here are a few screenshots of the Tutorials: (but remember it's a low-level library, so don't except too much from the tutotrials)   [attachment=33603:Tutorial02_Tessellation.png]   [attachment=33604:Tutorial05_RenderTarget.png]   [attachment=33605:Tutorial06_MultiContext.png]   [attachment=33606:Tutorial10_Instancing.png]   Greetings, Lukas
  7. LukasBanana

    State Change Management in D3D11

    That was actually all I wanted to know:   I know the basics of reasonable rendering state management, but I'm currently only writing a thin abstraction layer to have a unified interface for Direct3D and OpenGL. So within this project, I have no render loops or material managment, just the basic render states.   Thanks and greetings, Lukas
  8. Can anyone tell me how important state change management is, when the parameters actually do not change? e.g. when several calls to "ID3D11DeviceContext::IASetPrimitiveTopology" are done with the same topology parameter. Are such redundant state 'changes' handled quickly in D3D11 or should it be managed by the client program, e.g. by just storing the parameter and then check if it must be changed or not: StateManager::IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY topology) { if (m_currentTopology != topology) { m_deviceContext->IASetPrimitiveTopology(topology); m_currentTopology = topology; } } That is actually what I currently do with OpenGL, to reduce the state changes. But I guess D3D11 is not such a heavy weighted state-machine as OpenGL is.   Thanks in advance.
  9. Initializer lists are very buggy in VisualC++ 2013, so that's what I've done several times: #include <vector> #include <iostream> struct S { S(const std::vector<int>& items) { for (const auto & item : items) { std::cout << item << "\n"; } } }; int main () { S s({ 1, 2, 10, 20 }); }
  10. LukasBanana

    Difference between HAP and DXT format?

    Yes, this is what I'm referring to.   I actually want to output a HAP encoded video with DirectShow, but I don't know exactly what must be specified as media sub type within the CTransformFilter::GetMediaType function callback.   I currently use DXT1 for the FOURCC field (MEDIASUBTYPE_DXT1): DEFINE_GUID( MEDIASUBTYPE_DXT1, FOURCC_DXT1, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 ); Is this correct? I also tried this: #define FOURCC_Hap1 MAKEFOURCC('H','a','p','1') DEFINE_GUID( MEDIASUBTYPE_Hap1, FOURCC_Hap1, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 ); But it only influences the info output within GraphStudioNext.   So what makes a video a HAP encoded video? I don't think that specifying the media sub type is enough. The frames are DXT encoded.
  11. Hi everybody,   does anyone know the difference between the HAP and DXT formats? I know that HAP is a codec, but there is also HAP1, HAP2, HAP3, ... like DXT1, DXT2, DXT3, ... and for me it looks like HAP is just a synonym for DXT. Is that right?!   Thanks in advance. Lukas
  12. I'm using R32G32 Float as well, and the min and max Z values are available to me in the final shader stage. I start with the MIP level 2 and I stop when the MIP level reached 0.
  13. Hi, the red rectangle on the left marks indeed rays moving towards the camera. I do this with a linear ray march. But the rectangle on the right shows the rays, computed with Hi-Z ray tracing.   Yasin Uludag talks about a way to travel rays behind geometry, but he does not explain it in detail. Only that a min- and max Hi-Z buffer is required, and that it's quite complicated.   Anyway I won't spent much more time on this problem before I complete my Bachelor thesis.   Greetings, Lukas
  14. I'm again working on this effect and I'm stuck with the hidden-geometry problem. How do you detect in the HiZRayTrace procedure if an intersection is invalid because of hidden geometry?   Here is a screenshot where the problem is clearly visible:     At the marked areas there should actually no reflection. How can I solve this?   Moreover the following code part for ray traversal behind geometry does not work for me: // Does not work for me: I get lots of artifacts and the ray traversal is not correct vec3 tmpRay = IntersectDepthPlane(rayOrigin, rayDir, clamp(rayPos.z, zMinMax.r, zMinMax.g)); // MIN/MAX // Only the minimal Z version works for me: vec3 tmpRay = IntersectDepthPlane(rayOrigin, rayDir, max(rayPos.z, zMinMax.r)); // MIN
  15. @WilliamHamilton:   Sure, this function is really that simple. He explains we can simply linear-interpolate the post-projected Z, because we interpolate it in (post-projected) screen space. Figure 4.10 on p.160 is helpful here.   I can't do that right now, sorry. It's part of my bachelor thesis. When my work is done (expected next year), it will be possibly open-source.   @all:   I finally resolved the staircase artifacts with NPOT (non-power-of-two) resolutions! Thanks WFP, your hint about the Hi-Z MIP generation was very helpful :-), but I have a slightly different solution.   Here I made a sketch for a single Hi-Z MIP generation pass (example shows generation of the MIP size 2x2 from the previous size 5x4):     Instead of always sampling with the offsets (0, 0), (1, 0), (0, 1), (1, 1), I use an offset which is either 1 or 2. Pseudocode: tex.Load(coord + int2(0, 0)); tex.Load(coord + int2(offset.x, 0)); tex.Load(coord + int2(0, offset.y)); tex.Load(coord + int2(offset.x, offset.y)); As you can see I don't use "SampleLevel" (or "textureLodOffset" in GLSL), instead I use "Load" (or "texelFetch" in GLSL). On the C++ side I update this offset before every MIP-Level generation pass: // Check for width and height if it's even or odd. constantBuffer.offset.x = (upperMIPLevelSize.width % 2 == 0 ? 1 : 2); constantBuffer.offset.y = (upperMIPLevelSize.height % 2 == 0 ? 1 : 2); This works pretty good for me. Here is a comparision screenshot with my previous and current solution:     This is a 800x600 resolution but I also tested totally flubbed sizes like 812x617   Hope this helps someone :-)   Greetings, Lukas
  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!