• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Kario

OpenGL
What is the fastes way to load textures in opengl ?

22 posts in this topic

Loading textures takes about 2/3 - 3/4 of initialization time in our engine. Lot of time is spent in driver for texture compression, and in our code for generating mipmaps for normal maps (down sample, normalize each vector). Can this be speed up ? Is there a way to make the driver create all mipmaps for normalmaps ? Can I load already compressed textures to save time ?
0

Share this post


Link to post
Share on other sites
Use DDS. It's precompressed (to one of the S3TC/DXT formats), already in a format that's most likely native to your GPU, and can contain a full mipchain in each file. Don't be put off by the fact that you normally see it mentioned in conjunction with D3D; it's just a binary file format and all you need is a loader for it.

http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt
1

Share this post


Link to post
Share on other sites
I havn't investigated into this topic that much,
but couldn't the loadtime be speedup by Pixel Buffer Objects?
0

Share this post


Link to post
Share on other sites
[quote name='Kario' timestamp='1312287016' post='4843528']
Can I use DDS with OpenGL ? Is so how do I load the data into OpenGL ?
[/quote]

http://www.codesampler.com/oglsrc/oglsrc_4.htm#ogl_dds_texture_loader
0

Share this post


Link to post
Share on other sites
I use DevIL to read the DDS file and the compressed DDS texture goes straight to GL. Look at

[b][url="../../user/169467-mhagain/"]mhagain[/url] [url="../../user/169467-mhagain/page__f__25"][img]http://public.gamedev.net/public/style_images/master/user_popup.png[/img][/url] post for the extension to use.
[/b]
0

Share this post


Link to post
Share on other sites
I have played a little with this issue. I cannot use DDS files, because I want source data to be as small as possible to minimize download time. What I found is:
- OpenGL compresses textures very slowly, maybe I should write my own compression code.
- If I switch compression off glTexImage2D is still relatively slow.
- gluBuild2DMipmaps is much slower than generating mipmaps on client side and calling glTexImage2D for each mipmap level.

So my questions now are:
- Is there a third party library of some kind that can compress textures fast ?
- Why is glTexImage2D so slow ? it takes 3 sec for a ~2500 calls (with mipmaps and with out compresson) that is extreamly slow for just coping data.
-1

Share this post


Link to post
Share on other sites
glTexImage2D does more than just copy data. It needs to allocate video RAM too, possibly do some moving of already allocated data around to deal with fragmentation, possibly do some swapping, possibly allocate backup copies in system memory, and very probably convert data from non-GPU-native formats to GPU-native formats.

You'll get the most mileage on the latter point, and this relates to the '[i]format[/i]' parameter to glTexImage2D. If you're using GL_RGB you should investigate switching to GL_BGRA. In most cases this will be considerably faster, and I've personally benchmarked it up to 6 times faster on NVIDIA and up to 40 (!!!) times faster on Intel. Likewise if you're using GL_BGR you should still consider switching to GL_BGRA. For further info see here: [url="http://www.opengl.org/wiki/Common_Mistakes#Texture_upload_and_pixel_reads"]http://www.opengl.or...and_pixel_reads[/url]

Of course this means that you need to store images in a format that supports BGRA, otherwise you'll need to convert on the CPU during texture loading. And that in turn means TGA is the only really viable option, which means bigger image files. So you're in tradeoff country right away.

That brings me to DDS again. I'm quite surprised that you found DDS files to be excessively large. It will give you between 8:1 and 4:1 compression over TGA, so unless you're using something like PNG as your image format (which will also contribute to slowness as it needs to be decompressed before being sent through glTexImage2D) DDS should be optimal.
1

Share this post


Link to post
Share on other sites
[quote name='Kario' timestamp='1312735651' post='4845818']
I have played a little with this issue. I cannot use DDS files, because I want source data to be as small as possible to minimize download time. What I found is:
[/quote]

Maybe at this point it would be interesting to know what format you are using for your textures, if compressed DDS files are too large. And don't say "jpg".

Also, did you zip them and compare _that_ size? Because that's the only size that matters for downloads.
0

Share this post


Link to post
Share on other sites
[quote name='Kario' timestamp='1312735651' post='4845818']- OpenGL compresses textures very slowly, maybe I should write my own compression code
[/quote]

You are suppose to send the DDS raw data to GL. GL will not decompress or recompress. It is fast.
1

