Summer Work (Day 7)
Messing with procedural meshes
Over the past 3 days I have put work into getting generated planet shapes. I have decided that this is currently more important than the orbit debug because the debug wouldn't show up in an actual game, the orbits work without it, and having custom planets would be way cooler.
Again I am using Sebastian Lague as my backbone because he has already done a series on procedural planet generation in Unity. Just as the other video I followed by him, I understand C# so I can follow along with what he's doing while trying to translate it to C++ in Unreal. As of today I am still on the first episode dealing with rendering a sphere. I am so close, with only one compile error (as far as I'm aware), to having this work.
This process has been mainly involved with Unreal's "Procedural Mesh Component" which is super cool. Basically you can specify vertices, triangles, and even UV's and more to create a custom mesh at or before runtime. This was the equivalent I found to Unity's Mesh class. The only downside to the Unreal version is that you can't automatically generate normals; in Unreal you have to do that yourself with math.
Once I figured out the procedural mesh component and how to use it I went to implement the generation of a cube. This proved to be way more difficult than I had originally expected. The main roadblocks were all the errors that I hadn't seen until I tried to run it for the first time. The first time I tried to generate a planet the editor crashed (flashbacks to the start of this project). After using the insanely useful VS debugger I found that (among other things) a variable I was trying to pass between scripts was always returning nullptr. To be exact: "Exception thrown: read access violation. this was nullptr." Additionally when I try to see the value of the variable I get: "this->(variable) <Unable to read memory>" This is the single thing preventing me from continuing, and when I figure it out I should be well on my way towards a more interesting solar system.
This is not all I have learned through this process, that will likely come when I get a successful build. For now though this post is just to keep me active and reflecting on the successes and failures so far.
Comments
Post a Comment