ende - 3D Procedural Generator

ende - 3D Procedural Generator Used AI

48 devlogs
108h 10m
•  Ship certified
Created by Mikolaj

An attempt to make a 3D Procedural Generator in C++ using these libraries - raylib (graphics), glm (math) and imgui (UI).

Timeline

Ship 1

0 payouts of shell 0 shells

Mikolaj

10 days ago

Mikolaj Covers 48 devlogs and 108h 10m

Added settings for style changing, bug fixes and made repo public (also added releases)

Update attachment

Added a custom camera class controlling camera (works similar to blenders camera) and styles for the UI (ENDEBLUE, ENDEPURPLE, ENDEMONOCHROME and ENDEWARM)

Added thermal erosion, some tooltips, small fixes, refactors

Added improved fake noise for fractal noise, value noise (with option to toggle fractal on it), perlin noise (with this option as well) and (only on perlin noise right now) terracing. Worked a bit on rocks but they need more improvement.

Ton of code refactors, segfaults, sigabrts, memory leaks and I added painting, global UI (the main menu bar and state bar), uiManager to make it easier dealing with all the tooltips, sections, input sizes etc.

Added this for preferences (main menu bar -> edit -> preferences)

Update attachment

Added gizmo for moving objects (it was a pain but at least I revisited dot/cross product and learned double cross). I also renamed BasicPerlin to Simple Pattern and Octave to Fractal Noise.

Changed font and font sizes in some places (and UI looks slightly different cause of these changes)

Update attachment

Added option to create lights (point and directional) and started changing font (the sizes are not ideal in some places and UI is misplaced in some places cause of it) to roboto

Working on lights (to add an option to create them)

Update attachment

Added void colors and fixed normals calculation/recalculation (and also in one place added)

Added main menu bar

Update attachment

Added options to show normals on vertices, edges and faces and change their length and color.

Update attachment

Went back to basics cause I forgot all the indices and vertices thats why the update took so long. Also implemented midpoint subdivision algorithm though its not perfect and added rock though it also lacks options to make it better.

Seed fixes such as - setting new seed every update (previously it remained the same), delete static variable (and make it non static), add seed to Entity so each Entity can have different seed (and option to enable seeding), previously (last devlog) you couldnt set the seed value in InputInt cause I forgot to declare variable like this int& instead of int and seed UI section changes (spacing)

Update attachment

Added std::mt19937 for random engine with option to set its seed when creating a project. If you dont like how the terrain looks like you can modify the seedValue yourself or generate a new one.

Wanted to make the terrain look more natural so I added Octave noise type for terrain. Made some changes like TerrainType variable in Entity is now std::unique_ptr instead of raw pointer or added the tooltips for harder to understand sliders (to avoid searching on internet for example what is lacunarity and what it does).

Quick change to Add Entity popup UI

Update attachment

Had a tough time with buttons and the issue was just a single line ImGui::SetKeyboardFocusHere() which basically focuses on (in my case) input text and it disabled clicking buttons (the code wouldnt execute). Also a few fixes like std::outofrange error (trying to call UpdateBuffers on index -1) or Entity not being added.

Update attachment

Added BasicPerlin class that makes a basic terrain when you tweak the amplitude and noise parameters and added type to Entity (first one is terrain)

Mikolaj Mikolaj about 1 month ago
(The video freezes not the actual program by the way)

Added searching entities cause it will be really useful when the scene gets filled with entities and added options to toggle wireframe only on selected mesh (not whole scene like earlier but I did not remove this option) and show mesh wires.

Added entity settings on click (mesh color, position and more to come) and worked on advanced settings - added solid shader advanced settings, color tweaking and camera advanced settings (more to come as well). Fixed GenMeshBoundingBox in Entity struct (does not ignore the position now)

Added some code from prototype to Scene, show/hide for entities and started working on advanced settings UI

Fought with the engine and deleted ShaderManager class and base class for engine components. I still dont know how to handle the engine. Also in Scene class I added code - some from main (where the prototype is), some I wrote.

