Page 1 of 1

(Demo) Black Holes

Posted: Tue Nov 14, 2023 6:12 am
by phkb
It turns out, we can create a black hole in Oolite, even after the fix mentioned in this thread Issue with planet texture for extra planets.

Image

Yes, that big black section in the middle of the screen is a black hole.

To create this, set the planet texture to be a PNG file with nothing in it (that is, not all white, or all black, but delete everything). Set the planet texture to that. Then set the illumination color to [0, 0, 0] and you get something like the above screenshot. You'd probably need to set a few other things in planetinfo.plist (cloud settings, I'm thinking, making sure there aren't any, atmosphere settings, etc). But from a visual point of view, it's a black hole. Not a black sphere that has reflections. But, for all intents and purposes, a black hole.

*Big caveat*. This only works at a graphical level of "Shaders Enabled" or "Extra Detail". Anything below that and you see something like this:

Image
Edit to add: you can see some of the reflection on the moons surface in the lower half of the shot.

Here's a demo OXP I put together for this. BlackHoleDemo.oxz. This will add a "Black Hole" a *really* long way out in every system. Please note: there is no gameplay in this demo (ie gravitational changes, proximity dangers, time skewing etc). It's just a tech demo. If someone wants to play around a bit more, they are welcome to grab with demo and run with it.

Anyway, I thought it might be worth sharing to get those creative juices flowing!

Note: You might want Galactic Almanac installed, as it will put a beacon on the black hole to make navigating to it reasonably easily.

Re: (Demo) Black Holes

Posted: Tue Nov 14, 2023 6:44 am
by another_commander
As an extra FYI, the current oolite-final fragment shader contains some test code for generating a gravitational lens effect, which would fit nicely with black holes. It is not readily accessible because it also affects the hud, but it's there if you want to have a play with it. You can activate it by copying the code under case 8 (line 486) of the shader and pasting it in the place of the code under one of the other effects, say 7. So it should look like

Code: Select all

case 7:
	hdrColor = gravLens(scene, TexCoords);
	bloomColor = gravLens(bloomBlur, TexCoords);
	if(bloom)  hdrColor += bloomColor;
	hdrColor *= exposure;
	break;
Then just execute a postFX=7 from the console.

It could be a useful effect if we get it to render before the hud and at the exact desired set of screen coordinates, but that's a story for another time.

Re: (Demo) Black Holes

Posted: Tue Nov 14, 2023 10:06 am
by phkb
If anyone wants to see what the effect looks like, a demo (not in Oolite, mind!) can be found here: https://www.shadertoy.com/view/llyyRm

I have to say, it’s really cool! If there was a way of doing what you said, that would certainly elevate the impact massively!

Re: (Demo) Black Holes

Posted: Tue Nov 14, 2023 10:29 am
by Nite Owl
One Step Beyond

If only it had an ACCRETION DISK.

Re: (Demo) Black Holes

Posted: Tue Nov 14, 2023 11:52 am
by another_commander
It's not actually hard to exclude the hud from the effect, but I realized that there is another problem: any ship or station positioned in front of the black hole while the effect is active, will be distorted. I don't think that should be the case; only the starfield background should be (I think). That might be trickier than I thought.

Re: (Demo) Black Holes

Posted: Tue Nov 14, 2023 12:49 pm
by hiran
Just for my curiosity:
Apart from being black and having an otional gravitation lens and maybe in future havin the accretion disk - how does the black hole behave?

I space around the lack hole just a smooth as elsewhere? What can you feel when controlling an aristoteles drive?

Re: (Demo) Black Holes

Posted: Tue Nov 14, 2023 1:08 pm
by phkb
hiran wrote: Tue Nov 14, 2023 12:49 pm
Apart from being black and having an otional gravitation lens and maybe in future havin the accretion disk - how does the black hole behave?
You mean at the moment, with this demo? It doesn't do anything. It is just a demo of creating what appears to be a black hole in space. That's it, I'm afraid!

If you mean what *should* happen, that's up to whoever wants to run with this. I may get around to it in time, but I have a number of other projects on the go, and this one is at the bottom of the pile. But off the top of my head: having your ship move towards the black hole, requiring you to boost away from it; possibly getting some particles to track into the black hole as a visual clue that a black hole is present; having random pieces of equipment break the closer you get to the black hole; having time accelerate the closer you get to the black hole. I'm sure there's probably other things that could happen.

Re: (Demo) Black Holes

Posted: Tue Nov 14, 2023 3:11 pm
by Switeck
On something I'm working on, I've got this:

Code: Select all

	player.commsMessage("WARNING: Gravitational Disturbance Detected!",8);
	player.ship.scriptedMisjump = 1; // Which causes next jump to automatically be a misjump!
This could only happen if the player moves their ship pretty close to the black hole, and could even be conditional so as to undo the likely unwanted misjump if moved away before trying to jump, assuming they're not mass-locked.

It's not much, but it does give a clue...

Re: (Demo) Black Holes

Posted: Thu Nov 16, 2023 8:37 pm
by Stormrider
phkb wrote: Tue Nov 14, 2023 6:12 am
Anyway, I thought it might be worth sharing to get those creative juices flowing!
Oh, the juice is flowing alright.
Image

Re: (Demo) Black Holes

Posted: Sat Nov 18, 2023 12:24 am
by LittleBear
Added a custom classification, so it doesn't appear on the MFD as a planet:

Image

Re: (Demo) Black Holes

Posted: Tue Dec 26, 2023 2:07 pm
by Cholmondely