Page 1 of 1

[Mod] Rotated textures [rot_texture]

PostPosted: Sat Dec 27, 2014 22:59
by Casimir
This mod rotated some nodes with mapgen (only on the surface) and when they get placed. This gives the game a much better visual appearance, eliminates the gird and slows down mapgen.
This is just a proof of concept and quite hacky, so don't use this on existing worlds without making a backup.
depends: default
license: GPL v2 or later
download: see attachment
Image

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Fri Apr 03, 2015 06:18
by 4aiman
Uhmm.. where's the picture? :)

Also, you shouldn't override nodes without making it possible to call the previous after_place (if it exists).
Just copy it to some var and then make a call:
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
for _, node_name in ipairs(nodes) do
   minetest.override_item(node_name, {paramtype2 = "facedir"})
   local old_after_place = minetest.registered_nodes[node_name].after_place
   minetest.override_item(node_name, {after_place_node =
      function(pos)
         local facedir = math.random(0,3)
         minetest.set_node(pos, {name=node_name, param2 = facedir})
         if old_after_place then old_after_place(pos) end
      end
   })

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Sun Apr 05, 2015 18:52
by Napiophelios
Wow this is pretty nice effect.
It doesnt look so good with all texture packs/nodes,
but just changing the few nodes you have as defaults makes a real visual impact.

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Sun Apr 05, 2015 20:42
by Linuxdirk
I hope this would make it into the engine! It looks so much better!

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Mon Apr 06, 2015 05:15
by 4aiman
Wow :)
Pretty nice!
As an option this may be a good idea.

But I think that there should be some other way to "mark" a node than a table.
I'd make that using groups. So, how about a group "no_grid" (or whatever you like) and some code in C++ that would do the same? (like wallmounted and facedir, but random). That would be awesome!

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Mon Apr 06, 2015 13:24
by 12Me21
It would be nice if there was a shader for this, though that would require changing some stuff in the engine (I think).

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Mon Apr 06, 2015 13:30
by 4aiman
I'm against shaders as the primary way to do it. There won't be any shaders with anything than OpenGL...

I'd like to see a full support of shaders on all renderers, but that ain't just "gonna happen". That would be tremendous amount of work.

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Mon Apr 06, 2015 13:33
by 12Me21
Yeah, I guess the current way is probably the best, even if it's a little hacky.

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Tue Apr 14, 2015 14:19
by Kilarin
Hello, I don't want to hijack the thread, but I've got a question about 4aiman's code above. A question that probably exposes my ignorance of how lua handles scope. :)

old_after_place is local to the for loop. But then you use it when defining a function that will run long after the for loop is gone. So am I correct in assuming that when lua creates the individual function, it replaces old_after_place with the actual value of old_after_place at that time? And then when you move to the next node, a NEW function will be created with a DIFFERENT static value for old_after_place.

With the result being that each node has a different function with a different value of old_after_place (obviously what we WANT it to do) We will NOT have a situation where every time any of these functions are called old_after_place has the same value of whatever it was at the end of the for loop. (NOT what we want)

Correct? And thank you VERY much for your patience in explaining things to a lua idiot. :)

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Wed Apr 15, 2015 00:21
by Kilarin
I believe I confirmed the answer myself:
http://lua-users.org/wiki/ScopeTutorial
even if the outer scope has passed, the function will still hold on to the variable.
loops create a new scope on each iteration:

Not at all what I was expecting, but VERY handy for creating "stacks" of functions!

thanks!

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Fri Jan 20, 2017 10:18
by texmex
Casimir, did you ever continue to work on this? It's such a visual quality improvement.

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Fri Jan 20, 2017 10:49
by burli

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Fri Jan 20, 2017 12:09
by texmex
Thank you. It seems greatly debated, but no outcome yet.

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Sat Jan 21, 2017 11:12
by Linuxdirk
texmex wrote:… but no outcome yet.

This is the conclusion for more or less any idea one particular person (yes, I noticed the deletion of forum posts) from the development team personally disagrees with.

It’s a pity that Minetest’s growth in features and visual improvement gets blocked so often because “no-one needs/wants that” gets confused with “I disagree with that” and “it is hard to implement” is used as replacement for “I dont have the time/patience to implement it by myself”.

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Wed Jan 25, 2017 00:55
by Melkor
This is a MUST BE in the engine, i love to see more organic stuff instead a predictable pattern on floor/walls, plus viewtopic.php?f=5&t=10921 (Texture related requests). This mixed with THIS https://www.youtube.com/watch?v=qWuI664krsI (random position/rotation of plantlike nodes)

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Wed Jan 25, 2017 10:27
by azekill_DIABLO
Casimir, you say it can't be used in created worlds, that we need a backup, that it's quite slowish and hacky or even hecky, but your false! it's pretty fast, only slows the FIRST time you create the world, then goes like charm! i never got problem looks very nice and it's pretty simple. It never created any mapgen bug or world corrupt :) It really needs to be in Minetest by default!

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Wed Jan 25, 2017 14:58
by TumeniNodes
I would love to see this.

But, if there were a way to set a node to use a few variable textures, which could be selected at random intervals, automatically, while being placed.
default_brick, could have 4 or 5 variable textures, and as you placed them, 4-5 is selected randomly via code. And the same could be done with the base nodes such as grass, dirt, stone during map loading.

Such a feature as this though, would be a good candidate for on/off settings..., and/or even the ability for it to be called from mods where it could be set to specific nodes my the mod creator, with yet another means to set it on or off within the mod as well and per node it is assigned to.

Maybe it could be called "RP" (random placement) so..., RP textures.

I don't know how feasible any of that is but, it would be nice.

Re: [Mod] Rotated textures [rot_texture]

PostPosted: Wed Jan 25, 2017 16:50
by azekill_DIABLO
yes but we would have TumeniNodes :D
(i waited for years placing this... years!!!)