mirror

Post Reply
ch98
Member
Posts: 463
Joined: Wed Jan 02, 2013 06:14

mirror

by ch98 » Post

Is it possible to put in an easy way to make mirror in mods in minetest? I hard that irrlicht can make mirrors and reflections. Maybe add a way of changing how much an surface reflects images with background texture so something like metal or water or glass can reflect a bit too.
Last edited by ch98 on Mon Aug 12, 2013 06:31, edited 1 time in total.
I have stopped playing minetest, and may not come back to it again. I would like to thank everyone that made the amazing time I had playing it. This account is not in use anymore, and the email has been linked to a unused account. If any administrator reading this has time, feel free to delete my account. Thank you very much for the great experience.

User avatar
Exilyth
Member
Posts: 73
Joined: Sun Jul 28, 2013 18:46
Location: Earth

by Exilyth » Post

There are three ways mirrors are done in games usually:

a) ray casting - light from the light sources (or rays from the camera, depending on which method is used) is cast through the world and is reflected off of surfaces (and takes on their color).

b) texture mirror - the camera is placed so that it views what the mirror would see. This view is saved as a texture and placed on the surface of the mirror. Downside: this requires one additional render pass per mirror.

c) fake - the mirror is a glass panel with a complete room placed behind it. All objects in the real room are copied in the mirror room.

Anyway, I doubt the low level rendering systems needed for either method a) or b) are made available through the lua api.
And c) might be hard to implement and/or give bad results.
I'm running 0.4.13 stable with [technic][carts][farming_plus][biome_lib][unified_inventory] and a few other mods.

ch98
Member
Posts: 463
Joined: Wed Jan 02, 2013 06:14

by ch98 » Post

Exilyth wrote:There are three ways mirrors are done in games usually:

a) ray casting - light from the light sources (or rays from the camera, depending on which method is used) is cast through the world and is reflected off of surfaces (and takes on their color).

b) texture mirror - the camera is placed so that it views what the mirror would see. This view is saved as a texture and placed on the surface of the mirror. Downside: this requires one additional render pass per mirror.

c) fake - the mirror is a glass panel with a complete room placed behind it. All objects in the real room are copied in the mirror room.

Anyway, I doubt the low level rendering systems needed for either method a) or b) are made available through the lua api.
And c) might be hard to implement and/or give bad results.

I was suggesting of making new lua api for mirror surface in nodes.
I have stopped playing minetest, and may not come back to it again. I would like to thank everyone that made the amazing time I had playing it. This account is not in use anymore, and the email has been linked to a unused account. If any administrator reading this has time, feel free to delete my account. Thank you very much for the great experience.

User avatar
SegFault22
Member
Posts: 870
Joined: Mon May 21, 2012 03:17
Location: NaN

by SegFault22 » Post

I remember, when using that game making tool ''3D Rad'', there were options to make a surface of an object ''reflective''. 3D Rad is built in C++, which Minetest is built in, so it is possible. Maybe very, very difficult, but possible.
Resources are abundant; only money is scarce. People should not have to work hard and remain poor just to pay for the needs of survival.
Society can thrive without money - but only if productive members of society are rewarded for being productive.

User avatar
hoodedice
Member
Posts: 1374
Joined: Sat Jul 06, 2013 06:33
GitHub: hoodedice
IRC: hoodedice
In-game: hoodedice
Location: world
Contact:

by hoodedice » Post

SegFault22 wrote:I remember, when using that game making tool ''3D Rad'', there were options to make a surface of an object ''reflective''. 3D Rad is built in C++, which Minetest is built in, so it is possible. Maybe very, very difficult, but possible.
Anything is possible. But implementing mirrors in a game which is by itself, largely buggy, unfinished and unoptimised is not nice.
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

hoodedice wrote:Anything is possible. But implementing mirrors in a game which is by itself, largely buggy, unfinished and unoptimised is not nice.
AFAIK, the problem with reflection is the fact that Minetest worlds are fully dynamic. In most other games, you can do those tricks because you "know" where the reflective surfaces are, and what can possibly be reflected on them and seen by the player because you have a closed, small environment.

