Jump to content

SpiderPig

Members
  • Posts

    2,285
  • Joined

  • Last visited

Posts posted by SpiderPig

  1. I have packed integers and floats into a texture to use in my shader.  Information is packed into the texture by poking a buffer and then assigning that buffer to an RGBA texture.  The following code extracts an integer from a texelFetch result in the fragment shader.  It seems to work well.

    int BytesToInteger( in vec4 pixel ) {
    	return ( int( ( pixel.w * 255.0f ) ) << 24 ) | ( int( ( pixel.z * 255.0f ) ) << 16 ) | ( int( ( pixel.y * 255.0f ) ) << 8 ) | int( ( pixel.x * 255.0f ) );
    }

    However the same process does not work for floats and I'm sure there is a reason why but I can't figure it out.  Any one know the answer? <_<

    float BytesToFloat( in vec4 pixel ) {
    	return float( ( int( ( pixel.w * 255.0f ) ) << 24 ) | ( int( ( pixel.z * 255.0f ) ) << 16 ) | ( int( ( pixel.y * 255.0f ) ) << 8 ) | int( ( pixel.x * 255.0f ) ) );
    }

     

  2. On 2/25/2023 at 6:26 PM, SpiderPig said:

    Through brief trial and error I got this example to work.  I want to be able to get the materials index so I can retrieve multiple materials in the shader for my voxel terrain.  I can find a way to send the materials indexes I need to the shader, that shouldn't be a problem.  (I'll probably use a small texture to hold the index)  It's just actually getting the material index.  Something like this perhaps?

    material->GetIndex()

    My C++ Code:

    Is this possible yet?

     

  3. 3 hours ago, Josh said:

    Libzip probably does not either:
    https://github.com/nih-at/libzip/issues/239

    In this link the guy reckons it does actually work on 64 bit machines... just not on 32bit.  To me that makes sense that a 32bit machine can't load something bigger than 4GB but I'm no expert.

    Quote

    Note that the same code (same libzip version, same ZIP file) works correctly on 64-bit devices. I checked on both AMD-64 and ARM-64.

     

    26 minutes ago, reepblue said:

    The library that 7z uses should be apart of ziplib unless Josh excluded it.

    I did try loading a 7GB ".7z" file just to be sure but it didn't load.  I don't know much about 7z, it uses LZMA or something?  Maybe this SDK is what I need to make a 7z plugin.

    https://www.7-zip.org/sdk.html

    But I don't know, maybe libzip has a bug with loading over 4GB files...

  4. 13 minutes ago, Josh said:

    I compressed it with 7zip, it's interesting that last comment saying it's not a zip?  Even though it is... and I've compressed large files with window's default zip too and it worked above 4GB.

    Anyway, I can open the 7GB in windows explorer to search the files and I can extract from it.  Don't know any other software besides 7zip to try it with...

  5. I've compressed 5,259 4096x4096 r16 heightmap files into a zip file.  It's about 7GB of data.  Using LoadDir("") to list the files at the root returns a size of 0 ONLY for this zip file.

    I used the code below on a zip file of 5,259 1024x1024 r16 heightmaps (1.2GB) and it worked fine.  Pretty sure all the files have the exact same names in both zip files.  It's just the map resolution that is different.

    I thought maybe LoadDir() or LoadPackage() doesn't like the large zip file?

     

    This is the snippet of code that handles the loading.

    if (extension == "zip") {
    	auto package = LoadPackage(filepath);
    
    	if (package != nullptr) {
    		auto dir = package->LoadDir("");

     

  6. Been working on streaming voxel terrain and I'm pretty happy with the results so far.  Nearly completed the streamer class.  Each tile below is a 1024x1024 r16 heightmap.  The area in view is about 50km2.  The red tiles are tiles I've removed from the dataset because each pixel in those maps are zero (below the water surface).  The test data set I made is a grid of 120x120 tiles which was 14,400 heightmaps files.  However after removing all the tiles that were of zero height it became about 5,600 tiles.  About 10GB all up.  Should be able to compress that in a zip but will need to do more testing yet... was giving mixed results.

    StreamingVoxelTerrain.thumb.png.bfbab3d3b9b326df2b436cc985f2b653.png

    StreamingVoxelTerrainWireframe.thumb.png.50dfe49673306c81339aa2fd7c688963.png

    Simple to set up. :D

    void CreateStreamingVoxelTerrain() {
    	voxel_brush = CreateVoxelBrush();
    	voxel_brush->SetSurfaceFunction(CalculateTerrainSurface);
    
    	voxel_world = CreateVoxelWorld(world, 1024, 16.0f, 7);
    	voxel_world->EnableStreaming(true, "Maps\\Data");
    	voxel_world->SetDimensions(490000.0f, 1617.0f, 490000.0f);
    	voxel_world->FlipY();
    	voxel_world->AddBrush(voxel_brush);
    	voxel_world->AddObserver(camera);
    
    	voxel_world->DrawVoxelObjectBounds();
    	voxel_world->DrawPatchBounds();
    	voxel_world->DrawBounds();
    }

     

    • Like 3
  7. 4 hours ago, Leag said:

    I tested the other three viewports as well, and switching to the 3D viewport doesn't turn them white. However, the issue seems to be exclusive to the 3D viewport—changing it to top/back/right/left, and then switching back to 3D, triggers the white background.

    In the other 3 viewports did you try switching back and forth between 3D at least twice?  That did it for me.  Default -> 3D -> Front -> 3D = white.

  8. I just tried this too and get the same bug.  I tried the other 3 viewports as well.  Switching from their default view to another ortho view doesn't do it.   Even switching from ortho to perspective doesn't do it.   But if the viewport has been perspective at some point, switching to perspective again at some point makes the viewport white.  Actually in my case black but then white when I click inside it.

    I have GTX 980 TI + Windows 10.

    • Thanks 1
×
×
  • Create New...