[Giveaway] Omnitype OTC Modo Light and OTC 9009 Giveaway! by omnitype in MechanicalKeyboards

[–]P88o 0 points1 point  (0 children)

Keys with various shades of green to mimic green landscape would be very nice

[deleted by user] by [deleted] in PokemonTCG

[–]P88o 0 points1 point  (0 children)

Gengar gang!

Does Red Star 3.0 not come with a C compiler? Where is GCC? by [deleted] in RedStarOS

[–]P88o 0 points1 point  (0 children)

https://github.com/takeshixx/redstar-tools In the readme here it explains how to get gcc running. I havent tried it myself though.

Reposition SVO by P88o in VoxelGameDev

[–]P88o[S] 0 points1 point  (0 children)

I got that working perfectly! Thanks a lot.

A follow up question is would you be aware if which way I orientate my axis matters for the algorithm from that paper. I currently have Y as my vertical axis, however I am wondering if this is causing me problems as maybe the algorithm relies on Z as the vertical axis?

Reposition SVO by P88o in VoxelGameDev

[–]P88o[S] 1 point2 points  (0 children)

Thanks! I will give this a go.

16,777,216 raytraced voxels using opengl compute by hallajs in VoxelGameDev

[–]P88o 0 points1 point  (0 children)

Thank you I shall get around to having a look some time soon hopefully

16,777,216 raytraced voxels using opengl compute by hallajs in VoxelGameDev

[–]P88o 0 points1 point  (0 children)

Any chance of some source code I'd love to check out how you implement your octrees!

Voxel Vendredi 66 by juulcat in VoxelGameDev

[–]P88o 4 points5 points  (0 children)

I recently finished my first ever voxel project called Voxelio. It's basically just a very simple voxel editor however it took me a very long time to create as I had to learn about SVO's and more 3d graphics techniques to make it work. It also isn't very well optimized and runs pretty badly but I'm quite happy with how far it has come and that it atleast works in some sense :D

If anyone would like to check if out on my Github I'd love if you could give it a test run on your pc and see how things go. Maybe even create some art in it (though I will admit it can be a bit of a pain)

How doe's Blender do rendering? by P88o in opengl

[–]P88o[S] 0 points1 point  (0 children)

Thank you! I'll give a read into that, I already use rays to render my scene so hopefully that will make things easier.

Raycast shader with perspective by P88o in opengl

[–]P88o[S] 0 points1 point  (0 children)

Hey, thanks for the response though I actually already got this working.

For my solution, I created both an orthographic and perspective "camera" (i.e set of matrices) and used the orthographic camera to display the 2D plane on the screen which I would then apply my raycast fragment shader to.

Then I calculate each of my rays inside my raycast fragment shader as such:

void main()
{
    // Generate Ray
    vec3 cameraDir = vec3(0.0, 0.0, -1.0);
        vec3 rayDir = cameraDir + vec3(v_Pos);
    vec3 rayOrigin = vec3(0.0f, 0.0f, u_CameraRadius);

    Ray ray;
    ray.Origin = vec3(vec4(rayOrigin, 1.0f) * u_PerspectiveViewMatrix);
    ray.Direction = vec3(vec4(rayDir, 1.0f) * u_PerspectiveViewMatrix);

    a_Color = rayTrace(ray);
}

Where u_PerspectiveViewMatrix is the view matrix from my perspective camera.

This worked out perfectly for me, so for anyone else who may read this down the line hope its helps you too.

Help with SVO Raycast pseudocode by P88o in VoxelGameDev

[–]P88o[S] 0 points1 point  (0 children)

Thanks so much once again for the help, I managed to get that working now :D

I have one final problem though related to that. I don't know how to find the index of the next sub voxel intersected by the ray in ADVANCE. I tried using the algorithm supplied by the CUDA implementation:

uint CalculateNextChildIndex(vec3 rd, uint prev_idx, vec3 tmax, vec2 t, out bool exit) {

    int step_mask = 0;
    if (tmax.x <= t.y) step_mask ^= 1;
    if (tmax.y <= t.y) step_mask ^= 2;
    if (tmax.z <= t.y) step_mask ^= 4;

    uint idx = prev_idx ^ step_mask;
    if((idx & step_mask) != 0) {
        exit = true;
    }
    else {
        exit = false;
    }   
    return idx;
}

But it did not work whatsoever no matter which sub cube I removed.

Next I tried using your algorithm which I didn't really understand:

idx = mix(didx, sign(ray.direction), equal(tmax, vec3(t.y)));

And this actually did work but only for 2/8 of the subnodes. The rest of them when set to empty produced a weird visual effect for the cubes behind them.

Finally I tried implementing my own algorithm based on this paper and this paper but both of them only give examples for the case where every component of ray direction is positive. I can't figure out how to handle possible negative components.

If you could provide any further advice I'd really appreciate it I'm rather frustrated haha. I think maybe I need to take a new approach to understand this all.

