Ok, I can see the point, but the current implementation is crap.FluffyFreak wrote: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.DraQ wrote:Such as?We're not reverting that change, it contains a lot of good changes!
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 :(
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.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.
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:
Lighting.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.
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.