🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

OpenGL 4 reflections

Started by
110 comments, last by taby 1 year, 7 months ago

So, I took a look at the code. Am I correct in understanding that the position is an unsigned char? That means that the vox file is limited to 256 voxels wide?

Advertisement

@taby : yes, the voxels in each block run from 0 to 255 in each dimension. That is why there would be multiple blocks of voxels.

Although the code I've given you isn't yet set up to read those extra blocks.

taby said:

Holy cow! Thanks so much.

P.S. How do you visualize the voxels in your projects?

You are very welcome!

As for how I visualize the voxels. . . I use static mesh instancing to create a whole bunch of cubes.

Regarding the voxel visualization process : I should add that I also use octrees to consolidate the voxels into larger cubes, when it is possible to do so.

ok, thank you sir!

Is Z up in MagicaVoxel?

@taby Yes, Z is up.

After some serious deliberation today, I decided to try using a different library. It's nothing personal. The library that I am using supports multiple models, layers, etc.

https://github.com/jpaver/opengametools

There is only one glitch… the hair colour is purple, but it should be orange. The rest of the palette looks good!?

I am calculating the uv as

float(colour_index) / 255.0f;

I also tried the following, which is closer, but not quite:

const float uv_index = float(colour_index - 1) / 254.0f;

Maybe this works:

(float(colour_index) + 0.5f) / 256.0f; // adding half a texel so we sample from the middle of texels, not at some edge between two texels

But just a guess.

Thanks for the idea. I tried it out, but it doesn't quite work. However, I tried this, and it works:

const float uv_index = float(colour_index - 1) / 255.0f;

This topic is closed to new replies.

Advertisement