# toss-dev

Member

7

118 Neutral

• Rank
Newbie

• Interests
Art
Audio
Design
Production
Programming
QA

• Github
rpereira-dev
1. ## UV map blocky voxel models

Hey JoeJ, thank you for your interest. The thing is, mapping each block will be a waste of memory (as many block faces are in-deed not visible!) Also, for other technical reasons, I need those 'plans' to be mapped continuously on the texture. The paper you give me seems quite complicated to me, I don't think that's necessary. My problem seems much simpler Still, thank you a lot, my model actually are Polycubes! And I didn't even know about this designation ^^ So I will search from this side
2. ## 3D UV map blocky voxel models

Hello there, I here have a quite technical question, and as my english isn't perfect, feel free to ask any questions if I wasn't clear enough on my explanations. I am building a homemade voxel model creator. My models are a set of blocks, from which I generate a mesh. I would like to texture them using an external 2D image file. So, I have to 'uv-map' the vertices of my model, meaning, having a projection of 3D vertices on a 2D plane (texture) I am looking for an algorithm to generate an optimal texture (optimal: having the lowest memory usage but still holding every vertices, without overlaps) Let me pose the problem more formally. Feel free to look at the example if there is any comprehension issues. • What I have: I have list of planes, where each planes is defined by 2 integers (width, height) • What the algorithm should do: 1) give the smallest (in term of area) rectangle which can hold every planes, without overlaps 2) give the position and orientation of each planes relatively this rectangle. The position is where the plane should be mapped. (x, y), the orientation is 0 or 1, weather the plane is flipped once mapped. Flipped: map on the rectangle from (x, y) to (x + height, y + width), (instead of (x, y) to (x + height, y + width)) There might be multiple optimal solutions (as the following example shows, I would like to find an algorithm that generate at least one of them) Example: (notice that "LEFT" plan is flipped once mapped here) sample.bmp Source code: https://github.com/rpereira-dev/VoxelEngine/blob/master/VoxelEngine/src/com/grillecube/client/renderer/model/editor/mesher/ModelMesherCull.java Screenshot: modelEditor.bmp NB: I've posted this topic on the "graphic and GPU programming" section; as this generated texture will be used in an OpenGL context.
3. ## 3D Auto rigging algorithm for cubical-voxels models

Hi everyone, thank you for your attention. I'm making a 3D model editor based on voxel, to create models which looks like cubeworld ones (see https://i.stack.imgur.com/y5SWz.jpg) I've implemented a skeleton-key frames animation system. (My model has a mesh of vertices, and each vertices has a list of bones and weights, to determine how much a bone transformation affects the final vertex transformation) **And now, I'm looking for an algorithm to generate vertex bones weights automatically. I have each vertex position and bone position/rotation/size relatively to the model referential.** (Blender does implement this functionality https://blender.stackexchange.com/questions/782/how-can-i-automatically-generate-vertex-groups-for-an-armature ) PS: Google searching "auto rigging algorithm" actually gives some essays, but as I'm using voxel (as raw cubes), I would be glad to find something more specific/optimized/good looking
4. ## Fast Approximation to memcpy()

Hey man, I don't think you can optimize 'memcpy()' or 'memset()' ... see GNU implementation and actual optimization implemented https://fossies.org/dox/glibc-2.24/string_2memcpy_8c_source.html   You may be able to approximate by only copying 1 bytes of 2, but the unset memory will hold random data... is that really what you want?   However,, if you perfectly know what size is the memory, you can implement something like this (less comparison are done => faster program) (copying 8 bytes per 8 bytes => 8 times faster than byte by byte if working on a 64 bit system) /** if we know src and dst are multiple of 64 bytes (8 uint64_t) */ void * memcpy(void * src, void * dst, size_t n) { uint64_t * s = (int *)src; size_t len = n / sizeof(uint64_t); uint64_t * ptr = (int *)dst; uint64_t * end = (int *)(dst + len); size_t i = 0; while (ptr < end) { *ptr++ = *s++; //1 *ptr++ = *s++; //2 *ptr++ = *s++; //... *ptr++ = *s++; *ptr++ = *s++; *ptr++ = *s++; *ptr++ = *s++; *ptr++ = *s++; //8 } }
5. ## LOD on a (cubical) voxel engine

My terrain are in a hashmap (key is a vector 3 integer world index), but every terrain also has an array holding it neighbor-terrain for each face (see Terrain.java) (so it's actually more like a ... six-tree?) Thank you for your answer guys I didn't know about sparse voxel octree, I'm giving it a look
6. ## LOD on a (cubical) voxel engine

Hey thank you for your answer The 'greedy meshing algorithm' I mentioned already combine faces with the same apparence (texture, lightning...) to a single quad :) Also, I explored minecraft code: I didn't find anything to deal with LOD :( However, they're not using a simple frustum culling algorythm! A Mojang dev wrote this article: https://tomcc.github.io/2014/08/31/visibility-1.html I implemented mine based on this But y, I think the best looking way would be to join distant chunks mesh, and simplify it. However I need to find a fast enough algorythm to do it in real time, because this would mean keeping far distant terrain's informations in memory... and so maybe to dynamically compress / decompress blocks data, which will slow down the whole process This is why I also like the heightmap solution, as it is more 'memory-friendly' Thank you for your interest
7. ## LOD on a (cubical) voxel engine

Hey, I'm optimizing my voxel engine rendering I have implemented a 'greedy meshing' algorythm, and optimized the culling, which diubles my rendering performances. But still, this model doednt scale well, and I can't reach good enough performances while rendering with a high render distance So I naturally was thinking of implementing a level of details meshing algorythm for my terrains At first, I was thinking of using heightmaps with a decreasing precision (number of vertices depending on the terrain distance). But as I am in a voxel world, I think the final result can look pretty ugly in some cases. (The height can be infinite, they can be 'floating terrains in the air', 'holes' in a moutains, these would lead to pretty brutal transition while changing from the heightmap to the standart mesh) So I was thinking of implementing the marching cubes algorithm What do you think about it? Do you have any advices / good links to give me on that topic? Am I missing a simpler solution? Thank you for your reading https://github.com/rpereira-dev/VoxelEngine EDIT: 1 year later, I finally ended up implementing the marching cubes algorithm: