Find User here you can look for a user

About objects that emits light

1y
#1
@bastecklein

In MC1 we have objects that emits light, from crystalline to light poles.
Now, I am thinking if we can do that in MC2...

United Earth main battle tank at late evening, MagicaVoxel render. Light effects here is just a demonstration.

So here's my question.
If you plan to add lighting effects, how would you assign voxels that emits light?
Will that be a universal ones which the voxel of selected color will always emit light, or we can customize it in object settings?
Also, when should it gives light? All the time or just at night?
Can light-emitting setting be switched off independently (to reduce calculation burden) from general light effect settings?

Hopefully this would be a question that worth asking and some discussion.
You can help by EXPANDING IT.
1y
#2
I have been thinking of that very issue @GeneralWadaling due to the day/night cycle in the game.

In MC1, the lighting effects are a simple filtered color overlay drawn over the game screen, so they do not impact performance too terribly much.

For MC2, the performance hit would be far greater. You can see it yourself in the time it takes to render a scene in MagicaVoxel, which is actually a compiled application (unlike JS) and is only performing a single render (MC2 needs to perform the render, ideally, 60 times every second).

Generally lighting in a 3d game uses pre-baked light maps, where all lighting information is compiled and saved before hand. In MC2 this can't really happen since the player is literally building the game world in real time.

For performance reasons, an actual 3d scene can have at most 50-60 point lights on a fairly high end desktop computer. That might sound like enough, but for a large city with a lot of lit up buildings, it's not enough at all. And for mobile that number could be as small as 5 or 6. I ran into this problem when I started adding dynamic lighting to Death 3d. I was putting lights everywhere and the game was starting to look absolutely beautiful until the engine ground to a halt, and on mobile it would only display a black screen.

There are options to fake lighting though, which I am considering. First of all, I am considering adding an option in Voxel Paint to make a voxel "illuminated." Basically, the voxel would not emit any light outwards, but it would be unaffected by the world light level, making it appear to glow in the dark. This option will be added in Voxel Paint v1.6.0 (I am releasing 1.5 today), whether or not it is implemented in MC2. Even that will add some overhead to the engine though, as the illuminated voxels would need to be broken out into a separate object, and then the two models would need to be grouped together as one, or multiple if different brightness intensities were desired.

You can also use a static sprite to fake lighting on the ground, which is a method used in a lot of games that require dynamic lighting. Basically you take a .png image which is a circle that has a gradient of white (or whatever the light color) in the center, and fades to transparent around the edges. You then just lay this sprite on the ground where you want a light to shine and do some color blending to make it look like the area under the light is illuminated.

I could also add a "Render" option to MC2, where just for a single frame it can compile your current scene with all sorts of lights and effects turned on and save a static picture for you. Could be a fun little option. In conclusion though, I have absolutely been thinking of this very issue, it's just a bit more complicated than it seems it should be. At the end of the day though, it will need to be "hacked" in some way, because just having each building or unit emit it's own light will simply not be doable :-/
Owner of Ape Apps, LLC
1y
#3
bastecklein said:I have been thinking of that very issue @GeneralWadaling due to the day/night cycle in the game.

In MC1, the lighting effects are a simple filtered color overlay drawn over the game screen, so they do not impact performance too terribly much.

For MC2, the performance hit would be far greater. You can see it yourself in the time it takes to render a scene in MagicaVoxel, which is actually a compiled application (unlike JS) and is only performing a single render (MC2 needs to perform the render, ideally, 60 times every second).

Generally lighting in a 3d game uses pre-baked light maps, where all lighting information is compiled and saved before hand. In MC2 this can't really happen since the player is literally building the game world in real time.

For performance reasons, an actual 3d scene can have at most 50-60 point lights on a fairly high end desktop computer. That might sound like enough, but for a large city with a lot of lit up buildings, it's not enough at all. And for mobile that number could be as small as 5 or 6. I ran into this problem when I started adding dynamic lighting to Death 3d. I was putting lights everywhere and the game was starting to look absolutely beautiful until the engine ground to a halt, and on mobile it would only display a black screen.

