|
Post by tukuro on Sept 14, 2017 13:29:53 GMT
For the past few days I've been working on replacing the current skybox with the milkyway (as seen here). What I thought would take a few hours or so ended up being quite a lot of work , and this is only really an approximation. New Skybox:Download Link (Updated) You can find the python code that I used to generate the chart here (Updated V1.01). The reference image is linked at the top. Only requirements are pypng. The Python version used was 3.6.2. NOTE: Your image file must be called galaxy.png and must not have an alpha channel. The new StarChart.txt will be outputed in the same directory as skyboxGenerator.py. Future goals: - Remove the weird 'lines' that make parts of the background look like fabric. (Perhaps try modding the shaders? If anyone could help with that it'd be great.)
- Fix the colours
- Improve the star distribution (Galactic centre still looks odd)
- Generate 3D galaxies and then generate a StarChart depending on the location of the system.
@qswitched:
- What are the exact RGB values of the various star types? I cannot really figure out what system is being used in-game as it appears to be a combination of everything I've read.
- What is the exact relation between the magnitude value and the way the stars appear in terms of radians?
- Could you add support for nebulae?
|
|
|
Post by The Astronomer on Sept 14, 2017 14:22:27 GMT
OH. MY. ARCHAILECT OF GOODNESS.
How's the performance? Did the game turn into a slideshow?
|
|
|
Post by tukuro on Sept 14, 2017 14:33:55 GMT
OH. MY. ARCHAILECT OF GOODNESS. How's the performance? Did the game turn into a slideshow? Pretty smooth actually. Even though it involves 230,000 stars up from ~16,000 in vanilla.
|
|
|
Post by jtyotjotjipaefvj on Sept 14, 2017 16:16:56 GMT
Do you have a less garbage site I could get the file from? That requires me to register to download it. Dropbox or google drive should work fine if you don't.
I can also take a look at the shaders if someone knows how to modify them. It's hard to say from your tiny pictures but it looks like the blocky bloom/diffraction effect is probably what's causing the weird effects.
|
|
|
Post by tukuro on Sept 14, 2017 16:28:04 GMT
Do you have a less garbage site I could get the file from? That requires me to register to download it. Dropbox or google drive should work fine if you don't. I can also take a look at the shaders if someone knows how to modify them. It's hard to say from your tiny pictures but it looks like the blocky bloom/diffraction effect is probably what's causing the weird effects. I recall at least one person on the forum that modded the shaders, but I have no idea how to do it myself. I'm sort of hoping this could be a community project. The code I'm using at the moment is pretty slow (I think generating the chart took ~20 minutes or so) and besides the colours, a lot of the parts look different from the reference. Also: New download link here.
|
|
|
Post by Kerr on Sept 14, 2017 16:43:10 GMT
Great mod, really improves atmosphere when playing.
|
|
|
Post by jtyotjotjipaefvj on Sept 14, 2017 23:46:18 GMT
Apparently the shaders are just plaintext glsl files in Resources/Shaders in the CoaDE install folder, so it should be trivial to modify them. Although looking at the stars, it looks like the issue might be floating point accuracy, not post processing. Edit: it looks like the problem already happens before the data arrives to the shader. I moved all stars one unit along each axis, so we end up outside the sky sphere: It appears the star positions are normalized before sending them to the shader, meaning we only draw things on the surface of a unit sphere. Probably not much we can do about this sadly, since it looks like the issue occurs on the CPU side that can't be modified.
|
|
|
Post by jtyotjotjipaefvj on Sept 15, 2017 0:44:27 GMT
Hold on, you mentioned your program takes a png as input? So you just project the image onto a sphere, then convert the pixels to stars? In that case the issue is probably your python converter. I'll see if I can cook something up tomorrow.
Can you tell me what format the stars are in? I could maybe make a version in c++, this shouldn't take more than a second to run.
|
|
|
Post by tukuro on Sept 15, 2017 5:45:43 GMT
Hold on, you mentioned your program takes a png as input? So you just project the image onto a sphere, then convert the pixels to stars? In that case the issue is probably your python converter. I'll see if I can cook something up tomorrow. Can you tell me what format the stars are in? I could maybe make a version in c++, this shouldn't take more than a second to run. Star format is [X position] (0 to 360) [Y position] (-90 to 90) [Magnitude] (~8 to ~1?) [Star Class] (See source code for the lists) Magnitude appears to be a logarithmic scale. I haven't been able to find out what exact classification is used or whether the classes in vanilla are the only ones available. EDIT: As for the conversion of image to stars. I actually use an (rather ugly) approximation of projecting the image onto a sphere. There is a better method which I'm trying to figure out. (Which indeed involves projecting the actual image onto a sphere)
|
|
|
Post by jtyotjotjipaefvj on Sept 15, 2017 8:12:34 GMT
Depending on the sphere projection used by the image, converting pixel coordinates to angles is exactly the right thing to do. I'll see what happens if I make my own converter.
|
|
|
Post by jtyotjotjipaefvj on Sept 15, 2017 16:28:06 GMT
I tested this with a starchart generated by my own generator that gets a 4000x2000 png as input and applies random jitter to the angle of generated stars, and still the grid pattern remains. My guess would be that the star angles are sent to the shader as 16-bit floats to save on memory usage, which sounds ridiculous given the low amount of data used. I can maybe add in some procedural jittering on the shader side, although that won't look as good as an actual high-precision result. Here's the star grid test image I got from my own generator:
|
|
|
Post by jtyotjotjipaefvj on Sept 16, 2017 1:32:14 GMT
I fixed the discretization of star positions by adding in some procedural noise in the vertex shader. It works all right for large star counts, but tukuro's star chart still looks a bit iffy due to the lower number of stars. It might be fixable with some actually worthwhile random generator. Seeding the generator is a bit of an issue though, since we only have the position and color that changes between stars, and the position being discretized is what we're trying to solve in the first place. Below is a picture of the same star distribution as earlier, but with some jittering added in to break the structure. Here's the modified vertex shader. Replace Stars.vert in Resources\Shaders\ to use it. varying vec4 Color;
float noise(vec2 p, float s)
{
return fract(765.9*cos(324.9*dot(vec3(p,s),vec3(19.7,17.5,1.3))));
}
void main()
{
Color = gl_Color;
vec4 pos = gl_Vertex;
pos.xyz += (vec3(noise(pos.xy*23.1, 72.5 * Color.x), noise(pos.yz*24.1, 96.2 * Color.y), noise(pos.zx*50.2, 13.5 * Color.z)) * 2.0 - vec3(1.0)) * .005;
gl_Position = (TotalTransformMatrix * pos).xyww;
}
|
|
|
Post by thorneel on Sept 16, 2017 19:58:13 GMT
Does anyone knows if we can get rid of this rather awful blur on stars by modifying one of those shaders, please?
|
|
utilitas
Junior Member
I can do this all day.
Posts: 59
|
Post by utilitas on Sept 23, 2017 6:31:14 GMT
Does anyone knows if we can get rid of this rather awful blur on stars by modifying one of those shaders, please? It's under BLUR and BLUR_CROSS in the PostProcess.frag. Modifying those seems to do the job.
|
|
|
Post by jtyotjotjipaefvj on Sept 23, 2017 9:22:53 GMT
I've noticed that setting bloom to 1 does the job quite well too.
|
|