Again, this is possible in Minetest, but not as trivial as in, say, a random FPS.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

ch98
Member
Posts: 463
Joined: Wed Jan 02, 2013 06:14

by ch98 » Post

kaeza wrote:
hoodedice wrote:Anything is possible. But implementing mirrors in a game which is by itself, largely buggy, unfinished and unoptimised is not nice.
AFAIK, the problem with reflection is the fact that Minetest worlds are fully dynamic. In most other games, you can do those tricks because you "know" where the reflective surfaces are, and what can possibly be reflected on them and seen by the player because you have a closed, small environment.

Again, this is possible in Minetest, but not as trivial as in, say, a random FPS.
so we need an very good c++ programmer working on it long time?
I have stopped playing minetest, and may not come back to it again. I would like to thank everyone that made the amazing time I had playing it. This account is not in use anymore, and the email has been linked to a unused account. If any administrator reading this has time, feel free to delete my account. Thank you very much for the great experience.

User avatar
Exilyth
Member
Posts: 73
Joined: Sun Jul 28, 2013 18:46
Location: Earth

by Exilyth » Post

Well... a basic ray/path tracing implementation isn't hard to write...

http://devmaster.net/posts/2836/raytrac ... troduction
http://www.codermind.com/articles/Raytr ... acing.html

... but it needs proper parallelisation and optimisation to run fast enough. And there can be artifacts/noise in the image when the camera moves, like this: http://www.youtube.com/watch?v=Dh9uWYaiP3s (the game shown, sfera, is open source btw)

I fear this might break the 'should run on low end machines' requirement of minetest.


So, something different...

Cheating with environment maps might be possible... They wouldn't give perfect reflections and would have to be recalculated every frame, but they might be fast enough to give the illusion of a mirror.
Mutltiple different techniques (+glsl shader code) are described e.g. here: http://www.ozone3d.net/tutorials/glsl_t ... php#part_4


If I wasn't busy learning for a test I'd go write a fork w/ray tracing.
Last edited by Exilyth on Sat Aug 17, 2013 23:23, edited 1 time in total.
I'm running 0.4.13 stable with [technic][carts][farming_plus][biome_lib][unified_inventory] and a few other mods.

User avatar
hdastwb
Member
Posts: 106
Joined: Tue Jan 01, 2013 18:47
GitHub: hdastwb
IRC: hdastwb
In-game: hdastwb
Location: United States

by hdastwb » Post

This has been brought up before, but without much success: viewtopic.php?id=1743

Texture mirroring seems like a pretty plausible feature to me, though it would probably only work well for small mirrors and on more powerful machines. One would probably have to adjust the camera location and FOV on each render pass, along with defining a certain render type which would mark mirror surfaces to the client and adding a player object for the mirror pass (unless Minetest players are actually secretly vampires).
ch98 wrote:so we need an very good c++ programmer working on it long time?
The devs have a tendency to shun actual C++ programmers; what you need is a novice who doesn't understand templates, iterators, inline functions, or RAII. You probably want a very good C programmer who knows very little C++ and can actually read through the Minetest codebase without wondering why the devs decided to redefine simple standard-library math functions and output operations for user-defined types as macros and who can read through the coding guidelines without wishing that they'd calmly overrun their calloc arrays and segfault out of existence sometime soon to be replaced with coding guidelines that, at the very least, do not encourage macros over templated inline functions or discourage the use of iterators or operator overloading for output of user-defined types.

I think it's pretty easy to figure out how to make a mirror and, assuming some basic reentrancy from the Minetest renderer, it shouldn't be too difficult to code up a basic implementation in the client. However, you'll probably have a hard time convincing any of the main devs to implement it, and any implementations from other people will likely never make it upstream. Thus, I think the addition of mirrors to Minetest is definitely a technical possibility but one that will probably never make it into the engine because of practicality reasons.

That said, I would like to be proved wrong because I would also really like to have mirrors in Minetest, but I am not going to put any time into coding it myself because I know far too much C++ and too little C to mess with the Minetest engine.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests