Giter Club home page Giter Club logo

cpuvox's Issues

Wrong Lod?

Hard to reproduce, but in some cases it seems the wrong LOD is used.
image

Small lines appear when in very specific viewing angles

How to Reproduce:
Create a Build use 1024 world size and go to Conference example model.
Don't click anything, just press Escape, it should snap your viewing angle this specific angle causes Three lines to appear in the model

image

After some time it seems to randomly just Freeze

After what appears to be a random amount of time things just Freeze.
Happens in both Editor and Build, no Crash log or anything, Editor log appears to just Cut off without saying anything is wrong.
CPU Usage seems to continue going, however the editor or game itself just stops responding.

Lines appears in Build

image

Weird Lines appear to only happen in Builds works fine in editor, Looking around changes it, if i look in just the right direction/angle they dissapear.

Some cache usage improvement ideas

Hello! I've been working on my own raycaster very similar to this one, and I figured out some ideas to make cache hit rate and utilization much better, and thought they might help.

1 - If you store colors and rle segments separately, you won't pay the cost of pulling the colors into the cache, if it turns out that all of the column segments are not actually visible on-screen. I highly recommend this, because it means more runs will be in cache.

2 - When traversing the world, the most common case of traversal is probably an equal step in x and y directions. This means that if you store your world arrays contiguous in one access, like this

    01234567
    89ABCDEF

If you turn so your view goes across the rows, every grid sample will require a new cache line fetch!. So, I would recommend a simple tiling scheme, just 2x2 or 4x4 tiles should help utilize cache line fetches of the map data better. (If column rle segments and colors are stored together, this is likely not as effective)

If instead of doing (y*width)+x, or (x*height)+y indexing, you mix the bits of both axes, you can get some nice tiling

YYXXyx for example, will give you

01 45
23 67

89 CD
AB EF

The logical conclusion of a setup like this is full morton coding e.g. XyXyXyXy, there are diminishing returns above simple tiling, but it also might be worth a shot.

3 - This might not be applicable for your renderer, but it helped me to store a separate "column header" type data structure, which only has the heights of the top and bottom filled voxels in the column, and the number of runs. This allows me to pack as much important culling information (is the top below the screen? is the bottom above the screen? etc) into cache as possible. So, I have 3 main world arrays, column_headers, column_runs, and column_colors.

Hope these ideas help! My raycaster doesn't do lod or a lot of the fancy stuff yours does quite yet, but they improved performance for me by over 2x.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.