Draw distances are broken

DraQ
Posts: 149
Joined: Sun Mar 23, 2014 10:02 pm

Re: Draw distances are broken

Post by DraQ »

FluffyFreak wrote:
DraQ wrote:
We're not reverting that change, it contains a lot of good changes!
Such as?
Such as all of the camera refactoring that encapsulated a lot of it's functionality instead of requiring anything that use it to pull all of the information out and do the work itself to determine the camera frame. It gave us a context we could pass around and associate with camera objects so we can better support multiple cameras.

The other thing, as noted by the comments in the spike code, is that it's complete rubbish. Not only that but looking through it is horrible, there's even a call to a glGet* function in there that I spent weeks removing from the rest of the codebase :(
Ok, I can see the point, but the current implementation is crap.
I'm making some changes right now so that planets always get a billboard, and only smaller objects won't be drawn below a sub-pixel size threshold. That means they won't disappear whilst still 2 pixels across, but they still will once they're below 0.5 pixels wide.
Again, it isn't how it works. When something is below visual resolution the light from this object still hits the eye. If the backdrop is about as bright or brighter than the object in question (the usual case in game graphics) then the light from backdrop will drown out the object and it won't be seen so you can take raster graphics abstraction to its logical conclusion and just stop drawing the object if it drops to sub-pixel size. However if the object is against much darker backdrop (like space), then it will be visible regardless of its angular size provided it's bright enough.
This rule doesn't stop working just because something is a spaceship, rather than star or planet.

Against the cold blackness of space stuff only stops being visible when it's too faint, not too small.
Yes, the object will still become fainter with distance and smaller object will be fainter than larger one with same albedo/temperature, but any kind of object can be seen way below pixel size if the backdrop is much darker.

This also means we should keep the billboard the same size on the screen regardless of distance (because we are drawing them for objects that are below resolution anyway, so they are representative of eye/sensor visual acuity, not object's angular size, and only stop drawing it when it's too faint.
This brings us to:
I'm trying to work out what I can do about faked billboard lighting to give it better colour etc whilst I'm in there.
Lighting.

In general object's apparent brightness decreases with square of its distance to the observer.

With objects that aren't themselves light sources, this is only half of the story.
The other half is lighting the object itself.
First, the brightness of light reaching an object also decreases with square of distance - this time from the light source.
For some reason Pioneer does not account for it in its lighting model (is it because of the range of possible values if it was to be done properly? maybe HDR or rescaling lighting to logarithmic scale would help?), so maybe fixing that would allow us to obtain desired value directly from lighting model.

Then there is relative positioning of object, observer and light source.
Since the object is question is too far to be seen normally, it might be considered more or less a sphere, and since we are discussing barely visible specks of light represented by some sort of 'shiny!', anything more than fully diffuse sphere with both observer and light source at infinity in regards to the accessible surface would be form over function anyway.

So we have it: as the angle between observer, object and light source increases from 0 to 90 to 180 degrees, directional light multiplier goes from 1 to 0.5 to 0, we can make it a simple linear relationship.

so, for linear light scale:
the observable light = light obtained from lighting engine * (object's effective radius)^2 * (1 - observer object source angle/ 180) * distance to observer^-2

Billboard should start being drawn slightly before the mesh stops being visible and stop being drawn if its calculated brightness drops below certain threshold.
Billboard should also look shinier than it currently does - a small star graphics would do - we need to convey the idea of *bright* point of light using the limited luminosity range of monitor player is looking at.
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Draw distances are broken

Post by FluffyFreak »

DraQ wrote:Ok, I can see the point, but the current implementation is crap.
I'll address this first: this is open source software, someone spent their own time taking something that was awful and making it better. If you're so certain that it's not good enough, then you are free to change it and show that your changes are demonstrably better, at which point they become part of the project... until the day comes that someone sees *your* changes and decides they're *crap* and does the same.

Announcing loudly and repeatedly on the forums that other peoples hard work is crap, does not earn you friends or get things fixed.
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Draw distances are broken

Post by FluffyFreak »

There's actually a bug in the billboard rendering that means it only renders the Stars billboard correctly. Nothing else seems to work so i'm investigating that right now.

EDIT: and no, simply putting the Spike back in doesn't work, the bug is elsewhere, the Spikes don't render either.
DraQ
Posts: 149
Joined: Sun Mar 23, 2014 10:02 pm

Re: Draw distances are broken

Post by DraQ »

FluffyFreak wrote:
DraQ wrote:Ok, I can see the point, but the current implementation is crap.
I'll address this first: this is open source software, someone spent their own time taking something that was awful and making it better. If you're so certain that it's not good enough
*sigh*

I'm certain it's not good enough because it just doesn't work. It's code, it's supposed to work, if it doesn't do what it's supposed to then something is broken and needs fixing.
Again, I'm not insulting anyone personally, I don't mean to disparage anyone's coding ability (especially given that anyone who has ever coded anything is bound to have produced his fair share of crappy code) and I'm not questioning people's dedication and good will - I'm trying to indicate objectively broken feature, that is broken because it clearly doesn't work.
then you are free to change it and show that your changes are demonstrably better, at which point they become part of the project... until the day comes that someone sees *your* changes and decides they're *crap* and does the same.
Again, I haven't decided someone changes are crap. Someone's changes are crap, at least partially, because they broke stuff. Alternatively, someone else's code was crap, because it got inexplicably broken by perfectly reasonable changes it should be insulated from. The bottom line is that no matter how you spin it, something stinks in the code.
Also, "try making it better" is never a valid rebuttal of criticism. If you'd undergo a surgery and it would be a botch job leaving you dead or crippled, then you (or your relative) would have all the right to complain about it (and sue people) despite not being able to do it better.
I don't consider myself a very proficient coder, so rest assured that if I do commit changes to Pioneer, some of them *will* be crap - then I will want to hear about it, if only because it will help me become a better programmer.
Announcing loudly and repeatedly on the forums that other peoples hard work is crap, does not earn you friends or get things fixed.
I'm not here to make friends (though it would be a nice bonus :) ) and bringing attention to things that need fixing does help getting them fixed - it's second only to actually fixing them yourself.
FluffyFreak wrote:There's actually a bug in the billboard rendering that means it only renders the Stars billboard correctly. Nothing else seems to work so i'm investigating that right now.
Actually, I don't think stars are rendered correctly - I'll check the latest build but there weren't any changes to that indicated in recent changelog - the problem is less apparent with them because they are bigger but they also stop being visible for sufficiently far away (try multiple systems, systems with white/brown dwarfs, and large systems with hot B or O star in the center, and planets at tens of AU away.

An example of it not working
You can see a star to the left of gas giant. You can also see a neat, if a bit grainy scatter effect from it's white dwarf companion that's on the verge of being eclipsed by gas giant and shines through it's outermost atmosphere layers. You can't however see the white dwarf itself.
This is doubly glaring as this sort of invisible stars do contribute to the lighting of the scene, so you can have brightly lit planet without any visible light source where there should be a blinding pinprick of light.

For the record:
Handy magnitude/luminosity calculator, an object is generally visible with naked eye as long as it's apparent magnitude is less than 6.5
A handy chart explaining why being too small isn't a good indicator of visibility - if it was we'd only be able to see Moon, Sun, and sometimes Venus from Earth - no stars, no other planets, just homogeneous black skies.

I have done some quick calculations and any light emitting astronomical object should be visible at any distance within the system. Even white and brown dwarfs should appear as very bright stars at over 1000AU.
As for the spaceships, my ballpark estimate using ISS (-4 at 400km, around 100m wide) indicates that something like Venture Star (half of ISS size, so quarter of its visible surface) should be visible from up to around 24000km just sitting there, not firing thrusters or anything, when illuminated as if it was around 1AU from a Sun-like star.
EDIT: and no, simply putting the Spike back in doesn't work, the bug is elsewhere, the Spikes don't render either.
Ok, that's interesting, the problem is somewhere else.
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Draw distances are broken

Post by FluffyFreak »

DraQ what GPU do you have?
I've just been testing on my desktop PC with an nVidia GTX 670 and everything works fine.
However on my laptop with an nVidia GTX 650m I get these billboards disappearing.

Same driver versions, same manufacturer etc. Different results so just curious what you have where you're seeing them disappear.
DraQ
Posts: 149
Joined: Sun Mar 23, 2014 10:02 pm

Re: Draw distances are broken

Post by DraQ »

FluffyFreak wrote:DraQ what GPU do you have?
I've just been testing on my desktop PC with an nVidia GTX 670 and everything works fine.
However on my laptop with an nVidia GTX 650m I get these billboards disappearing.

Same driver versions, same manufacturer etc. Different results so just curious what you have where you're seeing them disappear.
GTX 560.

BTW: I have just registered an account on GitHub (corundscale). Hopefully I'll be able to participate in actual development from now on, I just need to set everything up so that I can build Pioneer.
Does anyone here use GCC (MinGW) directly under windows without cross-compiling?
FluffyFreak
Posts: 1343
Joined: Tue Jul 02, 2013 1:49 pm
Location: Beeston, Nottinghamshire, GB
Contact:

Re: Draw distances are broken

Post by FluffyFreak »

GTX 560, another nVidia. You on the latest drivers too? I'm starting to wonder if the enormous transformations these billboards undergo are being culled by the driver as being degenerate in some way.

There was a CodeBlocks project that Luomu setup which used MinGW32 and GCC as it's backend.
He hasn't been around in a while though, it might not take much effort to resurrect that.
DraQ
Posts: 149
Joined: Sun Mar 23, 2014 10:02 pm

Re: Draw distances are broken

Post by DraQ »

FluffyFreak wrote:There was a CodeBlocks project that Luomu setup which used MinGW32 and GCC as it's backend.
Thanks, any links?
Last edited by DraQ on Sun Jun 22, 2014 11:06 am, edited 1 time in total.
Marcel
Posts: 48
Joined: Thu Aug 01, 2013 2:39 am

Re: Draw distances are broken

Post by Marcel »

I have the same issue with my GTX 460 too. The drivers are about a year old.
Post Reply