Download

Generate only whats in view with the use of c++

Hi guys,
i would like to ask you if my logic behind generation in field of view is possible. Well im generating an entire galaxy, so about 200 bilions of stars in c++, but because thats just too much strain on memory i divided the galaxy into chunks and i would like to ask if its possible to generate only chunks that are inside my field of view including distance from camera so that i only generate a visible part of galaxy and always destroy chunks that are not in field of view. If thats not possible or its just too unnecersally complicated, could you give me some advice on how to do it in c++? And if this is possible should i do it in c++ or would it better to do it in blueprints(only if the resources cost is not too high)?

PS: sorry about my english, and if this topic doesnt belong here to this section, then im sorry for bothering you guys.

If you look at the transform struct, it uses 3 floats to define the position, 4 for rotation and 3 for scale, for a total of 40 bytes per transform.
40 bytes * 200 billion gives you roughly 2 terabytes of data for the transform information alone.
You can’t create a 200 billion star galaxy and decide what to render, that’s the wrong approach.
You need to set things up so that the camera can only show a reasonable portion of your galaxy at any given moment and have a lot of the galaxy information generated at runtime.

Yes, thats my general idea about this problem. Thats why im asking if i could generate only whats in field of view, what i mean is that that i can regenerate the galaxy parts based on my algorithm, and thats is also why im asking if its possible to only regenerate whats in field of view but without the use of culling, because the culling is also using some memory. Well what im truly asking is that if i should do it with raycasting everything in my field of view or if there is some nice way around it. So probably my true question is if there is some function that would only call my method to create the chunk and destroy it when its in/out of field of view or if i should come up with something myself or if someone would have some nice idea how to do it in c++.