Share this post


Link to post
Share on other sites
Thanks for replays. I'll investigate GL_BGRA for sure as I'm using RGBA at this point. Most of textures are in jpeg format so switch to DDS means much larger files. One odf the features of DDS files is it contains mip maps but that means +50% larger files.
0

Share this post


Link to post
Share on other sites
[quote name='Kario' timestamp='1313411670' post='4849345']
Thanks for replays. I'll investigate GL_BGRA for sure as I'm using RGBA at this point. Most of textures are in jpeg format so switch to DDS means much larger files. One odf the features of DDS files is it contains mip maps but that means +50% larger files.
[/quote]

That's your tradeoff - faster loading or smaller files - pick one.

Using JPEGs will definitely give you much slower loading times, by the way. First of all you have to decompress the JPEG to RGBA (or BGRA), then glTexImage2D it, then generate all of your miplevels by hand and glTexImage2D each of them. The sole benefit is that it comes off the disk faster, but once in memory it will be orders of magnitude slower.
0

Share this post


Link to post
Share on other sites
Not all DDS files contain mipmaps. You need to check if there are mipmaps present at load time. If there aren't , have gl generate them.
1

Share this post


Link to post
Share on other sites
[quote name='Kario' timestamp='1312735651' post='4845818']
I have played a little with this issue. I cannot use DDS files, because I want source data to be as small as possible to minimize download time. What I found is:
- OpenGL compresses textures very slowly, maybe I should write my own compression code.
- If I switch compression off glTexImage2D is still relatively slow.
- gluBuild2DMipmaps is much slower than generating mipmaps on client side and calling glTexImage2D for each mipmap level.

So my questions now are:
- Is there a third party library of some kind that can compress textures fast ?
- Why is glTexImage2D so slow ? it takes 3 sec for a ~2500 calls (with mipmaps and with out compresson) that is extreamly slow for just coping data.
[/quote]

I have to admit I am surprised at this result, because OpenGL is [url="http://lspiroengine.com/?p=60"]insanely faster than DirectX[/url] when it comes to generating mipmaps (which is the main bottleneck).
But I am using ::glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE );.

gluBuild2DMipmaps() is most likely trying to create mipmaps that are of high quality, which is the primary reason for slowdown in Direct3D.
If the quality of the mipmaps is not so important, they can be generated nearly instantaneously with GL_GENERATE_MIPMAP_SGIS.
Also try ::glHint( GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST );.


L. Spiro
0

Share this post


Link to post
Share on other sites
[quote name='YogurtEmperor' timestamp='1313547798' post='4850117']
But I am using ::glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE );[/quote]
The SGI version of this token has been deprecated for eons. For OpenGL 2 and before, use the standard GL_GENERATE_MIPMAP token in its place.

For OpenGL 3+, use the [url="http://www.opengl.org/sdk/docs/man3/xhtml/glGenerateMipmap.xml"]glGenerateMipmap(GLenum target)[/url] function instead.
0

Share this post


Link to post
Share on other sites
[quote name='YogurtEmperor' timestamp='1313547798' post='4850117']
[quote name='Kario' timestamp='1312735651' post='4845818']
I have played a little with this issue. I cannot use DDS files, because I want source data to be as small as possible to minimize download time. What I found is:
- OpenGL compresses textures very slowly, maybe I should write my own compression code.
- If I switch compression off glTexImage2D is still relatively slow.
- gluBuild2DMipmaps is much slower than generating mipmaps on client side and calling glTexImage2D for each mipmap level.

So my questions now are:
- Is there a third party library of some kind that can compress textures fast ?
- Why is glTexImage2D so slow ? it takes 3 sec for a ~2500 calls (with mipmaps and with out compresson) that is extreamly slow for just coping data.
[/quote]

I have to admit I am surprised at this result, because OpenGL is [url="http://lspiroengine.com/?p=60"]insanely faster than DirectX[/url] when it comes to generating mipmaps (which is the main bottleneck).
But I am using ::glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE );.

gluBuild2DMipmaps() is most likely trying to create mipmaps that are of high quality, which is the primary reason for slowdown in Direct3D.
If the quality of the mipmaps is not so important, they can be generated nearly instantaneously with GL_GENERATE_MIPMAP_SGIS.
Also try ::glHint( GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST );.


