Jump to content

  • Log In with Google      Sign In   
  • Create Account

Rendering huge (space) distance technique

  • You cannot reply to this topic
10 replies to this topic

#1 BlackJoker   Members   -  Reputation: 532

Like
0Likes
Like

Posted 04 September 2014 - 01:27 AM

Hi, I know that this topic was discussed not one time, but after reading all of them I could found, I still have questions.

 

I try to make for now simple space simulator, but I faced with some issues regarding projection matrix:

 

1. - If I set very big zFar value, I will see model even if it is huge, but in that case I will have problem with picking, because it is not working if zFar is more than 16777216

 

2. - I can set ZFar separately in shader as I use logarithmic z-buffer, but it will still have picking issues because it just return true/false randomly.

 

3. If I set zFar to 16777216, It will definately decrease my view distance even if I scale my models down.

 

Taking into view all this issues, I want to know the best technique to rendering huge objects and to keep picking algorithm work correct.

 

I read about multi-layer rendering with multiples depth buffers, but I didnt find any example and I don`t know the concept in general.

 

Could anyone point me on the right way?



Sponsor:

#2 tonemgub   Members   -  Reputation: 1139

Like
0Likes
Like

Posted 04 September 2014 - 02:17 AM

http://en.wikipedia.org/wiki/Skybox_%28video_games%29



#3 BlackJoker   Members   -  Reputation: 532

Like
0Likes
Like

Posted 04 September 2014 - 02:27 AM

 

Skybox is good for very-very far objects like stars and nebulas, but not for rendering huge objects like planets and so on, which is near camera. 

 

How it is implemented in space engine, for example. You see whole planet as huge as it is and as I understand it is not rendered as sprite or something like that.


Edited by BlackJoker, 04 September 2014 - 03:06 AM.


#4 tonemgub   Members   -  Reputation: 1139

Like
0Likes
Like

Posted 04 September 2014 - 04:22 AM


How it is implemented in space engine, for example. You see whole planet as huge as it is and as I understand it is not rendered as sprite or something like that.

Just scale down the planet?



#5 BlackJoker   Members   -  Reputation: 532

Like
0Likes
Like

Posted 04 September 2014 - 04:43 AM


Just scale down the planet?

 

And always change planet position during flight? Super. And what about when I will on planet? Scale part of the planet and move it too? 

 

 

 

I asked about multi depth buffer rendering. Do you know something about this?



#6 Kryton1000   Members   -  Reputation: 134

Like
0Likes
Like

Posted 04 September 2014 - 04:58 AM

Hi BlackJoker

 

Scaling is a valid option. I have rendered planets and stars like this from very far away to ground level. You only need to start scaling and translating the planets when you are quite a way from the ground - so when you are standing on the planet it is OK. As you move away at some point you can reduce the planets scale and translate it closer to the viewer so that it looks the same.

 

I used this article to help me solve it: http://www.gamasutra.com/view/feature/131393/a_realtime_procedural_universe_.php?print=1



#7 BlackJoker   Members   -  Reputation: 532

Like
0Likes
Like

Posted 04 September 2014 - 05:16 AM

Hi BlackJoker

 

Scaling is a valid option. I have rendered planets and stars like this from very far away to ground level. You only need to start scaling and translating the planets when you are quite a way from the ground - so when you are standing on the planet it is OK. As you move away at some point you can reduce the planets scale and translate it closer to the viewer so that it looks the same.

 

I used this article to help me solve it: http://www.gamasutra.com/view/feature/131393/a_realtime_procedural_universe_.php?print=1

 

 

It will work if you have no physics engine, but what if I want to calculate detail gravity interaction? Or what if want to make MMO? You suggest to move shared for all objects individually for each player???

 

I don`t want to do a mess from my world moving all objects around like in dance.

 

I take into view your suggestion but I also want to know about other variants, which, I beleive, present.



#8 kauna   Crossbones+   -  Reputation: 2514

Like
2Likes
Like

Posted 04 September 2014 - 05:25 AM

You can't have an universal general solution for this - no rendering engine is able to render simply astronomic distances, no physics engine is able to calculate physics of a galaxy, not a star system, not even a whole planet.

 

So, you'll need to split the problem in to some manageable such as:

 

- render scene several times, once for objects near the observer (maybe 0 - 5 km). Most of small ships could be drawn in this scale

- 5km to some very big number, heavy use of culling of small objects. Most of small ships won't be visible, only huge capital ships, asteroids etc

- "sky" box for the rest

 

The problem isn't just the only z-buffer. You'll notice that floating point accuracy isn't much when going to open space. I'm saying that you can't except a camera to work correctly with just 3 floats for position, even doubles won't cut it. You'll need to use some kind of a grid structure in order to keep the camera in some manageable range from origo. 

 

Cheers!



#9 BlackJoker   Members   -  Reputation: 532

Like
0Likes
Like

Posted 04 September 2014 - 05:51 AM


- render scene several times, once for objects near the observer (maybe 0 - 5 km). Most of small ships could be drawn in this scale
- 5km to some very big number, heavy use of culling of small objects. Most of small ships won't be visible, only huge capital ships, asteroids etc
- "sky" box for the rest

 

Exactly about rendering a few times for different distances I want to know more. So, do you have some examples or links to articles about that?



#10 Kryton1000   Members   -  Reputation: 134

Like
1Likes
Like

Posted 04 September 2014 - 08:40 AM

Good luck - if you find something be sure to share it, I would like to know about this too!

 

Regarding the scaling option: This is no problem for the physics engine or the network code as you only scale and translate for rendering. 

 

You can have an additional matrix which combines the two operations passed into the shader. It should not effect the actual objects position as far as the physics engine or network code are concerned as they can operate on the object "as is".

 

Its just a trick to move the Z-values back into an acceptable range for the Z-Buffer. It may also require some Z-sorting to when planets obscure each other.



#11 kauna   Crossbones+   -  Reputation: 2514

Like
0Likes
Like

Posted 04 September 2014 - 12:43 PM

Practically you'll just split your visible scene in slices and perform rendering for each slice. After that it is just a question to put those rendered slices together. Of course, you can and probably must use some scale tricks also with the further slices in order to keep the depth buffer happy. 

 

Cheers!







PARTNERS