# 3D dynamic mesh tutorials/books

Page 1 of 1

## 4 Replies - 1718 Views - Last Post: 15 May 2016 - 06:37 AM

### #1 Oz0ne

Reputation: 0
• Posts: 2
• Joined: 15-May 16

# 3D dynamic mesh tutorials/books

Posted 15 May 2016 - 04:21 AM

So I've spent last few days scouring the internet for tutorials and guides on creating dynamic meshes and anything else related to procedural generation with MonoGame. But other than few old XNA tutorials that I can't force to work since methods they are using don't exist anymore(and MonoGame API documentation doesn't explain much, so I can't figure out how to replace them) basic 3D vertex tutorials that abruptly end after showing how to output a single triangle on the screen I haven't had much luck.

I'm looking either for tutorials, books, github repos or someone kind enough to give me few simple examples I can use as a starting point. Bonus points for listing and explaining few essential methods from the API so I can work on my own!.

Is This A Good Question/Topic? 0

## Replies To: 3D dynamic mesh tutorials/books

### #2 basteagui

Reputation: 14
• Posts: 60
• Joined: 08-September 13

## Re: 3D dynamic mesh tutorials/books

Posted 15 May 2016 - 04:51 AM

you should definitely start there. once you know how to draw and transform a quad with texture you will have all the info you need on the basic effect and how it relates to vertices.

if you know how to load a basic model, and how to draw a quad (this isn't as simple as you would think!)
then you are ready to start pretty much drawing shapes (3d primitives)

if you want to learn how to procedurally generate a mesh by defining the vertices you should check out this tutorial FIRST
http://www.riemers.n...rain_basics.php (basics of terrain)
http://www.riemers.n...n_from_file.php (terrain from a height map)

these are the basics of procedural mesh construction because once you can make a mesh based on an image you can randomize the image to have real procedural meshes

then,
there's some good examples in RB Whitaker's website so you can learn how to draw cubes, pyramids, etc.

http://rbwhitaker.wi...tives-tutorials

i suggest you draw triangle lists and don't bother with indices yet; if you're going to transform your shapes.

for transforming these shapes what you need to do is just move the vertices around. if you manage to calculate (and store) the normal of each vertex (or the face that the vertex belongs to) you can push the vertices out in the direction of their normal to make your models "fat" like this hammer:

http://flylib.com/bo...es/fig12-14.jpg

but it would be even more helpful in order to help you if you mentioned what you're trying to create procedurally.
terrains? a dynamically shapeshifting blob??

also, i would tell you to stick to XNA and drop monogame for now while you're learning because XNA works in a simple way out of the box. once you have something working on XNA that you're happy with you can fix it so it works in monogame.
i think this will save you a lot of time in the long run.

### #3 basteagui

Reputation: 14
• Posts: 60
• Joined: 08-September 13

## Re: 3D dynamic mesh tutorials/books

Posted 15 May 2016 - 05:00 AM

you should start with those simple tutorials at any rate; the problem with pushing vertices in the direction of their normal, etc is that those lessons are often given to more advanced xna users that are already writing their own shader. because you can also move vertices with the GPU in the vertex shader stage (before the pixel shader colors the pixels)
for instance here:

but like i said that's more advanced shader writing tutorial. if you need to get into this you should go step by step and learn about shaders back in riemer's page most likely.

### #4 Oz0ne

Reputation: 0
• Posts: 2
• Joined: 15-May 16

## Re: 3D dynamic mesh tutorials/books

Posted 15 May 2016 - 05:44 AM

This is perfect, thank you!

basteagui, on 15 May 2016 - 04:51 AM, said:

but it would be even more helpful in order to help you if you mentioned what you're trying to create procedurally.
terrains? a dynamically shapeshifting blob??

Well there's few topics I'm interested in, for now I'm trying to figure out the monogame framework and just generate some meshes/terrain, while later on I'd like to implement some rudimentary physics and make terrain destructible, long term goal would be just building on top of that which isn't really relevant atm.

I actually learned to work with mono by following Whitaker's tutorials, I'm not sure how I missed that primitives section...

### #5 basteagui

Reputation: 14
• Posts: 60
• Joined: 08-September 13

## Re: 3D dynamic mesh tutorials/books

Posted 15 May 2016 - 06:37 AM

glad i could help. keep me posted if you run into trouble down the line.

when i first learned about this i thought about making a level editor of some sort. though i had to put that idea on the back burner, but it would be cool if someone at least makes a program where you can move vertices with the mouse, that's something that i'd really love to see done in XNA.

by the way, remember that you can move vertices in your primitives around by modifying the X, Y and Z value of the vertex normally,
but you can also use vector math to push them in a specific direction like an arrow,
and you can use formulas to make stuff like waves in your primitive...
and you can even use matrix math to stretch your model vertically for example.

try and mess around with different ways to move your verts!