L. Spiro
[/quote]

That comparison is misleading as it's comparing a software process with a hardware process. One could just as easily claim that D3D is insanely faster than OpenGL at building mipmaps because D3DUSAGE_AUTOGENMIPMAP with GenerateMipSublevels is faster than gluBuild2DMipmaps. ;)

Speaking of which, gluBuild2DMipmaps is slow, slow, SLOW. Check the documentation for it [url="http://www.opengl.org/sdk/docs/man/xhtml/gluBuild2DMipmaps.xml"]here[/url] to see why. Rescaling dimensions: check. Building proxy textures: check. Readback from the GPU: check. None of those are going to give you the best performance, which is why it's generally not recommended.

(It doesn't build high quality mipmaps by the way; it just uses a simple box filter - although I've found myself that this filter often produces results that look better than any other).
0

Share this post


Link to post
Share on other sites
[quote name='mhagain' timestamp='1312743957' post='4845862']That brings me to DDS again. I'm quite surprised that you found DDS files to be excessively large. It will give you between 8:1 and 4:1 compression over TGA, so unless you're using something like PNG as your image format (which will also contribute to slowness as it needs to be decompressed before being sent through glTexImage2D) DDS should be optimal.[/quote]

[quote]Using JPEGs will definitely give you much slower loading times, by the way[/quote]

Depends where your bottle neck is. Sometimes PNG or JPEG decompression is faster than reading larger files off disk. In my experience JPEG decompression can be especially fast if the lib is hardware assisted.

I do have a question regarding DDS though, anyone know licensing issues and restrictions for using this format in commercial applications?
0

Share this post


Link to post
Share on other sites
[quote name='YogurtEmperor' timestamp='1313547798' post='4850117']
[quote name='Kario' timestamp='1312735651' post='4845818']
I have played a little with this issue. I cannot use DDS files, because I want source data to be as small as possible to minimize download time. What I found is:
- OpenGL compresses textures very slowly, maybe I should write my own compression code.
- If I switch compression off glTexImage2D is still relatively slow.
- gluBuild2DMipmaps is much slower than generating mipmaps on client side and calling glTexImage2D for each mipmap level.

So my questions now are:
- Is there a third party library of some kind that can compress textures fast ?
- Why is glTexImage2D so slow ? it takes 3 sec for a ~2500 calls (with mipmaps and with out compresson) that is extreamly slow for just coping data.
[/quote]

I have to admit I am surprised at this result, because OpenGL is [url="http://lspiroengine.com/?p=60"]insanely faster than DirectX[/url] when it comes to generating mipmaps (which is the main bottleneck).
But I am using ::glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE );.

gluBuild2DMipmaps() is most likely trying to create mipmaps that are of high quality, which is the primary reason for slowdown in Direct3D.
If the quality of the mipmaps is not so important, they can be generated nearly instantaneously with GL_GENERATE_MIPMAP_SGIS.
Also try ::glHint( GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST );.


L. Spiro
[/quote]

There is an app for that
http://www.opengl.org/wiki/Common_Mistakes#gluBuild2DMipmaps
http://www.opengl.org/wiki/Common_Mistakes#Automatic_mipmap_generation
0

Share this post


Link to post
Share on other sites
[quote name='Tachikoma' timestamp='1313574473' post='4850211']
I do have a question regarding DDS though, anyone know licensing issues and restrictions for using this format in commercial applications?
[/quote]

DDS is cool. Use it.
1

Share this post


Link to post
Share on other sites
Instead of using an actual image format (such as TGA) which supports BGRA format, why not ship your images as plain image files already in that format. You don't need all the headers, you just need four bytes per pixel.

Lay them all out in a big block of ram, save that to disk, gzip it. When you come time to load it, you're only loading one file -- you hoof it into one giant block of ram (only 1 allocation, only 1 directory walk). Ungzipping a file is pretty easy on loading it. In addition your compression should be even better; larger files generally compress better than a set of smaller files because the compression can find more similarities to reduce.

Instead of generating the mipmaps on load every time, generate them on first run and save them out to disk. Again, do this one big block if possible. On load, pull it in, rattle down it transmitting the mipmap levels individually.