Update attachment

Added UI with all the scene elements (entities) and added some options to it - rename and delete for now. Minor fixes in Entity struct.

Integrated Entity with the prototype (to test if it works or not)

Update attachment

Minor fixes and tests

Update attachment

I decided to add input field next to the slider to make it easier to get the desired value

After 4 hours fighting with engine and UI I managed to make a StartMenu with a list of projects (for now they will be empty cause its too early to make loading and saving), manage resources (from imgui and raylib) in a way that doesnt crash my program and rethink the engine a bit (and added a window state)

Added camera zoom (by scrolling with mouse), indent in UI and fixed some elements being too large.

Added vertex selection (you can modify the Y value from -5 to 5) and added position slider so you can now set the position of the mesh. I also added the position to Entity struct (to also allow for future position changing).

Worked a little on the engine and added a few methods to Entity, tested if it can even run (by pushing the first state), added necessary cleanup before closing window, renamed MainMenu to StartMenu, Fixed missing negation in if statement and renamed shaders in ShaderManager class.

Update attachment

Added changing colors, settings for solid shader (if someone wants to change the light direction or the color) and Entity struct (mesh that will be on scene).

Added settings to selected mesh (had a lot of problems with double freeing, corrupted double-linked lists and trying to access freed memory). Also made the settings not resizable cause I had a lot of issues with it as well but they can be hid.

I started learning the imgui library for UI (currently using the default styling). I also changed the window size from 800×600 to 1920×1080 to improve the video resolution and to match my laptop’s resolution just to see how it would look on that screen which also prevents the UI from being squished.

Added wireframe mode, renamed default to material preview and material preview to render. Made some changes to the early engine by adding StateManager and fixing Program classes.

So I added lights successfully (had to use raylib's shader) and added back materialPreview (also kept the defaultShader). Added necessary clean up at the end of main which I previously forgot. Still thinking how to structure the engine for this program.

Played around with collision detection when clicking on objects cause it will be later important (object turns red and wires are green on click). Decided to delete the materialPreview cause it would be too complex (at least for what im aiming for currently) and Ill just use solidShader and the default one cause if I add some lights (which im working on) it should behave like I wanted the materialPreview to work.

For now I failed to fix the materialPreview shader so I replaced it with raylib's default one (and an option to toggle wires cause it is kinda hard to see the mesh without any shadows or wires). Ill try to fix it later and also I started working on engine structure but its still far from mvp.

Tried to also make materialPreview shader cause I started learning UV but its still in progress (its black on the picture cause it doesnt work and I didnt set it on the cube so it works on it)

Update attachment
Mikolaj Mikolaj about 2 months ago
thanks
mmgg mmgg about 2 months ago
Such a fun project, I did something similar a while back, have fun :)

Tried to recreate blender's solid view (the thing in the middle is cube to test other shape) but it took way longer that I expected honestly but learned the stuff I needed - interacting in real time with custom mesh (the flat plane (yes it is custom shape)), setting up the shader and better understand UpdateMeshBuffer (especially the index argument).

Modified function CalcNormals cause it contained an error (memory allocation one). Also made a cool wave effect while learning function UpdateMeshBuffer which is used to update mesh data that gets sent to the gpu and then gets rendered by the program.

Got a slight hang on the normals and reviewed mesh indices (what they are cause I forgot)

Update attachment

Got more comfortable with loading, unloading and vertices arrays (also learned malloc, calloc and free cause I never used it before - only the new and delete operators). Started learning normals and how lights work in raylib.

Update attachment

Memorized more functions and learned how they work. Made some assignment to check if I understand some functions correctly and made function that generates a grid based on the input which is gridSize and tileSize (y stays the same so its flat).

Wrote a converter between glm::vec3 and raylib's Vector3. Learned how to set up camera and the loop in which everything is drawn. Got the cube to rotate as well.

Got raylib working!!!

Update attachment