Page 1 of 1

Black-and-white Minetest/video games

PostPosted: Tue Aug 09, 2016 14:55
by ABJ
Okay. I know this is a strange idea, and I may not even properly know what I'm trying to talk about, but what if Minetest, or other video games, used graphics engines (wait, am I correct?) that only rendered black and white, where all we need is a base texture and how dark it is, instead of all this RGB stuff? How much would performance be improved? Could such a thing be done?
Again, note, I'm just a curious newbie.

Re: Black-and-white Minetest/video games

PostPosted: Wed Aug 10, 2016 06:55
by lisacvuk
You'd probably only save memory, I think. Performance probably wouldn't be really improved, at least not noticeably. I'm not expert (or even over the basics level) in this field, so feel free to correct me, if I'm wrong (or actually not wrong).

Re: Black-and-white Minetest/video games

PostPosted: Wed Aug 10, 2016 21:07
by MineYoshi
lisacvuk wrote:You'd probably only save memory, I think. Performance probably wouldn't be really improved, at least not noticeably. I'm not expert (or even over the basics level) in this field, so feel free to correct me, if I'm wrong (or actually not wrong).

May be...

In my opinion you can get a bit more of performance, in Black and White...
If you modify the code to make that particles, only be of one color...

Can be a good idea do that...
Try it!

Re: Black-and-white Minetest/video games

PostPosted: Thu Aug 11, 2016 06:41
by ABJ
Yeah.
I was thinking that now we have to deal with four values (RGBA) but then we'd need only one?

Re: Black-and-white Minetest/video games

PostPosted: Thu Aug 11, 2016 22:05
by MineYoshi
ABJ wrote:Yeah.
I was thinking that now we have to deal with four values (RGBA) but then we'd need only one?

Actually Black Is the absence of the colors, the black is the presence (Totally) of every one...
RGBA means RedGreenBlueAlpha...
If you think about some textures can have "alpha" or transparency, you don't going to only handle one value!

Re: Black-and-white Minetest/video games

PostPosted: Thu Aug 11, 2016 22:19
by Ferk
This makes no difference in current hardware. Even if you use some sort of grayscale in your textures, at some point it'd end up translated into some internal representation that separates it in color channels that mix to give whatever shade of gray (that's how the screens work anyway).

I doubt you'd even save memory unless you use some archaic format to store the image data in memory. And even then it won't make it any faster.. perhaps slower depending how awkward the format is to deal with.

If you want faster image loading better just don't use any sort of image compression (unless you have a slow hard disk). The image will be larger on disk but it will load faster on memory. But even then you probably won't notice much of a difference anyway.

Re: Black-and-white Minetest/video games

PostPosted: Thu Aug 11, 2016 22:49
by MineYoshi
Ferk wrote:This makes no difference in current hardware. Even if you use some sort of grayscale in your textures, at some point it'd end up translated into some internal representation that separates it in color channels that mix to give whatever shade of gray (that's how the screens work anyway).

I doubt you'd even save memory unless you use some archaic format to store the image data in memory. And even then it won't make it any faster.. perhaps slower depending how awkward the format is to deal with.

If you want faster image loading better just don't use any sort of image compression (unless you have a slow hard disk). The image will be larger on disk but it will load faster on memory. But even then you probably won't notice much of a difference anyway.

But actually can be good for trying to test out how is Minetest when it got to convert RGBA textures to Black/White ones...

Re: Black-and-white Minetest/video games

PostPosted: Fri Aug 12, 2016 08:01
by ABJ
OK.
In any case, we can just have one texture and set how dark it is (eg; pinewood, wood, junglewood, acaciawood, etc) with the same texture and a little coding.

Either way, IMHO all those World War simulators should become black-and-white.

Re: Black-and-white Minetest/video games

PostPosted: Fri Aug 12, 2016 22:15
by MineYoshi
ABJ wrote:OK.
In any case, we can just have one texture and set how dark it is (eg; pinewood, wood, junglewood, acaciawood, etc) with the same texture and a little coding.

Maybe...
If you change the palete to only 4 greys, i don't know. the game can be faster, starting from the point that when a texture is less bigger, and less colorful... It's faster to load!

Re: Black-and-white Minetest/video games

PostPosted: Sat Aug 20, 2016 11:09
by cd2
To see how it could look, just add this line of code to the end of opengl_fragmet.glsl (for me its line 212):

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
col = vec4((col.b+col.g+col.b)/3.0,(col.b+col.g+col.b)/3.0,(col.b+col.g+col.b)/3.0, col.a);


Image

Re: Black-and-white Minetest/video games

PostPosted: Sat Aug 20, 2016 11:15
by ABJ
Thanks and where is it?
BTW what about the sky though.

Re: Black-and-white Minetest/video games

PostPosted: Sat Aug 20, 2016 11:22
by cd2
ABJ wrote:Thanks and where is it?

client/shaders/node_shader

ABJ wrote:BTW what about the sky though.

It just changes all nodes, but I think you cant change the sky color via a shader is it?

PS : This wont improve performance

Re: Black-and-white Minetest/video games

PostPosted: Sat Aug 20, 2016 11:26
by ABJ
I knw but it looks cool.

Re: Black-and-white Minetest/video games

PostPosted: Sat Aug 20, 2016 11:33
by azekill_DIABLO
yep. i think shaders should be applying to all elements in game.

PostPosted: Sat Aug 20, 2016 11:55
by Hybrid Dog
Try this:
col.rgb = vec3(max(col.rgb.r, max(col.rgb.g, col.rgb.b)));
Image

Re: Black-and-white Minetest/video games

PostPosted: Sat Aug 20, 2016 15:00
by ABJ
Water=blue
Sky=blue
BTW where to paste anyway?

Re: Black-and-white Minetest/video games

PostPosted: Sun Aug 21, 2016 07:38
by cd2
ABJ wrote:BTW where to paste anyway?

cd2 wrote:(for me its line 212)

Re: Black-and-white Minetest/video games

PostPosted: Sun Aug 21, 2016 09:33
by ABJ
Ooooooooooooon which file in where.

Re: Black-and-white Minetest/video games

PostPosted: Sun Aug 21, 2016 09:47
by cd2
cd2 wrote:
ABJ wrote:Thanks and where is it?

client/shaders/node_shader


client/shaders/node_shader/opengl_fragmet.glsl
line : 211/212

Re: Black-and-white Minetest/video games

PostPosted: Sun Aug 21, 2016 10:28
by ABJ
Oh sorry I wasn't reading that well enough.

Re: Black-and-white Minetest/video games

PostPosted: Wed Mar 01, 2017 03:03
by BBmine
Interesting..... I could use a texture pack too :)