If you're on an OS which supports mapping the files, you don't need to load them or do an actual memory allocation. Map the file into your address space, provide suitable "linear access" hints to your buffer caching system so it will do read-aheads, start accessing the memory and away you go. The OS will try and load pages ahead of your accesses in the background; you don't have to wait for the "read()" call to complete. The effect of this is that you can already be generating and uploading mipmaps for texture 1 while the disk IO channels are still loading texture 20.


Instead of asking the GLU library to generate your mipmaps, you could build them yourself by using rendering of the fullsize image to pixel buffer objects and copies internal to the card to make them. That way the mipmap data doesn't have to transit the host-GPU bus.
1

Share this post


Link to post
Share on other sites
[quote name='swiftcoder' timestamp='1313560635' post='4850160']
[quote name='YogurtEmperor' timestamp='1313547798' post='4850117']
But I am using ::glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE );[/quote]
The SGI version of this token has been deprecated for eons. For OpenGL 2 and before, use the standard GL_GENERATE_MIPMAP token in its place.

For OpenGL 3+, use the [url="http://www.opengl.org/sdk/docs/man3/xhtml/glGenerateMipmap.xml"]glGenerateMipmap(GLenum target)[/url] function instead.
[/quote]
I don’t actually use SGIS (I use GL_GENERATE_MIPMAP). I just added that just in case the original poster is trying to maintain heavy backwards compatibility as I once did in the past.


Also I strongly suspect that the original poster’s bottleneck is indeed mipmaps.
Yes, they can be generated offline, but I have found so little slowdown with GL_GENERATE_MIPMAP that I don’t believe it is necessary, and it can save you disk space.
I recommend that he test his speed using GL_GENERATE_MIPMAP and then decide if he wants to trade mipmap [i]quality[/i] for larger files on disk.


L. Spiro
0

Share this post


Link to post
Share on other sites
[quote name='YogurtEmperor' timestamp='1313677621' post='4850779']
Yes, they can be generated offline, but I have found so little slowdown with GL_GENERATE_MIPMAP that I don’t believe it is necessary, and it can save you disk space.
I recommend that he test his speed using GL_GENERATE_MIPMAP and then decide if he wants to trade mipmap [i]quality[/i] for larger files on disk.[/quote]

Yes, I would agree.