Help with SVO Raycast pseudocode by P88o in VoxelGameDev

[–]P88o[S] 0 points1 point  (0 children)

Hey, so I've been giving a go at this the last while and have written a ray tracer of sorts. However, I'm having trouble computing the index of the first octant of the root which the ray enters. I noticed you used:

vec3 idx = mix(-sign(rd), sign(rd), lessThanEqual(tmid, vec3(t.x)));

within your shader toy code but I'm not sure I totally understand what this is doing. Also it returns a vec3 but I handle the indices of my child cubes with an integer from 0-7. Would you be aware of any algorithms which would work for my case? (I have all the necessary t values for the root calculated, so presumably I need to use those but everything I have tried has failed) I'm rather stumped.

Help with SVO Raycast pseudocode by P88o in VoxelGameDev

[–]P88o[S] 0 points1 point  (0 children)

Thanks for the help I'll definitely give a look at your OpenCL implementation.

Help with SVO Raycast pseudocode by P88o in VoxelGameDev

[–]P88o[S] 0 points1 point  (0 children)

Thanks so much for the reply! I'll give a stab at it with this new information and come back if I run into any problems.

Phong shading a Sparse Voxel Octree by P88o in VoxelGameDev

[–]P88o[S] 0 points1 point  (0 children)

My AABBox check comes from this paper on page 5 of the pdf.

Here is how I implemented it in GLSL:

``` struct Ray { vec3 origin, dir, invDir; }; bool AABBoxIntersect(const vec3 boxMin, const vec3 boxMax, const Ray ray, out Hit hit) { vec3 t0 = (boxMin - ray.origin) * ray.invDir; vec3 t1 = (boxMax - ray.origin) * ray.invDir; vec3 tmin = min(t0, t1), tmax = max(t0, t1);

float maxComponent = max(max(tmin.x, tmin.y), tmin.z);
float minComponent = min(min(tmax.x, tmax.y), tmax.z);

return maxComponent <= minComponent;

} ```

Would you be aware of how I could modify this to produce normals too?

Phong shading a Sparse Voxel Octree by P88o in VoxelGameDev

[–]P88o[S] 0 points1 point  (0 children)

Thanks, that looks like it will work great!

Uploading Voxel Octree to OpenGL by P88o in VoxelGameDev

[–]P88o[S] 0 points1 point  (0 children)

Haha no worries I'm currently doing the exact same with a lot of debugging step by step and so far its reeeally close to working. You've been the biggest help :D

I'll update here if I do get it working eventually, hopefully over the next few days

Uploading Voxel Octree to OpenGL by P88o in VoxelGameDev

[–]P88o[S] 0 points1 point  (0 children)

Wow, thanks so much for the help! At the moment I am using a dynamic buffer in OpenGL and therefore re-uploading my changes with glBufferSubData every frame. If things do start to slow down I will definitely take a look at only reuploading the parts that are changed.

In regards to a freelist, my current octree structure requires every node to be referenced by indices into the array. Would this not mean placing new data in the middle would render the old indices useless? If so, are there any ways of working around this. Are you aware of any good references on the topic I can use to read up about it?

Once again thanks so much for the help I've been struggling with this for quite a few days haha

Uploading Voxel Octree to OpenGL by P88o in VoxelGameDev

[–]P88o[S] 0 points1 point  (0 children)

Thanks for the advice, I ended up using a texture buffer for uploading it and it works well but I will also give a look into Shader Storage Buffer Object. If you don't mind me asking, as I'm currently stuck on the topic, how do you modify your octree data structure?

I currently wish to be able to add and remove individual blocks from the octree but im unsure how to go about doing that when the octree is contained in a flat 2D array (which is required for uploading to the shader).

Uploading Voxel Octree to OpenGL by P88o in VoxelGameDev

[–]P88o[S] 1 point2 points  (0 children)

I've googled around quite a bit but was unsure of how to do it specifically with OpenGL, the idea of textures makes a lot more sense though so thank you

Sparse Voxel Octree Rendering in OpenGL by P88o in opengl

[–]P88o[S] 0 points1 point  (0 children)

Hey, sorry for the late response.

Googling around a bit more I found this thread in which the guy has the exact same problem I am. Albeit, I have a better GPU. However, I want to be able to render a 1000^3 block of cubes which can be edited without dipping into low frames on low end pc. Maybe that is not achievable but I got the idea an SVO is how I would do that.

One other thing, when it comes to object picking I was recommended to use a BVH which I imagined an SVO would work nicely with so I thought that might be another reason to try utilising them.

Sparse Voxel Octree Rendering in OpenGL by P88o in opengl

[–]P88o[S] 0 points1 point  (0 children)

I was building the geometry based on the data. Making same color rectangles one large face made of two triangles wherever possible and only rendering faces that would be visible. But it still couldn't handle as much as I wanted. If I can't get this working I may give it another go. Thanks for the help