Model Loading, Terrain object and Perlin Noise Test

In this implementation of PerTerra I have being messing around with terrain objects and loading obj files.

I had a fair amount of difficulty loading obj file thanks to the discovery it can have quads and triangles mixed in the file so I had to break the quads into 6 indices for it to be used when rendering. The vertices where saved independently as positions, normals and uv coordinates so they had to be merged in order to be used by the pipeline.

The terrain object was a funny one seeing as it is slow to get information back and forth
from the GPU. I solved this by creating a buffer in ram that will store a copy of the terrain vertices. This saves me from having to fetch information from the GPU at the cost of some memory. This buffer can be freely be modified and will not affect the buffer until the function to send the buffer to the GPU is called. This has allowed me to have a buffer that can be updated while allowing for high frame rates. It is likely not the best solution however it works. To test this implementation I used a Perlin Noise class to generate some terrain and it holds out just fine.

This slideshow requires JavaScript.

All the other change have been minor and not worth noting until the next implementation that shall be all.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s