And if GL_GENERATE_MIPMAP isn't high enough quality (although it usually is), you can always use an FBO + pixel shader, to manually generate the mipmap chain directly on the GPU.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • By mapra99
      Hello

      I am working on a recent project and I have been learning how to code in C# using OpenGL libraries for some graphics. I have achieved some quite interesting things using TAO Framework writing in Console Applications, creating a GLUT Window. But my problem now is that I need to incorporate the Graphics in a Windows Form so I can relate the objects that I render with some .NET Controls.

      To deal with this problem, I have seen in some forums that it's better to use OpenTK instead of TAO Framework, so I can use the glControl that OpenTK libraries offer. However, I haven't found complete articles, tutorials or source codes that help using the glControl or that may insert me into de OpenTK functions. Would somebody please share in this forum some links or files where I can find good documentation about this topic? Or may I use another library different of OpenTK?

      Thanks!
    • By Solid_Spy
      Hello, I have been working on SH Irradiance map rendering, and I have been using a GLSL pixel shader to render SH irradiance to 2D irradiance maps for my static objects. I already have it working with 9 3D textures so far for the first 9 SH functions.
      In my GLSL shader, I have to send in 9 SH Coefficient 3D Texures that use RGBA8 as a pixel format. RGB being used for the coefficients for red, green, and blue, and the A for checking if the voxel is in use (for the 3D texture solidification shader to prevent bleeding).
      My problem is, I want to knock this number of textures down to something like 4 or 5. Getting even lower would be a godsend. This is because I eventually plan on adding more SH Coefficient 3D Textures for other parts of the game map (such as inside rooms, as opposed to the outside), to circumvent irradiance probe bleeding between rooms separated by walls. I don't want to reach the 32 texture limit too soon. Also, I figure that it would be a LOT faster.
      Is there a way I could, say, store 2 sets of SH Coefficients for 2 SH functions inside a texture with RGBA16 pixels? If so, how would I extract them from inside GLSL? Let me know if you have any suggestions ^^.
    • By KarimIO
      EDIT: I thought this was restricted to Attribute-Created GL contexts, but it isn't, so I rewrote the post.
      Hey guys, whenever I call SwapBuffers(hDC), I get a crash, and I get a "Too many posts were made to a semaphore." from Windows as I call SwapBuffers. What could be the cause of this?
      Update: No crash occurs if I don't draw, just clear and swap.
      static PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be { sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format 32, // Select Our Color Depth 0, 0, 0, 0, 0, 0, // Color Bits Ignored 0, // No Alpha Buffer 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored 24, // 24Bit Z-Buffer (Depth Buffer) 0, // No Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; if (!(hDC = GetDC(windowHandle))) return false; unsigned int PixelFormat; if (!(PixelFormat = ChoosePixelFormat(hDC, &pfd))) return false; if (!SetPixelFormat(hDC, PixelFormat, &pfd)) return false; hRC = wglCreateContext(hDC); if (!hRC) { std::cout << "wglCreateContext Failed!\n"; return false; } if (wglMakeCurrent(hDC, hRC) == NULL) { std::cout << "Make Context Current Second Failed!\n"; return false; } ... // OGL Buffer Initialization glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glBindVertexArray(vao); glUseProgram(myprogram); glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_SHORT, (void *)indexStart); SwapBuffers(GetDC(window_handle));  
    • By Tchom
      Hey devs!
       
      I've been working on a OpenGL ES 2.0 android engine and I have begun implementing some simple (point) lighting. I had something fairly simple working, so I tried to get fancy and added color-tinting light. And it works great... with only one or two lights. Any more than that, the application drops about 15 frames per light added (my ideal is at least 4 or 5). I know implementing lighting is expensive, I just didn't think it was that expensive. I'm fairly new to the world of OpenGL and GLSL, so there is a good chance I've written some crappy shader code. If anyone had any feedback or tips on how I can optimize this code, please let me know.
       
      Vertex Shader
      uniform mat4 u_MVPMatrix; uniform mat4 u_MVMatrix; attribute vec4 a_Position; attribute vec3 a_Normal; attribute vec2 a_TexCoordinate; varying vec3 v_Position; varying vec3 v_Normal; varying vec2 v_TexCoordinate; void main() { v_Position = vec3(u_MVMatrix * a_Position); v_TexCoordinate = a_TexCoordinate; v_Normal = vec3(u_MVMatrix * vec4(a_Normal, 0.0)); gl_Position = u_MVPMatrix * a_Position; } Fragment Shader
      precision mediump float; uniform vec4 u_LightPos["+numLights+"]; uniform vec4 u_LightColours["+numLights+"]; uniform float u_LightPower["+numLights+"]; uniform sampler2D u_Texture; varying vec3 v_Position; varying vec3 v_Normal; varying vec2 v_TexCoordinate; void main() { gl_FragColor = (texture2D(u_Texture, v_TexCoordinate)); float diffuse = 0.0; vec4 colourSum = vec4(1.0); for (int i = 0; i < "+numLights+"; i++) { vec3 toPointLight = vec3(u_LightPos[i]); float distance = length(toPointLight - v_Position); vec3 lightVector = normalize(toPointLight - v_Position); float diffuseDiff = 0.0; // The diffuse difference contributed from current light diffuseDiff = max(dot(v_Normal, lightVector), 0.0); diffuseDiff = diffuseDiff * (1.0 / (1.0 + ((1.0-u_LightPower[i])* distance * distance))); //Determine attenuatio diffuse += diffuseDiff; gl_FragColor.rgb *= vec3(1.0) / ((vec3(1.0) + ((vec3(1.0) - vec3(u_LightColours[i]))*diffuseDiff))); //The expensive part } diffuse += 0.1; //Add ambient light gl_FragColor.rgb *= diffuse; } Am I making any rookie mistakes? Or am I just being unrealistic about what I can do? Thanks in advance
    • By yahiko00
      Hi,
      Not sure to post at the right place, if not, please forgive me...
      For a game project I am working on, I would like to implement a 2D starfield as a background.
      I do not want to deal with static tiles, since I plan to slowly animate the starfield. So, I am trying to figure out how to generate a random starfield for the entire map.
      I feel that using a uniform distribution for the stars will not do the trick. Instead I would like something similar to the screenshot below, taken from the game Star Wars: Empire At War (all credits to Lucasfilm, Disney, and so on...).

      Is there someone who could have an idea of a distribution which could result in such a starfield?
      Any insight would be appreciated
  • Popular Now