Jump to content

So i'm doing a renderer ...


Green Baron

Recommended Posts

I did a little c programming decades ago. Started to revive that hobby and learn c++ and connected concepts about 1,5 years ago, just for fun. I realize that a few colleagues are learning programming stuff, and so i feel like i could show what's possible with relatively simple concepts.

It's naive, it is simple, it can generate arbitrary ellipsoids through simple tessellation and dress them into textures, it can show very basic displacement maps and a skybox. Shading is momentarily limited to basic blinn or phong.

Future steps are: (cd)lod, projecting the displacement maps on the ellipsoid, stream and/or generate data, which means scene and resource handling, if i dig it asynchronously. I'll put what i have on Github in the next days.

Spoiler

Fz938ob.png

wTkoL6P.png

It is only a new hobby. Expect nothing more !

Link to comment
Share on other sites

Ok, i am doing this for the first time, have patience if something (or everything) is messed up.

Here is the first take, the base of what i would like to be just one more of those render frameworks for things ellipsoid. I don't guarantee no progress or anything else. Please read the readme.md, especially the credits. It is naive, wanting, buggy, and i ask myself if it is worth showing. But I will be happy about all kind of comments :-)

github

More inline doc as soon as the frequency of changes settles ...

(Hint: normal shading in SimpleHeightMap isn't implemented yet, but everything else is. And there are readmes with links to texture downloads.)

Next step: lod

Link to comment
Share on other sites

Oh, am i that confused ? :-)

I want to make a renderer for all kinds of celestial bodies that somehow are an ellipsoid. I extract the ellipsoids from a unit sphere by tessellation and clad it in one or two prefabricated textures for the overview from afar. I want to display surface details by extracting position posts away from center with the help of a displacement map, a single channel texture whose values represent a height relative to the ellipsoid. Heightmap data can come from many sources, downloaded real world data, generated maps from simulation of natural processes, or from a typical noise generator, like perlin.

Display of surface details, because it is a lot of data, needs a level of detail (lod) algorithm to reduce complexity and control detail levels depending on distance from the viewer, and a means to portion the data in units that can easily and seamlessly be loaded into memory. A single channel 16bit displacement for the whole earth with posts every 90m (srtm-data) would have many 10s of GB ...

The github-rep contains my first try on a render framework for this, with examples for the ellipsoid tessellation and a basic version of a displacement map. I am now working on the lod thing and a related data structure.

Spoiler

Meanwhile:

1S4b2nf.png

This is just preliminary shading, a light source and reflection depending on viewer position.

 

Edited by Green Baron
Correction and specification of data volume
Link to comment
Share on other sites

  • 2 months later...

This project was paused for a while but has been resurrected.

My naive terrain renderer can now build a quad tree of terrain tiles from an arbitrary heightmap and select levels of detail while moving the camera around. Each detail level is represented by a size half that of the next level, the highest level being closest to the camera, the distances between levels calculated as the camera moves. Number of levels and resolution of depth can be changed on the fly.

This image shows the bounding boxes of each level, a box for each tile that is constructed from the lowest and highest height value as well the minimum and maximum world position. The small boxes in the foreground will have the highest resolution, the large ones in the background the lowest, though overall the number of triangles / screen area stays roughly the same.

Spoiler

YssggM1.png

This has not grown on my dung ! I am only doing the realization and learning a lot on the way. It is based on the excellent work of this guy:

https://github.com/fstrugar/CDLOD

Next: sampling the height map and actually draw the terrain, nice shading and overall code cleaning and a little docu (for myself, i am starting to forget things i did in the beginning). There will (hopefully) be no popping or seams between tiles as the levels are gradually morphed from higher to lower in the vertex shader.

Then projection on ellipsoid (aka solar system bodies) and heightmap generation, and data streaming.

Oh, and frame rate so far is >10,000/sec., GTX 970 and i7 single threaded. I expect this to go down quite a bit when sampling the map and shading things, but there will still be a lot of leeway for physics etc. !

Edited by Green Baron
Link to comment
Share on other sites

  • 2 weeks later...
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...