There are options to fake lighting though, which I am considering. First of all, I am considering adding an option in Voxel Paint to make a voxel "illuminated." Basically, the voxel would not emit any light outwards, but it would be unaffected by the world light level, making it appear to glow in the dark. This option will be added in Voxel Paint v1.6.0 (I am releasing 1.5 today), whether or not it is implemented in MC2. Even that will add some overhead to the engine though, as the illuminated voxels would need to be broken out into a separate object, and then the two models would need to be grouped together as one, or multiple if different brightness intensities were desired.

You can also use a static sprite to fake lighting on the ground, which is a method used in a lot of games that require dynamic lighting. Basically you take a .png image which is a circle that has a gradient of white (or whatever the light color) in the center, and fades to transparent around the edges. You then just lay this sprite on the ground where you want a light to shine and do some color blending to make it look like the area under the light is illuminated.

I could also add a "Render" option to MC2, where just for a single frame it can compile your current scene with all sorts of lights and effects turned on and save a static picture for you. Could be a fun little option. In conclusion though, I have absolutely been thinking of this very issue, it's just a bit more complicated than it seems it should be. At the end of the day though, it will need to be "hacked" in some way, because just having each building or unit emit it's own light will simply not be doable :-/


The solution here is to implement real time ray tracing. It works by reducing a frame's samples to extremely low levels ( thus speeding up render times), then using AI to improve the quality of the frame until it looks realistic. Lots of games are implementing this feature now, including minecraft (which looks similar to MC2).

MC2 with real time raytracing could look similar to this, minus the detailed bushes:



1y
#4
Lightened voxels that does not radiate light works fine for me, at least will make buildings more lively at night. :)
Again, the render in MagicaVoxel is just for reference, we don't have to make something fine as that :P
You can help by EXPANDING IT.
1y
#5
username said:
The solution here is to implement real time ray tracing. It works by reducing a frame's samples to extremely low levels ( thus speeding up render times), then using AI to improve the quality of the frame until it looks realistic. Lots of games are implementing this feature now, including minecraft (which looks similar to MC2).

MC2 with real time raytracing could look similar to this, minus the detailed bushes:




again not a programmer but like I feel like to develop all that would take almost as much time as the game, and its just light.
If this forum isn't active, then ill make it active!
1y
#6
DoYouHaveAnyOats said:
username said:
The solution here is to implement real time ray tracing. It works by reducing a frame's samples to extremely low levels ( thus speeding up render times), then using AI to improve the quality of the frame until it looks realistic. Lots of games are implementing this feature now, including minecraft (which looks similar to MC2).

MC2 with real time raytracing could look similar to this, minus the detailed bushes:




again not a programmer but like I feel like to develop all that would take almost as much time as the game, and its just light.


Nvidia already developed the system so most of the hard work is done, all bast needs to do is add support for Nvidia rtx. Of course since this feature doesn't impact gameplay I don't expect him to implement it right away, but if he works on it steadily over the course of the game's development we might see a fully raytraced MC2 before the beta testing ends. Then again I could be totally wrong and adding support for rtx might be crazy hard, or their might be other hurdles, but at the moment I don't think that's the case.
1y
#7
Not everyone has an Nvidia GPU, not everyone has an RTX-enabled Nvidia GPU, and adding support for ray-tracing is still nowhere near as easy as looking it up and implementing it. I know this, because I am a programmer.

The reality is, the basis of the game is just not performant enough for really advanced 3d like this. Honestly, I'm impressed that Bast even got voxels to run reasonably well in JS. But adding lighting on top of that will probably push it too far. Real Time Ray-tracing in JS is a pipe dream.
1y
#8
Totillity1 said:Not everyone has an Nvidia GPU, not everyone has an RTX-enabled Nvidia GPU, and adding support for ray-tracing is still nowhere near as easy as looking it up and implementing it. I know this, because I am a programmer.

The reality is, the basis of the game is just not performant enough for really advanced 3d like this. Honestly, I'm impressed that Bast even got voxels to run reasonably well in JS. But adding lighting on top of that will probably push it too far. Real Time Ray-tracing in JS is a pipe dream.


That's why I began gave up asking have objects emitting rays (‘reflected’ in previous comment of mine, now combinding your professional opinion) lol, if that's just a fluorescent voxel that would also work for me
You can help by EXPANDING IT.
Welcome
Ape Apps, LLC is an independent software development company founded in 2010 by Brandon Stecklein. Over the years, Ape Apps has published over 400 apps and games across various platforms. You can get in touch with Brandon on Twitter or by leaving a post on his wall @bastecklein
App of the Day