Post news RSS Devblog 10 - Building a terrain based on bricks - Chapter 2

I left in that the model was too detailed for a game.Like I said, I have no idea about modeling (nor i want) so I went the easy way -> Sketchup.Sketchup is probably the worst tool to use for this, proof of this is that after reducing the number of triangles and vertices, the model weighed even more than before....... Anyway.

Posted by on


I left in that the model was too detailed for a game.
Like I said, I have no idea about modeling (nor i want) so I went the easy way -> Sketchup.
Sketchup is probably the worst tool to use for this, proof of this is that after reducing the number of triangles and vertices, the model weighed even more than before....... Anyway.
With liposuction we went from:
- Edges: 1136
- Faces: 624
to:
- Edges: 800
- Faces: 420


Difference is visible but beh, can't do it better myself.
Another detail of Sketchup is that no matter how much you tell it, it bursts the scale of the model.
Any model that imported from mecabricks, was always scaled the same:


I've had to fiddle around with the new model until it looks more or less the same:


I hate Sketchup.
Anyway, the reduction has not been very big, but I don't know where to remove more triangles.
Time of truth.
Will all the faces have the same number of triangles (minus the top and bottom)?
Top face: 570
Bottom face: 72
Remaining faces: 2
Hell yeah, the sides are no longer a waste!


If we now generate the world we get this:

A world of bricks, but with some problems:
- There are spaces between the bricks
- If you look at the bottom right of the image, you will see that the sides of the bricks are not rendering
- Some triangles are broken / misplaced
The first error is due to the fact that the matrix we have created is based on integers and the dimensions of the bricks are not integers.
If we multiply the placement position by the width / height of the brick, we will obtain the adjusted position.
The second mistake is because of how I have assigned each face. I followed the logic of top | bottom | left | right | front | back. But it really is not like that, but we start with face 0, then 1, 2 ... It can be fixed by editing the FaceMapper that I made.
About the third mistake ........ I have no fucking idea why it happens. I have verified that if I cut the top face higher, (so that there are only the studs), everything renders fine. So there is something wrong with the model:

(Edit: i was wrong, model "wasn't the problem", i was reaching max vertex count per mesh [65535], stone-SJH fixed it)

We fix the fixable and try our luck again:


The next thing I should do is focus on painting the blocks.
Remember that we have joined the blocks in a single mesh / model. So we only have 1 texture.
This texture will have all the possible colors and we will have to adjust the material so that it shows the correct surface in each case.
See:


How? I do not know. If I normally have no idea what I'm doing, with this part I have even less.
I have touched it a bit and I've managed to get the color out, not the correct one, but at least it is not the default gray.

(If you look closely, the sides are blue or green and the top is brown, when it should all be the same color).
Skipping this part, i will have to get to the most complicated part of all: Marrying the construction system that I have created, with the generated world.
Ah, the other day I saw this:


And I think I'll use it as inspiration for the player models. It is not the lego model, so it is not copyrighted and has the desired brick style.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.